Skip to content

Commit 691b65f

Browse files
authored
[LLVMGPUVectorDistribute] Add a flag to enable shared memory reuse (iree-org#19266)
This commit adds a flag to enable shared memory reuse in LLVMGPUVectorDistribute. Signed-off-by: Manupa Karunaratne <[email protected]>
1 parent 265570a commit 691b65f

File tree

1 file changed

+10
-1
lines changed
  • compiler/src/iree/compiler/Codegen/LLVMGPU

1 file changed

+10
-1
lines changed

compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ static llvm::cl::opt<int64_t> clLLVMGPUSharedMemoryLimit(
6767
"allocated for the given target"),
6868
llvm::cl::init(163 * 1024));
6969

70+
static llvm::cl::opt<bool> clLLVMGPUEnableSharedMemoryReuse(
71+
"iree-llvmgpu-enable-shared-memory-reuse",
72+
llvm::cl::desc(
73+
"Enable shared memory reuse in the vector distribute pipeline"),
74+
llvm::cl::init(false));
75+
7076
//===----------------------------------------------------------------------===//
7177
// Bufferization Configuration
7278
//===----------------------------------------------------------------------===//
@@ -914,10 +920,13 @@ void addGPUVectorDistributePassPipeline(OpPassManager &funcPassManager,
914920
options.paddingBits = 64;
915921
funcPassManager.addPass(createGPUReduceBankConflictsPass(options));
916922
}
917-
918923
if (options.prefetchSharedMemory) {
919924
funcPassManager.addPass(createLLVMGPUPrefetchSharedMemoryPass());
920925
}
926+
if (clLLVMGPUEnableSharedMemoryReuse) {
927+
funcPassManager.addPass(createHoistStaticallyBoundAllocationsPass());
928+
funcPassManager.addPass(createGPUReuseSharedMemoryAllocsPass());
929+
}
921930
funcPassManager.addPass(memref::createFoldMemRefAliasOpsPass());
922931
funcPassManager.addPass(createCSEPass());
923932
funcPassManager.addPass(createCanonicalizerPass());

0 commit comments

Comments
 (0)