Skip to content

Commit f466131

Browse files
authored
AMDGPU: Use reportFatalUsageError in AMDGPULowerModuleLDS (#145130)
1 parent 17e8465 commit f466131

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ class AMDGPULowerModuleLDS {
572572

573573
if (OrderedKernels.size() > UINT32_MAX) {
574574
// 32 bit keeps it in one SGPR. > 2**32 kernels won't fit on the GPU
575-
report_fatal_error("Unimplemented LDS lowering for > 2**32 kernels");
575+
reportFatalUsageError("unimplemented LDS lowering for > 2**32 kernels");
576576
}
577577

578578
for (size_t i = 0; i < OrderedKernels.size(); i++) {
@@ -632,7 +632,8 @@ class AMDGPULowerModuleLDS {
632632
if (K.second.size() == 1) {
633633
KernelAccessVariables.insert(GV);
634634
} else {
635-
report_fatal_error(
635+
// FIXME: This should use DiagnosticInfo
636+
reportFatalUsageError(
636637
"cannot lower LDS '" + GV->getName() +
637638
"' to kernel access as it is reachable from multiple kernels");
638639
}
@@ -781,7 +782,7 @@ class AMDGPULowerModuleLDS {
781782
// backend) difficult to use. This does mean that llvm test cases need
782783
// to name the kernels.
783784
if (!Func.hasName()) {
784-
report_fatal_error("Anonymous kernels cannot use LDS variables");
785+
reportFatalUsageError("anonymous kernels cannot use LDS variables");
785786
}
786787

787788
std::string VarName =
@@ -877,7 +878,7 @@ class AMDGPULowerModuleLDS {
877878
if (KernelsThatIndirectlyAllocateDynamicLDS.contains(func)) {
878879
assert(isKernelLDS(func));
879880
if (!func->hasName()) {
880-
report_fatal_error("Anonymous kernels cannot use LDS variables");
881+
reportFatalUsageError("anonymous kernels cannot use LDS variables");
881882
}
882883

883884
GlobalVariable *N =

llvm/test/CodeGen/AMDGPU/lds-reject-anonymous-kernels.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
; RUN: not --crash opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s
2-
; RUN: not --crash opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s
2+
; RUN: not opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s
33

44
@var1 = addrspace(3) global i32 poison, align 8
55

6-
; CHECK: LLVM ERROR: Anonymous kernels cannot use LDS variables
6+
; CHECK: LLVM ERROR: anonymous kernels cannot use LDS variables
77
define amdgpu_kernel void @0() {
88
%val0 = load i32, ptr addrspace(3) @var1
99
%val1 = add i32 %val0, 4

llvm/test/CodeGen/AMDGPU/lower-module-lds-single-var-ambiguous.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=module | FileCheck -check-prefixes=CHECK,M_OR_HY %s
33
; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=table | FileCheck -check-prefixes=CHECK,TABLE %s
4-
; RUN: not --crash opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=kernel 2>&1 | FileCheck -check-prefixes=KERNEL %s
4+
; RUN: not opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=kernel 2>&1 | FileCheck -check-prefixes=KERNEL %s
55
; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=hybrid | FileCheck -check-prefixes=CHECK,M_OR_HY %s
66

77
;; Two kernels access the same variable, specialisation gives them each their own copy of it

0 commit comments

Comments
 (0)