Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ ModulePass *llvm::createSYCLLowerWGLocalMemoryLegacyPass() {
return new SYCLLowerWGLocalMemoryLegacy();
}

// Static local memory allocation should be allowed only in a scope of a kernel
// (not a device function) and shouldn't be called inside loop or if statement
// TODO: It should be checked that __sycl_allocateLocalMemory (or its source
// form - group_local_memory) does not occur:
// - in a function (other than user lambda/functor)
// - in a loop
// - in a non-convergent control flow
// to make it consistent with OpenCL restriction.
// TODO: Relax that restriction for SYCL or modify this pass to move allocation
// of memory up to a kernel scope at the beginning for each nested device
// function call, loop or if statement.
// But LLVM pass is not the best place to diagnose these cases.
// Error checking should be done in the front-end compiler.
static void lowerAllocaLocalMemCall(CallInst *CI, Module &M) {
assert(CI);

Expand Down