Skip to content

Commit 80bf77d

Browse files
committed
[AMDGPU] Add amdgpu-sw-lower-lds pass to NPM codegen addIRPasses.
1 parent cda81b1 commit 80bf77d

24 files changed

+26
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,9 @@ void AMDGPUCodeGenPassBuilder::addIRPasses(AddIRPass &addPass) const {
19501950

19511951
addPass(AMDGPUOpenCLEnqueuedBlockLoweringPass());
19521952

1953+
if (EnableSwLowerLDS)
1954+
addPass(AMDGPUSwLowerLDSPass(TM));
1955+
19531956
// Runs before PromoteAlloca so the latter can account for function uses
19541957
if (EnableLowerModuleLDS)
19551958
addPass(AMDGPULowerModuleLDSPass(TM));

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-dynamic-indirect-access-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check indirect dynamic LDS access through a non-kernel from kernel is lowered correctly.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 1

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-dynamic-indirect-access.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check indirect dynamic LDS access through a non-kernel from kernel is lowered correctly.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 1

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-dynamic-lds-test-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if direct access of dynamic LDS in kernel is lowered correctly.
56
@lds_1 = external addrspace(3) global [0 x i8]

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-dynamic-lds-test.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if direct access of dynamic LDS in kernel is lowered correctly.
56
@lds_1 = external addrspace(3) global [0 x i8]

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multi-static-dynamic-indirect-access-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check when multiple kernels access the same non-kernel, LDS accesses are lowere correctly.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 1

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multi-static-dynamic-indirect-access.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check when multiple kernels access the same non-kernel, LDS accesses are lowere correctly.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 1

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multiple-blocks-return-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check malloc and free blocks are placed correctly when multiple
56
; blocks and branching is present in the function with LDS accesses lowered correctly.

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multiple-blocks-return.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check malloc and free blocks are placed correctly when multiple
56
; blocks and branching is present in the function with LDS accesses lowered correctly.

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-non-kernel-declaration.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
22
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-sw-lower-lds < %s | FileCheck %s
3+
34
@lds = external addrspace(3) global [5 x i8], align 8
45
declare void @non_kernel_declaration() sanitize_address
56

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-indirect-access-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static and dynamic LDS accesses are lowered correctly when a non-kernel
56
; is called from kernel.

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-indirect-access.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static and dynamic LDS accesses are lowered correctly when a non-kernel
56
; is called from kernel.

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-lds-test-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static and dynamic LDS accesses are lowered correctly in kernel.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 4

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-lds-test.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static and dynamic LDS accesses are lowered correctly in kernel.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 4

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static LDS is lowered correctly when a non-kernel with LDS accesses is called from kernel.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 1

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-function-param-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if LDS accesses are lowered correctly when LDS is passed as function
56
; argument to non-kernel.

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-function-param.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if LDS accesses are lowered correctly when LDS is passed as function
56
; argument to non-kernel.

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-nested-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if LDS accesses are lowered correctly when a call is made to nested non-kernel.
56

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-nested.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if LDS accesses are lowered correctly when a call is made to nested non-kernel.
56

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static LDS is lowered correctly when a non-kernel with LDS accesses is called from kernel.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 1

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static LDS accesses in kernel are lowered correctly.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 4

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-atomic-cmpxchg-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
@lds_1 = internal addrspace(3) global [1 x i32] poison, align 4
56

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-atomicrmw-asan.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
@lds_1 = internal addrspace(3) global [1 x i32] poison, align 4
56
@lds_2 = internal addrspace(3) global [1 x i32] poison, align 4

llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
22
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
34

45
; Test to check if static LDS accesses in kernel are lowered correctly.
56
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 4

0 commit comments

Comments
 (0)