From fcbe5e64235d1122132b49d770ad42963ce13dbc Mon Sep 17 00:00:00 2001 From: Mikhail Lychkov Date: Mon, 29 Mar 2021 10:34:07 +0300 Subject: [PATCH] [NFC][SYCL] Add todo comment for validation of group-local variables definintion Signed-off-by: Mikhail Lychkov --- llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp b/llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp index a87c82388947b..9d29084c95cf4 100644 --- a/llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp +++ b/llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp @@ -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);