Skip to content

Conversation

@PMylon
Copy link
Contributor

@PMylon PMylon commented Nov 27, 2025

Emit amdgpu.max_num_named_barrier resource symbol which is referenced by amdgcn.device.init.num_named_barrier, max(0, amdgpu.max_num_named_barrier). Fixes LLVM ERROR: cannot evaluate equated symbol 'amdgcn.device.init.num_named_barrier' when using ASan.

@PMylon
Copy link
Contributor Author

PMylon commented Nov 27, 2025

@llvmbot
Copy link
Member

llvmbot commented Nov 27, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: None (PMylon)

Changes

Emit amdgpu.max_num_named_barrier resource symbol which is referenced by amdgcn.device.init.num_named_barrier, max(0, amdgpu.max_num_named_barrier). Fixes LLVM ERROR: cannot evaluate equated symbol 'amdgcn.device.init.num_named_barrier' when using ASan.


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

3 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (+2-1)
  • (modified) llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp (+3-1)
  • (modified) llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h (+4-2)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 33cef795b111d..270154452f6df 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -536,7 +536,8 @@ bool AMDGPUAsmPrinter::doFinalization(Module &M) {
   OutStreamer->switchSection(MaxGPRSection);
   getTargetStreamer()->EmitMCResourceMaximums(RI.getMaxVGPRSymbol(OutContext),
                                               RI.getMaxAGPRSymbol(OutContext),
-                                              RI.getMaxSGPRSymbol(OutContext));
+                                              RI.getMaxSGPRSymbol(OutContext),
+                                              RI.getMaxNamedBarrierSymbol(OutContext));
   OutStreamer->popSection();
 
   for (Function &F : M.functions())
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
index 5a0857322a39b..b12b6ed441659 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -304,7 +304,8 @@ void AMDGPUTargetAsmStreamer::EmitMCResourceInfo(
 
 void AMDGPUTargetAsmStreamer::EmitMCResourceMaximums(const MCSymbol *MaxVGPR,
                                                      const MCSymbol *MaxAGPR,
-                                                     const MCSymbol *MaxSGPR) {
+                                                     const MCSymbol *MaxSGPR,
+                                                     const MCSymbol *MaxNamedBarrier) {
 #define PRINT_RES_INFO(ARG)                                                    \
   OS << "\t.set ";                                                             \
   ARG->print(OS, getContext().getAsmInfo());                                   \
@@ -315,6 +316,7 @@ void AMDGPUTargetAsmStreamer::EmitMCResourceMaximums(const MCSymbol *MaxVGPR,
   PRINT_RES_INFO(MaxVGPR);
   PRINT_RES_INFO(MaxAGPR);
   PRINT_RES_INFO(MaxSGPR);
+  PRINT_RES_INFO(MaxNamedBarrier);
 #undef PRINT_RES_INFO
 }
 
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
index 22afcdebcdf09..3a0d8dcd2d27c 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
@@ -69,7 +69,8 @@ class AMDGPUTargetStreamer : public MCTargetStreamer {
 
   virtual void EmitMCResourceMaximums(const MCSymbol *MaxVGPR,
                                       const MCSymbol *MaxAGPR,
-                                      const MCSymbol *MaxSGPR) {};
+                                      const MCSymbol *MaxSGPR,
+                                      const MCSymbol *MaxNamedBarrier) {};
 
   /// \returns True on success, false on failure.
   virtual bool EmitISAVersion() { return true; }
@@ -149,7 +150,8 @@ class AMDGPUTargetAsmStreamer final : public AMDGPUTargetStreamer {
       const MCSymbol *HasRecursion, const MCSymbol *HasIndirectCall) override;
 
   void EmitMCResourceMaximums(const MCSymbol *MaxVGPR, const MCSymbol *MaxAGPR,
-                              const MCSymbol *MaxSGPR) override;
+                              const MCSymbol *MaxSGPR,
+                              const MCSymbol *MaxNamedBarrier) override;
 
   /// \returns True on success, false on failure.
   bool EmitISAVersion() override;

@github-actions
Copy link

github-actions bot commented Nov 27, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tests

@PMylon PMylon requested a review from arsenm December 1, 2025 08:47
@PMylon
Copy link
Contributor Author

PMylon commented Dec 2, 2025

Hi @nhaehnle and @arsenm! Let me know if it looks good, or if I should rework anything else.

Copy link
Collaborator

@nhaehnle nhaehnle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@antiagainst antiagainst merged commit a992f29 into llvm:main Dec 4, 2025
10 checks passed
antiagainst added a commit to triton-lang/triton that referenced this pull request Dec 4, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 4, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-mlir-rhel-clang running on ppc64le-mlir-rhel-test while building llvm at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/129/builds/34393

Here is the relevant piece of the build log for the reference
Step 6 (test-build-check-mlir-build-only-check-mlir) failure: 1200 seconds without output running [b'ninja', b'check-mlir'], attempting to kill
10.730 [0/1/0] Running the MLIR regression tests
command timed out: 1200 seconds without output running [b'ninja', b'check-mlir'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=1211.574020

antiagainst added a commit to antiagainst/triton that referenced this pull request Dec 6, 2025
This pulls in the following fixes:

* llvm/llvm-project#168801
* llvm/llvm-project#168805
* llvm/llvm-project#169851

Along the way, we need to adjust `TMEMLoadOpPattern`
and `RelayoutTritonGPU` due to

* llvm/llvm-project#169606
antiagainst added a commit to triton-lang/triton that referenced this pull request Dec 8, 2025
This pulls in the following fixes:

* llvm/llvm-project#168801
* llvm/llvm-project#168805
* llvm/llvm-project#169851

Along the way, we need to adjust `TMEMLoadOpPattern`
and `RelayoutTritonGPU` due to

* llvm/llvm-project#169606
honeygoyal pushed a commit to honeygoyal/llvm-project that referenced this pull request Dec 9, 2025
ThomasRaoux pushed a commit to triton-lang/triton that referenced this pull request Dec 12, 2025
This pulls in the following fixes:

* llvm/llvm-project#168801
* llvm/llvm-project#168805
* llvm/llvm-project#169851

Along the way, we need to adjust `TMEMLoadOpPattern` and
`RelayoutTritonGPU` due to

* llvm/llvm-project#169606
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.

6 participants