@@ -52,21 +52,15 @@ ModulePass *llvm::createSYCLLowerWGLocalMemoryLegacyPass() {
52
52
return new SYCLLowerWGLocalMemoryLegacy ();
53
53
}
54
54
55
+ // Static local memory allocation should be allowed only in a scope of a kernel
56
+ // (not a device function) and shouldn't be called inside loop or if statement
57
+ // to make it consistent with OpenCL restriction.
58
+ // TODO: Relax that restriction for SYCL or modify this pass to move allocation
59
+ // of memory up to a kernel scope at the beginning for each nested device
60
+ // function call, loop or if statement.
55
61
static void lowerAllocaLocalMemCall (CallInst *CI, Module &M) {
56
62
assert (CI);
57
63
58
- // Static local memory allocation should be allowed only in a scope of a spir
59
- // kernel (not a spir function) to make it consistent with OpenCL restriction.
60
- // However, __sycl_allocateLocalMemory is invoked in a scope of kernel lambda
61
- // call operator, which is technically not a SPIR-V kernel scope.
62
- // TODO: Relax that restriction for SYCL or modify this pass to move
63
- // allocation of memory up to a spir kernel scope for each nested device
64
- // function call.
65
- CallingConv::ID CC = CI->getCaller ()->getCallingConv ();
66
- assert ((CC == llvm::CallingConv::SPIR_FUNC ||
67
- CC == llvm::CallingConv::SPIR_KERNEL) &&
68
- " WG static local memory can be allocated only in kernel scope" );
69
-
70
64
Value *ArgSize = CI->getArgOperand (0 );
71
65
uint64_t Size = cast<llvm::ConstantInt>(ArgSize)->getZExtValue ();
72
66
Value *ArgAlign = CI->getArgOperand (1 );
0 commit comments