Skip to content

AMDGPU: Use reportFatalUsageError for unsupported code object version #145133

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

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 21, 2025

No description provided.

Copy link
Contributor Author

arsenm commented Jun 21, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm marked this pull request as ready for review June 21, 2025 02:05
@llvmbot
Copy link
Member

llvmbot commented Jun 21, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/145133.diff

2 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (+1-1)
  • (added) llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll (+12)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 84b0f98554097..9513b7b2aef26 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -350,7 +350,7 @@ bool AMDGPUAsmPrinter::doInitialization(Module &M) {
       HSAMetadataStream = std::make_unique<HSAMD::MetadataStreamerMsgPackV6>();
       break;
     default:
-      report_fatal_error("Unexpected code object version");
+      reportFatalUsageError("unsupported code object version");
     }
   }
 
diff --git a/llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll b/llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll
new file mode 100644
index 0000000000000..7eab565a431ad
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/unsupported-hsa-code-object-version.ll
@@ -0,0 +1,12 @@
+; RUN: not llc -filetype=asm -mtriple=amdgcn-amd-amdhsa -mcpu=gfx801 -o /dev/null %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=obj -mtriple=amdgcn-amd-amdhsa -mcpu=gfx801 -o /dev/null %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=null -mtriple=amdgcn-amd-amdhsa -mcpu=gfx801 -o /dev/null %s 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: unsupported code object version
+define amdgpu_kernel void @kernel() {
+  ret void
+}
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"amdhsa_code_object_version", i32 0}

@arsenm arsenm force-pushed the users/arsenm/amdgpu/use-reportFatalUsageError-code-object-version branch from 31085d4 to a723771 Compare June 21, 2025 02:14
@arsenm arsenm merged commit 7031280 into main Jun 21, 2025
7 checks passed
@arsenm arsenm deleted the users/arsenm/amdgpu/use-reportFatalUsageError-code-object-version branch June 21, 2025 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants