Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class AMDGPULowerModuleLDS {

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

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

std::string VarName =
Expand Down Expand Up @@ -877,7 +878,7 @@ class AMDGPULowerModuleLDS {
if (KernelsThatIndirectlyAllocateDynamicLDS.contains(func)) {
assert(isKernelLDS(func));
if (!func->hasName()) {
report_fatal_error("Anonymous kernels cannot use LDS variables");
reportFatalUsageError("anonymous kernels cannot use LDS variables");
}

GlobalVariable *N =
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/CodeGen/AMDGPU/lds-reject-anonymous-kernels.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
; RUN: not --crash opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s
; RUN: not --crash opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s
; RUN: not opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s
; RUN: not opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s 2>&1 | FileCheck %s

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

; CHECK: LLVM ERROR: Anonymous kernels cannot use LDS variables
; CHECK: LLVM ERROR: anonymous kernels cannot use LDS variables
define amdgpu_kernel void @0() {
%val0 = load i32, ptr addrspace(3) @var1
%val1 = add i32 %val0, 4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; 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
; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=table | FileCheck -check-prefixes=CHECK,TABLE %s
; 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
; 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
; 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

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