-
Notifications
You must be signed in to change notification settings - Fork 13.6k
AMDGPU: Start using LLVMContext errors in buffer fat pointer lowering #142014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arsenm
merged 1 commit into
main
from
users/arsenm/amdgpu/start-using-context-errors-buffer-fat-pointer-lowering
May 30, 2025
Merged
AMDGPU: Start using LLVMContext errors in buffer fat pointer lowering #142014
arsenm
merged 1 commit into
main
from
users/arsenm/amdgpu/start-using-context-errors-buffer-fat-pointer-lowering
May 30, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-backend-amdgpu Author: Matt Arsenault (arsenm) ChangesAvoid using report_fatal_error. Many more uses that should be converted Full diff: https://github.com/llvm/llvm-project/pull/142014.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
index 3835f4cfceefc..0f002b016af0c 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
@@ -2430,17 +2430,26 @@ bool AMDGPULowerBufferFatPointers::run(Module &M, const TargetMachine &TM) {
// its arguments or return types adjusted.
SmallVector<std::pair<Function *, bool>> NeedsRemap;
+ LLVMContext &Ctx = M.getContext();
+
BufferFatPtrToStructTypeMap StructTM(DL);
BufferFatPtrToIntTypeMap IntTM(DL);
for (const GlobalVariable &GV : M.globals()) {
- if (GV.getAddressSpace() == AMDGPUAS::BUFFER_FAT_POINTER)
- report_fatal_error("Global variables with a buffer fat pointer address "
- "space (7) are not supported");
+ if (GV.getAddressSpace() == AMDGPUAS::BUFFER_FAT_POINTER) {
+ // FIXME: Use DiagnosticInfo unsupported but it requires a Function
+ Ctx.emitError("global variables with a buffer fat pointer address "
+ "space (7) are not supported");
+ continue;
+ }
+
Type *VT = GV.getValueType();
- if (VT != StructTM.remapType(VT))
- report_fatal_error("Global variables that contain buffer fat pointers "
- "(address space 7 pointers) are unsupported. Use "
- "buffer resource pointers (address space 8) instead.");
+ if (VT != StructTM.remapType(VT)) {
+ // FIXME: Use DiagnosticInfo unsupported but it requires a Function
+ Ctx.emitError("global variables that contain buffer fat pointers "
+ "(address space 7 pointers) are unsupported. Use "
+ "buffer resource pointers (address space 8) instead");
+ continue;
+ }
}
{
diff --git a/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-unsupported-errors.ll b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-unsupported-errors.ll
new file mode 100644
index 0000000000000..3fc8d73bb0536
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-unsupported-errors.ll
@@ -0,0 +1,22 @@
+; RUN: split-file %s %t
+; RUN: not opt -mtriple=amdgcn-amd-amdhsa -disable-output -passes=amdgpu-lower-buffer-fat-pointers %t/contains-null-init.ll 2>&1 | FileCheck -check-prefix=ERR0 %s
+; RUN: not opt -mtriple=amdgcn-amd-amdhsa -disable-output -passes=amdgpu-lower-buffer-fat-pointers %t/contains-poison-init.ll 2>&1 | FileCheck -check-prefix=ERR1 %s
+; RUN: not opt -mtriple=amdgcn-amd-amdhsa -disable-output -passes=amdgpu-lower-buffer-fat-pointers %t/defined-gv-type.ll 2>&1 | FileCheck -check-prefix=ERR2 %s
+; RUN: not opt -mtriple=amdgcn-amd-amdhsa -disable-output -passes=amdgpu-lower-buffer-fat-pointers %t/declared-gv-type.ll 2>&1 | FileCheck -check-prefix=ERR3 %s
+
+;--- contains-null-init.ll
+; ERR0: error: global variables that contain buffer fat pointers (address space 7 pointers) are unsupported. Use buffer resource pointers (address space 8) instead
+@init_null = global ptr addrspace(7) null
+
+;--- contains-poison-init.ll
+; ERR1: error: global variables that contain buffer fat pointers (address space 7 pointers) are unsupported. Use buffer resource pointers (address space 8) instead
+@init_poison = global ptr addrspace(7) poison
+
+;--- defined-gv-type.ll
+; ERR2: error: global variables with a buffer fat pointer address space (7) are not supported
+@gv_is_addrspace_7 = addrspace(7) global i32 0
+
+;--- declared-gv-type.ll
+; ERR3: error: global variables with a buffer fat pointer address space (7) are not supported
+@extern_gv_is_addrspace_7 = external addrspace(7) global i32
+
|
krzysz00
approved these changes
May 29, 2025
Avoid using report_fatal_error. Many more uses that should be converted in the pass remain.
30a7806
to
77d99f4
Compare
sivan-shani
pushed a commit
to sivan-shani/llvm-project
that referenced
this pull request
Jun 3, 2025
…llvm#142014) Avoid using report_fatal_error. Many more uses that should be converted in the pass remain.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Avoid using report_fatal_error. Many more uses that should be converted
in the pass remain.