[PATCH] D26509: [OpenCL] Fix integer parameters of enqueue_kernel

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 11 08:23:18 PST 2016


yaxunl added a comment.

My main concern is that by making the number of event be of type size_t instead of uint we are not conforming to the spec, although I agree it is better for the user.



================
Comment at: lib/CodeGen/CGBuiltin.cpp:2547
+      llvm::Value *NumEvents =
+          Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(3)), Int32Ty);
       llvm::Value *EventList =
----------------
should Int32Ty be SizeTy?


================
Comment at: lib/Sema/SemaChecking.cpp:453
 
-    // Forth argument has to be any integer type.
-    if (!Arg3->getType()->isIntegerType()) {
-      S.Diag(TheCall->getArg(3)->getLocStart(),
-             diag::err_opencl_enqueue_kernel_expected_type)
-          << "integer";
-      return true;
-    }
+    // Fourth argument has to be any integer type that fits into 32 bits.
+    checkOpenCLEnqueueIntType(S, Arg3, S.Context.UnsignedIntTy);
----------------
This comment does not match what this function does. The function checks if the argument is integer type but does not check if it fits into 32 bit. Also the diagnostic msg says it is not an integer type and does not mention the size requirement.


================
Comment at: test/CodeGenOpenCL/cl20-device-side-enqueue.cl:1
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir-unknown-unknown" | FileCOMMON %s --COMMON-prefix=COMMON --COMMON-prefix=B32
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o -  -triple "spir64-unknown-unknown" | FileCOMMON %s --COMMON-prefix=COMMON --COMMON-prefix=B64
----------------
It seems the command is changed by replacing all CHECK with COMMON.


https://reviews.llvm.org/D26509





More information about the cfe-commits mailing list