forked from OSchip/llvm-project
[OpenCL] An implementation of device side enqueue (DSE) from OpenCL v2.0 s6.13.17.
- Added new Builtins: enqueue_kernel, get_kernel_work_group_size and get_kernel_preferred_work_group_size_multiple. These Builtins use custom check to diagnose parameters of the passed Blocks i. e. variable number of 'local void*' type params, and check different overloads specified in Table 6.31 of OpenCL v2.0. - IR is generated as an internal library call for each OpenCL Builtin, reusing ObjC Block implementation. Review: http://reviews.llvm.org/D20249 llvm-svn: 274540
This commit is contained in:
parent
a72b49efe4
commit
db7a31cce7
|
@ -1898,6 +1898,11 @@ public:
|
|||
/// This should never be used when type qualifiers are meaningful.
|
||||
const Type *getArrayElementTypeNoTypeQual() const;
|
||||
|
||||
/// If this is a pointer type, return the pointee type.
|
||||
/// If this is an array type, return the array element type.
|
||||
/// This should never be used when type qualifiers are meaningful.
|
||||
const Type *getPointeeOrArrayElementType() const;
|
||||
|
||||
/// If this is a pointer, ObjC object pointer, or block
|
||||
/// pointer, this returns the respective pointee.
|
||||
QualType getPointeeType() const;
|
||||
|
@ -5771,6 +5776,15 @@ inline const Type *Type::getBaseElementTypeUnsafe() const {
|
|||
return type;
|
||||
}
|
||||
|
||||
inline const Type *Type::getPointeeOrArrayElementType() const {
|
||||
const Type *type = this;
|
||||
if (type->isAnyPointerType())
|
||||
return type->getPointeeType().getTypePtr();
|
||||
else if (type->isArrayType())
|
||||
return type->getBaseElementTypeUnsafe();
|
||||
return type;
|
||||
}
|
||||
|
||||
/// Insertion operator for diagnostics. This allows sending QualType's into a
|
||||
/// diagnostic with <<.
|
||||
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
|
||||
|
|
|
@ -1306,6 +1306,12 @@ LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
|
|||
LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
|
||||
LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
|
||||
|
||||
// OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
|
||||
// Custom builtin check allows to perform special check of passed block arguments.
|
||||
LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
|
||||
LANGBUILTIN(get_kernel_work_group_size, "i.", "tn", OCLC20_LANG)
|
||||
LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "i.", "tn", OCLC20_LANG)
|
||||
|
||||
// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
|
||||
LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
|
||||
LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
|
||||
|
|
|
@ -7944,6 +7944,20 @@ def err_opencl_builtin_to_addr_arg_num : Error<
|
|||
"invalid number of arguments to function: %0">;
|
||||
def err_opencl_builtin_to_addr_invalid_arg : Error<
|
||||
"invalid argument %0 to function: %1, expecting a generic pointer argument">;
|
||||
|
||||
// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
|
||||
def err_opencl_enqueue_kernel_incorrect_args : Error<
|
||||
"illegal call to enqueue_kernel, incorrect argument types">;
|
||||
def err_opencl_enqueue_kernel_expected_type : Error<
|
||||
"illegal call to enqueue_kernel, expected %0 argument type">;
|
||||
def err_opencl_enqueue_kernel_local_size_args : Error<
|
||||
"mismatch in number of block parameters and local size arguments passed">;
|
||||
def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
|
||||
"local memory sizes need to be specified as uint">;
|
||||
def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
|
||||
"blocks used in device side enqueue are expected to have parameters of type 'local void*'">;
|
||||
def err_opencl_enqueue_kernel_blocks_no_args : Error<
|
||||
"blocks in this form of device side enqueue call are expected to have have no parameters">;
|
||||
} // end of sema category
|
||||
|
||||
let CategoryName = "OpenMP Issue" in {
|
||||
|
|
|
@ -2203,6 +2203,148 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
ConvertType(E->getType())));
|
||||
}
|
||||
|
||||
// OpenCL v2.0, s6.13.17 - Enqueue kernel function.
|
||||
// It contains four different overload formats specified in Table 6.13.17.1.
|
||||
case Builtin::BIenqueue_kernel: {
|
||||
StringRef Name; // Generated function call name
|
||||
unsigned NumArgs = E->getNumArgs();
|
||||
|
||||
llvm::Type *QueueTy = ConvertType(getContext().OCLQueueTy);
|
||||
llvm::Type *RangeTy = ConvertType(getContext().OCLNDRangeTy);
|
||||
|
||||
llvm::Value *Queue = EmitScalarExpr(E->getArg(0));
|
||||
llvm::Value *Flags = EmitScalarExpr(E->getArg(1));
|
||||
llvm::Value *Range = EmitScalarExpr(E->getArg(2));
|
||||
|
||||
if (NumArgs == 4) {
|
||||
// The most basic form of the call with parameters:
|
||||
// queue_t, kernel_enqueue_flags_t, ndrange_t, block(void)
|
||||
Name = "__enqueue_kernel_basic";
|
||||
llvm::Type *ArgTys[] = {QueueTy, Int32Ty, RangeTy, Int8PtrTy};
|
||||
llvm::FunctionType *FTy = llvm::FunctionType::get(
|
||||
Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys, 4), false);
|
||||
|
||||
llvm::Value *Block =
|
||||
Builder.CreateBitCast(EmitScalarExpr(E->getArg(3)), Int8PtrTy);
|
||||
|
||||
return RValue::get(Builder.CreateCall(
|
||||
CGM.CreateRuntimeFunction(FTy, Name), {Queue, Flags, Range, Block}));
|
||||
}
|
||||
assert(NumArgs >= 5 && "Invalid enqueue_kernel signature");
|
||||
|
||||
// Could have events and/or vaargs.
|
||||
if (E->getArg(3)->getType()->isBlockPointerType()) {
|
||||
// No events passed, but has variadic arguments.
|
||||
Name = "__enqueue_kernel_vaargs";
|
||||
llvm::Value *Block =
|
||||
Builder.CreateBitCast(EmitScalarExpr(E->getArg(3)), Int8PtrTy);
|
||||
// Create a vector of the arguments, as well as a constant value to
|
||||
// express to the runtime the number of variadic arguments.
|
||||
std::vector<llvm::Value *> Args = {Queue, Flags, Range, Block,
|
||||
ConstantInt::get(IntTy, NumArgs - 4)};
|
||||
std::vector<llvm::Type *> ArgTys = {QueueTy, IntTy, RangeTy, Int8PtrTy,
|
||||
IntTy};
|
||||
|
||||
// Add the variadics.
|
||||
for (unsigned I = 4; I < NumArgs; ++I) {
|
||||
llvm::Value *ArgSize = EmitScalarExpr(E->getArg(I));
|
||||
unsigned TypeSizeInBytes =
|
||||
getContext()
|
||||
.getTypeSizeInChars(E->getArg(I)->getType())
|
||||
.getQuantity();
|
||||
Args.push_back(TypeSizeInBytes < 4
|
||||
? Builder.CreateZExt(ArgSize, Int32Ty)
|
||||
: ArgSize);
|
||||
}
|
||||
|
||||
llvm::FunctionType *FTy = llvm::FunctionType::get(
|
||||
Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), true);
|
||||
return RValue::get(
|
||||
Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
|
||||
llvm::ArrayRef<llvm::Value *>(Args)));
|
||||
}
|
||||
// Any calls now have event arguments passed.
|
||||
if (NumArgs >= 7) {
|
||||
llvm::Type *EventTy = ConvertType(getContext().OCLClkEventTy);
|
||||
unsigned AS4 =
|
||||
E->getArg(4)->getType()->isArrayType()
|
||||
? E->getArg(4)->getType().getAddressSpace()
|
||||
: E->getArg(4)->getType()->getPointeeType().getAddressSpace();
|
||||
llvm::Type *EventPtrAS4Ty =
|
||||
EventTy->getPointerTo(CGM.getContext().getTargetAddressSpace(AS4));
|
||||
unsigned AS5 =
|
||||
E->getArg(5)->getType()->getPointeeType().getAddressSpace();
|
||||
llvm::Type *EventPtrAS5Ty =
|
||||
EventTy->getPointerTo(CGM.getContext().getTargetAddressSpace(AS5));
|
||||
|
||||
llvm::Value *NumEvents = EmitScalarExpr(E->getArg(3));
|
||||
llvm::Value *EventList =
|
||||
E->getArg(4)->getType()->isArrayType()
|
||||
? EmitArrayToPointerDecay(E->getArg(4)).getPointer()
|
||||
: EmitScalarExpr(E->getArg(4));
|
||||
llvm::Value *ClkEvent = EmitScalarExpr(E->getArg(5));
|
||||
llvm::Value *Block =
|
||||
Builder.CreateBitCast(EmitScalarExpr(E->getArg(6)), Int8PtrTy);
|
||||
|
||||
std::vector<llvm::Type *> ArgTys = {
|
||||
QueueTy, Int32Ty, RangeTy, Int32Ty,
|
||||
EventPtrAS4Ty, EventPtrAS5Ty, Int8PtrTy};
|
||||
std::vector<llvm::Value *> Args = {Queue, Flags, Range, NumEvents,
|
||||
EventList, ClkEvent, Block};
|
||||
|
||||
if (NumArgs == 7) {
|
||||
// Has events but no variadics.
|
||||
Name = "__enqueue_kernel_basic_events";
|
||||
llvm::FunctionType *FTy = llvm::FunctionType::get(
|
||||
Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), false);
|
||||
return RValue::get(
|
||||
Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
|
||||
llvm::ArrayRef<llvm::Value *>(Args)));
|
||||
}
|
||||
// Has event info and variadics
|
||||
// Pass the number of variadics to the runtime function too.
|
||||
Args.push_back(ConstantInt::get(Int32Ty, NumArgs - 7));
|
||||
ArgTys.push_back(Int32Ty);
|
||||
Name = "__enqueue_kernel_events_vaargs";
|
||||
|
||||
// Add the variadics.
|
||||
for (unsigned I = 7; I < NumArgs; ++I) {
|
||||
llvm::Value *ArgSize = EmitScalarExpr(E->getArg(I));
|
||||
unsigned TypeSizeInBytes =
|
||||
getContext()
|
||||
.getTypeSizeInChars(E->getArg(I)->getType())
|
||||
.getQuantity();
|
||||
Args.push_back(TypeSizeInBytes < 4
|
||||
? Builder.CreateZExt(ArgSize, Int32Ty)
|
||||
: ArgSize);
|
||||
}
|
||||
llvm::FunctionType *FTy = llvm::FunctionType::get(
|
||||
Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), true);
|
||||
return RValue::get(
|
||||
Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
|
||||
llvm::ArrayRef<llvm::Value *>(Args)));
|
||||
}
|
||||
}
|
||||
// OpenCL v2.0 s6.13.17.6 - Kernel query functions need bitcast of block
|
||||
// parameter.
|
||||
case Builtin::BIget_kernel_work_group_size: {
|
||||
Value *Arg = EmitScalarExpr(E->getArg(0));
|
||||
Arg = Builder.CreateBitCast(Arg, Int8PtrTy);
|
||||
return RValue::get(
|
||||
Builder.CreateCall(CGM.CreateRuntimeFunction(
|
||||
llvm::FunctionType::get(IntTy, Int8PtrTy, false),
|
||||
"__get_kernel_work_group_size_impl"),
|
||||
Arg));
|
||||
}
|
||||
case Builtin::BIget_kernel_preferred_work_group_size_multiple: {
|
||||
Value *Arg = EmitScalarExpr(E->getArg(0));
|
||||
Arg = Builder.CreateBitCast(Arg, Int8PtrTy);
|
||||
return RValue::get(Builder.CreateCall(
|
||||
CGM.CreateRuntimeFunction(
|
||||
llvm::FunctionType::get(IntTy, Int8PtrTy, false),
|
||||
"__get_kernel_preferred_work_group_multiple_impl"),
|
||||
Arg));
|
||||
}
|
||||
case Builtin::BIprintf:
|
||||
if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice)
|
||||
return EmitCUDADevicePrintfCallExpr(E, ReturnValue);
|
||||
|
|
|
@ -16834,12 +16834,6 @@ ndrange_t __ovld ndrange_3D(const size_t[3]);
|
|||
ndrange_t __ovld ndrange_3D(const size_t[3], const size_t[3]);
|
||||
ndrange_t __ovld ndrange_3D(const size_t[3], const size_t[3], const size_t[3]);
|
||||
|
||||
// ToDo: Add these functions as Clang builtins since they eed a special check of parameters to block.
|
||||
uint __ovld get_kernel_work_group_size(void (^block)(void));
|
||||
uint __ovld get_kernel_work_group_size(void (^block)(local void *, ...));
|
||||
uint __ovld get_kernel_preferred_work_group_size_multiple(void (^block)(void));
|
||||
uint __ovld get_kernel_preferred_work_group_size_multiple(void (^block)(local void *, ...));
|
||||
|
||||
int __ovld enqueue_marker(queue_t, uint, const __private clk_event_t*, __private clk_event_t*);
|
||||
|
||||
void __ovld retain_event(clk_event_t);
|
||||
|
|
|
@ -261,6 +261,226 @@ static bool SemaBuiltinSEHScopeCheck(Sema &SemaRef, CallExpr *TheCall,
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline bool isBlockPointer(Expr *Arg) {
|
||||
return Arg->getType()->isBlockPointerType();
|
||||
}
|
||||
|
||||
/// OpenCL C v2.0, s6.13.17.2 - Checks that the block parameters are all local
|
||||
/// void*, which is a requirement of device side enqueue.
|
||||
static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
|
||||
const BlockPointerType *BPT =
|
||||
cast<BlockPointerType>(BlockArg->getType().getCanonicalType());
|
||||
ArrayRef<QualType> Params =
|
||||
BPT->getPointeeType()->getAs<FunctionProtoType>()->getParamTypes();
|
||||
unsigned ArgCounter = 0;
|
||||
bool IllegalParams = false;
|
||||
// Iterate through the block parameters until either one is found that is not
|
||||
// a local void*, or the block is valid.
|
||||
for (ArrayRef<QualType>::iterator I = Params.begin(), E = Params.end();
|
||||
I != E; ++I, ++ArgCounter) {
|
||||
if (!(*I)->isPointerType() || !(*I)->getPointeeType()->isVoidType() ||
|
||||
(*I)->getPointeeType().getQualifiers().getAddressSpace() !=
|
||||
LangAS::opencl_local) {
|
||||
// Get the location of the error. If a block literal has been passed
|
||||
// (BlockExpr) then we can point straight to the offending argument,
|
||||
// else we just point to the variable reference.
|
||||
SourceLocation ErrorLoc;
|
||||
if (isa<BlockExpr>(BlockArg)) {
|
||||
BlockDecl *BD = cast<BlockExpr>(BlockArg)->getBlockDecl();
|
||||
ErrorLoc = BD->getParamDecl(ArgCounter)->getLocStart();
|
||||
} else if (isa<DeclRefExpr>(BlockArg)) {
|
||||
ErrorLoc = cast<DeclRefExpr>(BlockArg)->getLocStart();
|
||||
}
|
||||
S.Diag(ErrorLoc,
|
||||
diag::err_opencl_enqueue_kernel_blocks_non_local_void_args);
|
||||
IllegalParams = true;
|
||||
}
|
||||
}
|
||||
|
||||
return IllegalParams;
|
||||
}
|
||||
|
||||
/// OpenCL C v2.0, s6.13.17.6 - Check the argument to the
|
||||
/// get_kernel_work_group_size
|
||||
/// and get_kernel_preferred_work_group_size_multiple builtin functions.
|
||||
static bool SemaOpenCLBuiltinKernelWorkGroupSize(Sema &S, CallExpr *TheCall) {
|
||||
if (checkArgCount(S, TheCall, 1))
|
||||
return true;
|
||||
|
||||
Expr *BlockArg = TheCall->getArg(0);
|
||||
if (!isBlockPointer(BlockArg)) {
|
||||
S.Diag(BlockArg->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_expected_type) << "block";
|
||||
return true;
|
||||
}
|
||||
return checkOpenCLBlockArgs(S, BlockArg);
|
||||
}
|
||||
|
||||
static bool checkOpenCLEnqueueLocalSizeArgs(Sema &S, CallExpr *TheCall,
|
||||
unsigned Start, unsigned End);
|
||||
|
||||
/// OpenCL v2.0, s6.13.17.1 - Check that sizes are provided for all
|
||||
/// 'local void*' parameter of passed block.
|
||||
static bool checkOpenCLEnqueueVariadicArgs(Sema &S, CallExpr *TheCall,
|
||||
Expr *BlockArg,
|
||||
unsigned NumNonVarArgs) {
|
||||
const BlockPointerType *BPT =
|
||||
cast<BlockPointerType>(BlockArg->getType().getCanonicalType());
|
||||
unsigned NumBlockParams =
|
||||
BPT->getPointeeType()->getAs<FunctionProtoType>()->getNumParams();
|
||||
unsigned TotalNumArgs = TheCall->getNumArgs();
|
||||
|
||||
// For each argument passed to the block, a corresponding uint needs to
|
||||
// be passed to describe the size of the local memory.
|
||||
if (TotalNumArgs != NumBlockParams + NumNonVarArgs) {
|
||||
S.Diag(TheCall->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_local_size_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check that the sizes of the local memory are specified by integers.
|
||||
return checkOpenCLEnqueueLocalSizeArgs(S, TheCall, NumNonVarArgs,
|
||||
TotalNumArgs - 1);
|
||||
}
|
||||
|
||||
/// OpenCL C v2.0, s6.13.17 - Enqueue kernel function contains four different
|
||||
/// overload formats specified in Table 6.13.17.1.
|
||||
/// int enqueue_kernel(queue_t queue,
|
||||
/// kernel_enqueue_flags_t flags,
|
||||
/// const ndrange_t ndrange,
|
||||
/// void (^block)(void))
|
||||
/// int enqueue_kernel(queue_t queue,
|
||||
/// kernel_enqueue_flags_t flags,
|
||||
/// const ndrange_t ndrange,
|
||||
/// uint num_events_in_wait_list,
|
||||
/// clk_event_t *event_wait_list,
|
||||
/// clk_event_t *event_ret,
|
||||
/// void (^block)(void))
|
||||
/// int enqueue_kernel(queue_t queue,
|
||||
/// kernel_enqueue_flags_t flags,
|
||||
/// const ndrange_t ndrange,
|
||||
/// void (^block)(local void*, ...),
|
||||
/// uint size0, ...)
|
||||
/// int enqueue_kernel(queue_t queue,
|
||||
/// kernel_enqueue_flags_t flags,
|
||||
/// const ndrange_t ndrange,
|
||||
/// uint num_events_in_wait_list,
|
||||
/// clk_event_t *event_wait_list,
|
||||
/// clk_event_t *event_ret,
|
||||
/// void (^block)(local void*, ...),
|
||||
/// uint size0, ...)
|
||||
static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
|
||||
unsigned NumArgs = TheCall->getNumArgs();
|
||||
|
||||
if (NumArgs < 4) {
|
||||
S.Diag(TheCall->getLocStart(), diag::err_typecheck_call_too_few_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
Expr *Arg0 = TheCall->getArg(0);
|
||||
Expr *Arg1 = TheCall->getArg(1);
|
||||
Expr *Arg2 = TheCall->getArg(2);
|
||||
Expr *Arg3 = TheCall->getArg(3);
|
||||
|
||||
// First argument always needs to be a queue_t type.
|
||||
if (!Arg0->getType()->isQueueT()) {
|
||||
S.Diag(TheCall->getArg(0)->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_expected_type)
|
||||
<< S.Context.OCLQueueTy;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Second argument always needs to be a kernel_enqueue_flags_t enum value.
|
||||
if (!Arg1->getType()->isIntegerType()) {
|
||||
S.Diag(TheCall->getArg(1)->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_expected_type)
|
||||
<< "'kernel_enqueue_flags_t' (i.e. uint)";
|
||||
return true;
|
||||
}
|
||||
|
||||
// Third argument is always an ndrange_t type.
|
||||
if (!Arg2->getType()->isNDRangeT()) {
|
||||
S.Diag(TheCall->getArg(2)->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_expected_type)
|
||||
<< S.Context.OCLNDRangeTy;
|
||||
return true;
|
||||
}
|
||||
|
||||
// With four arguments, there is only one form that the function could be
|
||||
// called in: no events and no variable arguments.
|
||||
if (NumArgs == 4) {
|
||||
// check that the last argument is the right block type.
|
||||
if (!isBlockPointer(Arg3)) {
|
||||
S.Diag(Arg3->getLocStart(), diag::err_opencl_enqueue_kernel_expected_type)
|
||||
<< "block";
|
||||
return true;
|
||||
}
|
||||
// we have a block type, check the prototype
|
||||
const BlockPointerType *BPT =
|
||||
cast<BlockPointerType>(Arg3->getType().getCanonicalType());
|
||||
if (BPT->getPointeeType()->getAs<FunctionProtoType>()->getNumParams() > 0) {
|
||||
S.Diag(Arg3->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_blocks_no_args);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// we can have block + varargs.
|
||||
if (isBlockPointer(Arg3))
|
||||
return (checkOpenCLBlockArgs(S, Arg3) ||
|
||||
checkOpenCLEnqueueVariadicArgs(S, TheCall, Arg3, 4));
|
||||
// last two cases with either exactly 7 args or 7 args and varargs.
|
||||
if (NumArgs >= 7) {
|
||||
// check common block argument.
|
||||
Expr *Arg6 = TheCall->getArg(6);
|
||||
if (!isBlockPointer(Arg6)) {
|
||||
S.Diag(Arg6->getLocStart(), diag::err_opencl_enqueue_kernel_expected_type)
|
||||
<< "block";
|
||||
return true;
|
||||
}
|
||||
if (checkOpenCLBlockArgs(S, Arg6))
|
||||
return true;
|
||||
|
||||
// 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;
|
||||
}
|
||||
// check remaining common arguments.
|
||||
Expr *Arg4 = TheCall->getArg(4);
|
||||
Expr *Arg5 = TheCall->getArg(5);
|
||||
|
||||
// Fith argument is always passed as pointers to clk_event_t.
|
||||
if (!Arg4->getType()->getPointeeOrArrayElementType()->isClkEventT()) {
|
||||
S.Diag(TheCall->getArg(4)->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_expected_type)
|
||||
<< S.Context.getPointerType(S.Context.OCLClkEventTy);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Sixth argument is always passed as pointers to clk_event_t.
|
||||
if (!(Arg5->getType()->isPointerType() &&
|
||||
Arg5->getType()->getPointeeType()->isClkEventT())) {
|
||||
S.Diag(TheCall->getArg(5)->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_expected_type)
|
||||
<< S.Context.getPointerType(S.Context.OCLClkEventTy);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NumArgs == 7)
|
||||
return false;
|
||||
|
||||
return checkOpenCLEnqueueVariadicArgs(S, TheCall, Arg6, 7);
|
||||
}
|
||||
|
||||
// None of the specific case has been detected, give generic error
|
||||
S.Diag(TheCall->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_incorrect_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Returns OpenCL access qual.
|
||||
static OpenCLAccessAttr *getOpenCLArgAccess(const Decl *D) {
|
||||
return D->getAttr<OpenCLAccessAttr>();
|
||||
|
@ -835,6 +1055,15 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
|
|||
if (SemaOpenCLBuiltinToAddr(*this, BuiltinID, TheCall))
|
||||
return ExprError();
|
||||
break;
|
||||
// OpenCL v2.0, s6.13.17 - Enqueue kernel functions.
|
||||
case Builtin::BIenqueue_kernel:
|
||||
if (SemaOpenCLBuiltinEnqueueKernel(*this, TheCall))
|
||||
return ExprError();
|
||||
break;
|
||||
case Builtin::BIget_kernel_work_group_size:
|
||||
case Builtin::BIget_kernel_preferred_work_group_size_multiple:
|
||||
if (SemaOpenCLBuiltinKernelWorkGroupSize(*this, TheCall))
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
// Since the target specific builtins for each arch overlap, only check those
|
||||
|
@ -8341,6 +8570,27 @@ void AnalyzeImplicitConversions(Sema &S, Expr *OrigE, SourceLocation CC) {
|
|||
|
||||
} // end anonymous namespace
|
||||
|
||||
static bool checkOpenCLEnqueueLocalSizeArgs(Sema &S, CallExpr *TheCall,
|
||||
unsigned Start, unsigned End) {
|
||||
bool IllegalParams = false;
|
||||
for (unsigned I = Start; I <= End; ++I) {
|
||||
QualType Ty = TheCall->getArg(I)->getType();
|
||||
// Taking into account implicit conversions,
|
||||
// allow any integer within 32 bits range
|
||||
if (!Ty->isIntegerType() ||
|
||||
S.Context.getTypeSizeInChars(Ty).getQuantity() > 4) {
|
||||
S.Diag(TheCall->getArg(I)->getLocStart(),
|
||||
diag::err_opencl_enqueue_kernel_invalid_local_size_type);
|
||||
IllegalParams = true;
|
||||
}
|
||||
// Potentially emit standard warnings for implicit conversions if enabled
|
||||
// using -Wconversion.
|
||||
CheckImplicitConversion(S, TheCall->getArg(I), S.Context.UnsignedIntTy,
|
||||
TheCall->getArg(I)->getLocStart());
|
||||
}
|
||||
return IllegalParams;
|
||||
}
|
||||
|
||||
// Helper function for Sema::DiagnoseAlwaysNonNullPointer.
|
||||
// Returns true when emitting a warning about taking the address of a reference.
|
||||
static bool CheckForReference(Sema &SemaRef, const Expr *E,
|
||||
|
@ -9281,15 +9531,6 @@ void Sema::CheckCastAlign(Expr *Op, QualType T, SourceRange TRange) {
|
|||
<< TRange << Op->getSourceRange();
|
||||
}
|
||||
|
||||
static const Type* getElementType(const Expr *BaseExpr) {
|
||||
const Type* EltType = BaseExpr->getType().getTypePtr();
|
||||
if (EltType->isAnyPointerType())
|
||||
return EltType->getPointeeType().getTypePtr();
|
||||
else if (EltType->isArrayType())
|
||||
return EltType->getBaseElementTypeUnsafe();
|
||||
return EltType;
|
||||
}
|
||||
|
||||
/// \brief Check whether this array fits the idiom of a size-one tail padded
|
||||
/// array member of a struct.
|
||||
///
|
||||
|
@ -9344,7 +9585,8 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
|
|||
if (IndexExpr->isValueDependent())
|
||||
return;
|
||||
|
||||
const Type *EffectiveType = getElementType(BaseExpr);
|
||||
const Type *EffectiveType =
|
||||
BaseExpr->getType()->getPointeeOrArrayElementType();
|
||||
BaseExpr = BaseExpr->IgnoreParenCasts();
|
||||
const ConstantArrayType *ArrayTy =
|
||||
Context.getAsConstantArrayType(BaseExpr->getType());
|
||||
|
@ -9368,7 +9610,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
|
|||
if (!size.isStrictlyPositive())
|
||||
return;
|
||||
|
||||
const Type* BaseType = getElementType(BaseExpr);
|
||||
const Type *BaseType = BaseExpr->getType()->getPointeeOrArrayElementType();
|
||||
if (BaseType != EffectiveType) {
|
||||
// Make sure we're comparing apples to apples when comparing index to size
|
||||
uint64_t ptrarith_typesize = Context.getTypeSize(EffectiveType);
|
||||
|
|
|
@ -1193,8 +1193,8 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
|
|||
// Fall through for subaggregate initialization.
|
||||
|
||||
} else {
|
||||
assert((ElemType->isRecordType() || ElemType->isVectorType()) &&
|
||||
"Unexpected type");
|
||||
assert((ElemType->isRecordType() || ElemType->isVectorType() ||
|
||||
ElemType->isClkEventT()) && "Unexpected type");
|
||||
|
||||
// C99 6.7.8p13:
|
||||
//
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - | FileCheck %s
|
||||
|
||||
typedef void (^bl_t)(local void *);
|
||||
|
||||
const bl_t block_G = (bl_t) ^ (local void *a) {};
|
||||
|
||||
kernel void device_side_enqueue(global int *a, global int *b, int i) {
|
||||
// CHECK: %default_queue = alloca %opencl.queue_t*
|
||||
queue_t default_queue;
|
||||
// CHECK: %flags = alloca i32
|
||||
unsigned flags = 0;
|
||||
// CHECK: %ndrange = alloca %opencl.ndrange_t*
|
||||
ndrange_t ndrange;
|
||||
// CHECK: %clk_event = alloca %opencl.clk_event_t*
|
||||
clk_event_t clk_event;
|
||||
// CHECK: %event_wait_list = alloca %opencl.clk_event_t*
|
||||
clk_event_t event_wait_list;
|
||||
// CHECK: %event_wait_list2 = alloca [1 x %opencl.clk_event_t*]
|
||||
clk_event_t event_wait_list2[] = {clk_event};
|
||||
|
||||
// CHECK: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t*, %opencl.queue_t** %default_queue
|
||||
// CHECK: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
|
||||
// CHECK: [[NDR:%[0-9]+]] = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange
|
||||
// CHECK: [[BL:%[0-9]+]] = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32{{.*}}, i32{{.*}}, i32{{.*}} }>* %block to void ()*
|
||||
// CHECK: [[BL_I8:%[0-9]+]] = bitcast void ()* [[BL]] to i8*
|
||||
// CHECK: call i32 @__enqueue_kernel_basic(%opencl.queue_t* [[DEF_Q]], i32 [[FLAGS]], %opencl.ndrange_t* [[NDR]], i8* [[BL_I8]])
|
||||
enqueue_kernel(default_queue, flags, ndrange,
|
||||
^(void) {
|
||||
a[i] = b[i];
|
||||
});
|
||||
|
||||
// CHECK: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t*, %opencl.queue_t** %default_queue
|
||||
// CHECK: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
|
||||
// CHECK: [[NDR:%[0-9]+]] = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange
|
||||
// CHECK: [[BL:%[0-9]+]] = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32{{.*}}, i32{{.*}}, i32{{.*}} }>* %block3 to void ()*
|
||||
// CHECK: [[BL_I8:%[0-9]+]] = bitcast void ()* [[BL]] to i8*
|
||||
// CHECK: call i32 @__enqueue_kernel_basic_events(%opencl.queue_t* [[DEF_Q]], i32 [[FLAGS]], %opencl.ndrange_t* [[NDR]], i32 2, %opencl.clk_event_t** %event_wait_list, %opencl.clk_event_t** %clk_event, i8* [[BL_I8]])
|
||||
enqueue_kernel(default_queue, flags, ndrange, 2, &event_wait_list, &clk_event,
|
||||
^(void) {
|
||||
a[i] = b[i];
|
||||
});
|
||||
|
||||
// CHECK: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t*, %opencl.queue_t** %default_queue
|
||||
// CHECK: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
|
||||
// CHECK: [[NDR:%[0-9]+]] = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange
|
||||
// CHECK: call i32 (%opencl.queue_t*, i32, %opencl.ndrange_t*, i8*, i32, ...) @__enqueue_kernel_vaargs(%opencl.queue_t* [[DEF_Q]], i32 [[FLAGS]], %opencl.ndrange_t* [[NDR]], i8* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global{{(.[0-9]+)?}} to i8*), i32 1, i32 256)
|
||||
enqueue_kernel(default_queue, flags, ndrange,
|
||||
^(local void *p) {
|
||||
return;
|
||||
},
|
||||
256);
|
||||
char c;
|
||||
// CHECK: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t*, %opencl.queue_t** %default_queue
|
||||
// CHECK: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
|
||||
// CHECK: [[NDR:%[0-9]+]] = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange
|
||||
// CHECK: [[SIZE:%[0-9]+]] = zext i8 {{%[0-9]+}} to i32
|
||||
// CHECK: call i32 (%opencl.queue_t*, i32, %opencl.ndrange_t*, i8*, i32, ...) @__enqueue_kernel_vaargs(%opencl.queue_t* [[DEF_Q]], i32 [[FLAGS]], %opencl.ndrange_t* [[NDR]], i8* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global{{(.[0-9]+)?}} to i8*), i32 1, i32 [[SIZE]])
|
||||
enqueue_kernel(default_queue, flags, ndrange,
|
||||
^(local void *p) {
|
||||
return;
|
||||
},
|
||||
c);
|
||||
|
||||
// CHECK: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t*, %opencl.queue_t** %default_queue
|
||||
// CHECK: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
|
||||
// CHECK: [[NDR:%[0-9]+]] = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange
|
||||
// CHECK: [[AD:%arraydecay[0-9]*]] = getelementptr inbounds [1 x %opencl.clk_event_t*], [1 x %opencl.clk_event_t*]* %event_wait_list2, i32 0, i32 0
|
||||
// CHECK: call i32 (%opencl.queue_t*, i32, %opencl.ndrange_t*, i32, %opencl.clk_event_t**, %opencl.clk_event_t**, i8*, i32, ...) @__enqueue_kernel_events_vaargs(%opencl.queue_t* [[DEF_Q]], i32 [[FLAGS]], %opencl.ndrange_t* [[NDR]], i32 2, %opencl.clk_event_t** [[AD]], %opencl.clk_event_t** %clk_event, i8* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global{{(.[0-9]+)?}} to i8*), i32 1, i32 256)
|
||||
enqueue_kernel(default_queue, flags, ndrange, 2, event_wait_list2, &clk_event,
|
||||
^(local void *p) {
|
||||
return;
|
||||
},
|
||||
256);
|
||||
|
||||
// CHECK: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t*, %opencl.queue_t** %default_queue
|
||||
// CHECK: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
|
||||
// CHECK: [[NDR:%[0-9]+]] = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange
|
||||
// CHECK: [[AD:%arraydecay[0-9]*]] = getelementptr inbounds [1 x %opencl.clk_event_t*], [1 x %opencl.clk_event_t*]* %event_wait_list2, i32 0, i32 0
|
||||
// CHECK: [[SIZE:%[0-9]+]] = zext i8 {{%[0-9]+}} to i32
|
||||
// CHECK: call i32 (%opencl.queue_t*, i32, %opencl.ndrange_t*, i32, %opencl.clk_event_t**, %opencl.clk_event_t**, i8*, i32, ...) @__enqueue_kernel_events_vaargs(%opencl.queue_t* [[DEF_Q]], i32 [[FLAGS]], %opencl.ndrange_t* [[NDR]], i32 2, %opencl.clk_event_t** [[AD]], %opencl.clk_event_t** %clk_event, i8* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global{{(.[0-9]+)?}} to i8*), i32 1, i32 [[SIZE]])
|
||||
enqueue_kernel(default_queue, flags, ndrange, 2, event_wait_list2, &clk_event,
|
||||
^(local void *p) {
|
||||
return;
|
||||
},
|
||||
c);
|
||||
|
||||
void (^const block_A)(void) = ^{
|
||||
return;
|
||||
};
|
||||
void (^const block_B)(local void *) = ^(local void *a) {
|
||||
return;
|
||||
};
|
||||
|
||||
// CHECK: [[BL:%[0-9]+]] = load void ()*, void ()** %block_A
|
||||
// CHECK: [[BL_I8:%[0-9]+]] = bitcast void ()* [[BL]] to i8*
|
||||
// CHECK: call i32 @__get_kernel_work_group_size_impl(i8* [[BL_I8]])
|
||||
unsigned size = get_kernel_work_group_size(block_A);
|
||||
// CHECK: [[BL:%[0-9]+]] = load void (i8 addrspace(2)*)*, void (i8 addrspace(2)*)** %block_B
|
||||
// CHECK: [[BL_I8:%[0-9]+]] = bitcast void (i8 addrspace(2)*)* [[BL]] to i8*
|
||||
// CHECK: call i32 @__get_kernel_work_group_size_impl(i8* [[BL_I8]])
|
||||
size = get_kernel_work_group_size(block_B);
|
||||
// CHECK: [[BL:%[0-9]+]] = load void ()*, void ()** %block_A
|
||||
// CHECK: [[BL_I8:%[0-9]+]] = bitcast void ()* [[BL]] to i8*
|
||||
// CHECK: call i32 @__get_kernel_preferred_work_group_multiple_impl(i8* [[BL_I8]])
|
||||
size = get_kernel_preferred_work_group_size_multiple(block_A);
|
||||
// CHECK: [[BL:%[0-9]+]] = load void (i8 addrspace(2)*)*, void (i8 addrspace(2)*)* addrspace(1)* @block_G
|
||||
// CHECK: [[BL_I8:%[0-9]+]] = bitcast void (i8 addrspace(2)*)* [[BL]] to i8*
|
||||
// CHECK: call i32 @__get_kernel_preferred_work_group_multiple_impl(i8* [[BL_I8]])
|
||||
size = get_kernel_preferred_work_group_size_multiple(block_G);
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
|
||||
// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only -Wconversion -DWCONV
|
||||
|
||||
// Diagnostic tests for different overloads of enqueue_kernel from Table 6.13.17.1 of OpenCL 2.0 Spec.
|
||||
kernel void enqueue_kernel_tests() {
|
||||
queue_t default_queue;
|
||||
unsigned flags = 0;
|
||||
ndrange_t ndrange;
|
||||
clk_event_t evt;
|
||||
clk_event_t event_wait_list;
|
||||
clk_event_t event_wait_list2[] = {evt, evt};
|
||||
void *vptr;
|
||||
|
||||
// Testing the first overload type
|
||||
enqueue_kernel(default_queue, flags, ndrange, ^(void) {
|
||||
return 0;
|
||||
});
|
||||
|
||||
enqueue_kernel(vptr, flags, ndrange, ^(void) { // expected-error{{illegal call to enqueue_kernel, expected 'queue_t' argument type}}
|
||||
return 0;
|
||||
});
|
||||
|
||||
enqueue_kernel(default_queue, vptr, ndrange, ^(void) { // expected-error{{illegal call to enqueue_kernel, expected 'kernel_enqueue_flags_t' (i.e. uint) argument type}}
|
||||
return 0;
|
||||
});
|
||||
|
||||
enqueue_kernel(default_queue, flags, vptr, ^(void) { // expected-error{{illegal call to enqueue_kernel, expected 'ndrange_t' argument type}}
|
||||
return 0;
|
||||
});
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, vptr); // expected-error{{illegal call to enqueue_kernel, expected block argument}}
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, ^(int i) { // expected-error{{blocks in this form of device side enqueue call are expected to have have no parameters}}
|
||||
return 0;
|
||||
});
|
||||
|
||||
// Testing the second overload type
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, &event_wait_list, &evt, ^(void) {
|
||||
return 0;
|
||||
});
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, vptr, &evt, ^(void) // expected-error{{illegal call to enqueue_kernel, expected 'clk_event_t *' argument type}}
|
||||
{
|
||||
return 0;
|
||||
});
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, &event_wait_list, vptr, ^(void) // expected-error{{illegal call to enqueue_kernel, expected 'clk_event_t *' argument type}}
|
||||
{
|
||||
return 0;
|
||||
});
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, &event_wait_list, &evt, vptr); // expected-error{{illegal call to enqueue_kernel, expected block argument}}
|
||||
|
||||
// Testing the third overload type
|
||||
enqueue_kernel(default_queue, flags, ndrange,
|
||||
^(local void *a, local void *b) {
|
||||
return 0;
|
||||
},
|
||||
1024, 1024);
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange,
|
||||
^(local void *a, local void *b) {
|
||||
return 0;
|
||||
},
|
||||
1024, 1024L); // expected-error{{local memory sizes need to be specified as uint}}
|
||||
|
||||
char c;
|
||||
enqueue_kernel(default_queue, flags, ndrange,
|
||||
^(local void *a, local void *b) {
|
||||
return 0;
|
||||
},
|
||||
c, 1024);
|
||||
#ifdef WCONV
|
||||
// expected-warning@-2{{implicit conversion changes signedness: 'char' to 'unsigned int'}}
|
||||
#endif
|
||||
|
||||
typedef void (^bl_A_t)(local void *);
|
||||
|
||||
const bl_A_t block_A = (bl_A_t) ^ (local void *a) {};
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, block_A, 1024);
|
||||
|
||||
typedef void (^bl_B_t)(local void *, local int *);
|
||||
|
||||
const bl_B_t block_B = (bl_B_t) ^ (local void *a, local int *b) {};
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, block_B, 1024, 1024); // expected-error{{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, // expected-error{{mismatch in number of block parameters and local size arguments passed}}
|
||||
^(local void *a, local void *b) {
|
||||
return 0;
|
||||
},
|
||||
1024);
|
||||
|
||||
float illegal_mem_size = (float)0.5f;
|
||||
enqueue_kernel(default_queue, flags, ndrange,
|
||||
^(local void *a, local void *b) {
|
||||
return 0;
|
||||
},
|
||||
illegal_mem_size, illegal_mem_size); // expected-error{{local memory sizes need to be specified as uint}} expected-error{{local memory sizes need to be specified as uint}}
|
||||
#ifdef WCONV
|
||||
// expected-warning@-2{{implicit conversion turns floating-point number into integer: 'float' to 'unsigned int'}} expected-warning@-2{{implicit conversion turns floating-point number into integer: 'float' to 'unsigned int'}}
|
||||
#endif
|
||||
|
||||
// Testing the forth overload type
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, event_wait_list2, &evt,
|
||||
^(local void *a, local void *b) {
|
||||
return 0;
|
||||
},
|
||||
1024, 1024);
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, &event_wait_list, &evt, // expected-error{{mismatch in number of block parameters and local size arguments passed}}
|
||||
^(local void *a, local void *b) {
|
||||
return 0;
|
||||
},
|
||||
1024, 1024, 1024);
|
||||
|
||||
// More random misc cases that can't be deduced
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, &event_wait_list, &evt); // expected-error{{illegal call to enqueue_kernel, incorrect argument types}}
|
||||
|
||||
enqueue_kernel(default_queue, flags, ndrange, 1, 1); // expected-error{{illegal call to enqueue_kernel, incorrect argument types}}
|
||||
}
|
||||
|
||||
// Diagnostic tests for get_kernel_work_group_size and allowed block parameter types in dynamic parallelism.
|
||||
kernel void work_group_size_tests() {
|
||||
void (^const block_A)(void) = ^{
|
||||
return;
|
||||
};
|
||||
void (^const block_B)(int) = ^(int a) {
|
||||
return;
|
||||
};
|
||||
void (^const block_C)(local void *) = ^(local void *a) {
|
||||
return;
|
||||
};
|
||||
void (^const block_D)(local int *) = ^(local int *a) {
|
||||
return;
|
||||
};
|
||||
|
||||
unsigned size = get_kernel_work_group_size(block_A);
|
||||
size = get_kernel_work_group_size(block_C);
|
||||
size = get_kernel_work_group_size(^(local void *a) {
|
||||
return;
|
||||
});
|
||||
size = get_kernel_work_group_size(^(local int *a) { // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
return;
|
||||
});
|
||||
size = get_kernel_work_group_size(block_B); // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
size = get_kernel_work_group_size(block_D); // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
size = get_kernel_work_group_size(^(int a) { // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
return;
|
||||
});
|
||||
size = get_kernel_work_group_size(); // expected-error {{too few arguments to function call, expected 1, have 0}}
|
||||
size = get_kernel_work_group_size(1); // expected-error{{expected block argument}}
|
||||
size = get_kernel_work_group_size(block_A, 1); // expected-error{{too many arguments to function call, expected 1, have 2}}
|
||||
|
||||
size = get_kernel_preferred_work_group_size_multiple(block_A);
|
||||
size = get_kernel_preferred_work_group_size_multiple(block_C);
|
||||
size = get_kernel_preferred_work_group_size_multiple(^(local void *a) {
|
||||
return;
|
||||
});
|
||||
size = get_kernel_preferred_work_group_size_multiple(^(local int *a) { // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
return;
|
||||
});
|
||||
size = get_kernel_preferred_work_group_size_multiple(^(int a) { // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
return;
|
||||
});
|
||||
size = get_kernel_preferred_work_group_size_multiple(block_B); // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
size = get_kernel_preferred_work_group_size_multiple(block_D); // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}}
|
||||
size = get_kernel_preferred_work_group_size_multiple(); // expected-error {{too few arguments to function call, expected 1, have 0}}
|
||||
size = get_kernel_preferred_work_group_size_multiple(1); // expected-error{{expected block argument}}
|
||||
size = get_kernel_preferred_work_group_size_multiple(block_A, 1); // expected-error{{too many arguments to function call, expected 1, have 2}}
|
||||
}
|
Loading…
Reference in New Issue