# AMDGPU

**URL:** https://discourse.llvm.org/c/code-generation/amdgpu/38.md

[Latest](https://discourse.llvm.org/latest.md) · [Categories](https://discourse.llvm.org/categories.md) · [Tags](https://discourse.llvm.org/tags.md)

---

## [About the AMDGPU category](https://discourse.llvm.org/t/about-the-amdgpu-category/1622)

<div class="topic-metadata">

**Author:** [@meikeb](https://discourse.llvm.org/u/meikeb)\
**Replies:** 4\
**Last updated:** [January 10, 2022, 9:57am UTC](https://discourse.llvm.org/t/about-the-amdgpu-category/1622 "2022-01-10T09:57:27Z")

</div>

This category is for discussions specific to both the development of the AMDGPU target in upstream LLVM and its use inside the LLVM project and by outside compiler frontends (e.g. LLPC, Mesa). It is not a forum for en…

---

## [\[RFC\]\[AMDGPU\] Deprecating and removing LLVM’s R600/TeraScale backend](https://discourse.llvm.org/t/rfc-amdgpu-deprecating-and-removing-llvm-s-r600-terascale-backend/92840)

<div class="topic-metadata">

**Author:** [@YuxinHao](https://discourse.llvm.org/u/YuxinHao)\
**Replies:** 7\
**Last updated:** [November 24, 2026, 6:28pm UTC](https://discourse.llvm.org/t/rfc-amdgpu-deprecating-and-removing-llvm-s-r600-terascale-backend/92840 "2026-11-24T18:28:57Z")

</div>

I would like to propose removing LLVM’s R600/TeraScale support from the AMDGPU target. This proposal only affects the R600 and TeraScale code paths. Support for GCN, RDNA, CDNA and current AMDGPU targets will not be aff…

---

## [\[RFC\]\[AMDGPU\] Performance-driven expansion of f32 atomic RMW on gfx12](https://discourse.llvm.org/t/rfc-amdgpu-performance-driven-expansion-of-f32-atomic-rmw-on-gfx12/92833)

<div class="topic-metadata">

**Author:** [@dhuang3-amd](https://discourse.llvm.org/u/dhuang3-amd)\
**Replies:** 2\
**Last updated:** [November 16, 2026, 10:25am UTC](https://discourse.llvm.org/t/rfc-amdgpu-performance-driven-expansion-of-f32-atomic-rmw-on-gfx12/92833 "2026-11-16T10:25:25Z")

</div>

Summary I’d like to propose a discussion about performance-driven expansion of floating-point atomicrmw fadd operations on gfx12 (gfx1200/gfx1201). Measurements show that native global\_atomic\_add\_f32 has substantially l…

---

## [RFC: Add MIR-level inlining to the AMDGPU backend](https://discourse.llvm.org/t/rfc-add-mir-level-inlining-to-the-amdgpu-backend/90155)

<div class="topic-metadata">

**Author:** [@rovka](https://discourse.llvm.org/u/rovka)\
**Replies:** 6\
**Last updated:** [March 27, 2026, 2:28pm UTC](https://discourse.llvm.org/t/rfc-add-mir-level-inlining-to-the-amdgpu-backend/90155 "2026-03-27T14:28:56Z")

</div>

Hello everyone, I’ve recently been working on a machine-level inliner for AMDGPU and it’s been suggested that I start an RFC to discuss alternative solutions. We have an increasing number of use-cases in the AMDGPU bac…

---

## [How to Generate AMDGPU Code from MLIR? Is There a Pipeline Similar to -gpu-lower-to-nvvm-pipeline?](https://discourse.llvm.org/t/how-to-generate-amdgpu-code-from-mlir-is-there-a-pipeline-similar-to-gpu-lower-to-nvvm-pipeline/88627)

<div class="topic-metadata">

**Author:** [@lilil](https://discourse.llvm.org/u/lilil)\
**Replies:** 3\
**Last updated:** [October 19, 2025, 8:33pm UTC](https://discourse.llvm.org/t/how-to-generate-amdgpu-code-from-mlir-is-there-a-pipeline-similar-to-gpu-lower-to-nvvm-pipeline/88627 "2025-10-19T20:33:32Z")

</div>

I’m currently exploring how to generate AMDGPU code from MLIR. For NVIDIA GPUs, I’ve already managed to generate code successfully by following this general process: Map parallel loops to GPU kernels. Apply the -g…

---

## [How to insert waitcnt to boost performance](https://discourse.llvm.org/t/how-to-insert-waitcnt-to-boost-performance/85855)

<div class="topic-metadata">

**Author:** [@LuoYuanke](https://discourse.llvm.org/u/LuoYuanke)\
**Replies:** 1\
**Last updated:** [April 22, 2025, 10:28am UTC](https://discourse.llvm.org/t/how-to-insert-waitcnt-to-boost-performance/85855 "2025-04-22T10:28:48Z")

</div>

Hi, I’d like to understand the waitcnt. There is some description about waitcnt at 4.4. Data Dependency Resolution in AMDGPU ISA. In llvm AMDGPU target, there is a SIInsertWaitcntsPass to insert waitcnt. Does anyone kno…

---

## [TLS support in GPU progamming](https://discourse.llvm.org/t/tls-support-in-gpu-progamming/84175)

<div class="topic-metadata">

**Author:** [@LuoYuanke](https://discourse.llvm.org/u/LuoYuanke)\
**Replies:** 9\
**Last updated:** [January 30, 2025, 9:41pm UTC](https://discourse.llvm.org/t/tls-support-in-gpu-progamming/84175 "2025-01-30T21:41:50Z")

</div>

I try to use TLS (thread local storage) variable with ROCM compiler and NVCC, but fail to get the expected behavior for both of the compilers. ROCM crashes when compiling the code, and NVCC seems ignore the keyword \_\_thr…

---

## [Divergent Control Flow](https://discourse.llvm.org/t/divergent-control-flow/80423)

<div class="topic-metadata">

**Author:** [@LuoYuanke](https://discourse.llvm.org/u/LuoYuanke)\
**Replies:** 23\
**Last updated:** [January 20, 2025, 2:58pm UTC](https://discourse.llvm.org/t/divergent-control-flow/80423 "2025-01-20T14:58:43Z")

</div>

Hi, I am investigating the divergent control flow of GPU. I notice in the AMDGPU document (https://www.amd.com/content/dam/amd/en/documents/instinct-tech-docs/instruction-set-architectures/amd-instinct-mi300-cdna3-instr…

---

## [Exploring LLVM's Role in FPS and Power Consumption Optimizations for GPUs](https://discourse.llvm.org/t/exploring-llvms-role-in-fps-and-power-consumption-optimizations-for-gpus/82688)

<div class="topic-metadata">

**Author:** [@aabhinavg](https://discourse.llvm.org/u/aabhinavg)\
**Replies:** 3\
**Last updated:** [October 28, 2024, 8:15am UTC](https://discourse.llvm.org/t/exploring-llvms-role-in-fps-and-power-consumption-optimizations-for-gpus/82688 "2024-10-28T08:15:22Z")

</div>

Hello LLVM community, I want to ask a simple question related to the optimization of GPU applications using LLVM, and I just want to know about how compiler can influence the FPS and power efficiency of the GPU . Here …

---

## [How to verify correct regalloc for a kernel?](https://discourse.llvm.org/t/how-to-verify-correct-regalloc-for-a-kernel/80811)

<div class="topic-metadata">

**Author:** [@BenWibking](https://discourse.llvm.org/u/BenWibking)\
**Replies:** 5\
**Last updated:** [August 24, 2024, 4:19am UTC](https://discourse.llvm.org/t/how-to-verify-correct-regalloc-for-a-kernel/80811 "2024-08-24T04:19:48Z")

</div>

Is there a way to (automatically) verify the correctness of register allocation for a given kernel after it has been compiled to machine code, e.g., by stepping through LLVM IR and comparing virtual register values to ph…

---

## [some dialects in  AMGGPU dialects  are equal to ROCDL dialects , Is it redundant?](https://discourse.llvm.org/t/some-dialects-in-amggpu-dialects-are-equal-to-rocdl-dialects-is-it-redundant/78265)

<div class="topic-metadata">

**Author:** [@mollon650](https://discourse.llvm.org/u/mollon650)\
**Replies:** 1\
**Last updated:** [June 20, 2024, 7:31pm UTC](https://discourse.llvm.org/t/some-dialects-in-amggpu-dialects-are-equal-to-rocdl-dialects-is-it-redundant/78265 "2024-06-20T19:31:19Z")

</div>

I have a question about some dialects in AMGGPU dialects are equal to ROCDL dialects , Is it redundant?

---

## [Mysterious assembler documentation in llvm/docs/AMDGPU](https://discourse.llvm.org/t/mysterious-assembler-documentation-in-llvm-docs-amdgpu/77447)

<div class="topic-metadata">

**Author:** [@epilk](https://discourse.llvm.org/u/epilk)\
**Replies:** 3\
**Last updated:** [March 8, 2024, 10:10am UTC](https://discourse.llvm.org/t/mysterious-assembler-documentation-in-llvm-docs-amdgpu/77447 "2024-03-08T10:10:31Z")

</div>

Does anyone know anything about the assembler instruction syntax documentation listed in llvm/docs/AMDGPU? It looks like they were autogenerated by @dpreobra, but it isn’t clear to me what tool was used or what input was…

---

## [Investigating high register pressure (at the IR level?)](https://discourse.llvm.org/t/investigating-high-register-pressure-at-the-ir-level/69897)

<div class="topic-metadata">

**Author:** [@Pierre-vh](https://discourse.llvm.org/u/Pierre-vh)\
**Replies:** 2\
**Last updated:** [April 11, 2023, 12:28pm UTC](https://discourse.llvm.org/t/investigating-high-register-pressure-at-the-ir-level/69897 "2023-04-11T12:28:59Z")

</div>

Hello, I’m investigating a performance issue in an AMDGPU kernel which is caused by a lot of values being alive at the same time, causing extremely high register pressure (hundreds of spills of both SGPRs and VGPRs). I…

---

## [Representing buffer descriptors in the AMDGPU target - call for suggestions](https://discourse.llvm.org/t/representing-buffer-descriptors-in-the-amdgpu-target-call-for-suggestions/68798)

<div class="topic-metadata">

**Author:** [@krzysz00](https://discourse.llvm.org/u/krzysz00)\
**Replies:** 65\
**Last updated:** [April 4, 2023, 5:22pm UTC](https://discourse.llvm.org/t/representing-buffer-descriptors-in-the-amdgpu-target-call-for-suggestions/68798 "2023-04-04T17:22:52Z")

</div>

tl;dr: I’m trying to design a better pointer representation for AMDGPU’s buffer descriptors, my design seems like it might be too complicated, and I’m looking for feedback. Context On AMD GPUs (GCN onward, at the very l…

---

## [Handling multiple exits in StructurizeCFG](https://discourse.llvm.org/t/handling-multiple-exits-in-structurizecfg/69080)

<div class="topic-metadata">

**Author:** [@gandhi56](https://discourse.llvm.org/u/gandhi56)\
**Replies:** 2\
**Last updated:** [March 9, 2023, 7:27am UTC](https://discourse.llvm.org/t/handling-multiple-exits-in-structurizecfg/69080 "2023-03-09T07:27:25Z")

</div>

Hi, I noticed a TODO in AMDGPUUnifyDivergentExitNodes at llvm-project/AMDGPUUnifyDivergentExitNodes.cpp at 115c7beda74f3cfaf83b91d14bc97a39bff4cf19 · llvm/llvm-project · GitHub. StructurizeCFG still does not seem to be …

---

## [Handling PHIs in Uniformity Analysis](https://discourse.llvm.org/t/handling-phis-in-uniformity-analysis/68655)

<div class="topic-metadata">

**Author:** [@gandhi56](https://discourse.llvm.org/u/gandhi56)\
**Replies:** 3\
**Last updated:** [February 23, 2023, 9:24am UTC](https://discourse.llvm.org/t/handling-phis-in-uniformity-analysis/68655 "2023-02-23T09:24:17Z")

</div>

Is it possible for uniformity analysis to mark an instruction as uniform after it has already been identified as divergent? In the above CFG, the terminator of Flow2 is identified as divergent and hence Flow2 is inse…

---

## [\[AMDGPU\]\[LLC\]\[LLVM\] Cannot select: intrinsic %llvm.amdgcn.if](https://discourse.llvm.org/t/amdgpu-llc-llvm-cannot-select-intrinsic-llvm-amdgcn-if/68456)

<div class="topic-metadata">

**Author:** [@Zeyuli](https://discourse.llvm.org/u/Zeyuli)\
**Replies:** 0\
**Last updated:** [February 14, 2023, 5:01am UTC](https://discourse.llvm.org/t/amdgpu-llc-llvm-cannot-select-intrinsic-llvm-amdgcn-if/68456 "2023-02-14T05:01:43Z")

</div>

Hi,all I’m working on adding AMDGPU backend for a JIT compiler(Taichi) and in a bit of trouble now. With O3 optimization llvm::PassManagerBuilder builder; builder.OptLevel = 3; builder.Inliner = llvm::crea…

---

## [Catching up on uniformity analysis](https://discourse.llvm.org/t/catching-up-on-uniformity-analysis/68403)

<div class="topic-metadata">

**Author:** [@gandhi56](https://discourse.llvm.org/u/gandhi56)\
**Replies:** 5\
**Last updated:** [February 13, 2023, 5:58am UTC](https://discourse.llvm.org/t/catching-up-on-uniformity-analysis/68403 "2023-02-13T05:58:43Z")

</div>

Hello, I have been working on replacing the LegacyDivergenceAnalysis in AMDGPUUnifyDivergentExitNodes with the new uniformity analysis. Two of the tests reported a failure in SIAnnotateControlFlow because some basic blo…

---

## [Convert NVIDIA GPU LLVM IR(NVVM) alloca instruction to AMDGPU's](https://discourse.llvm.org/t/convert-nvidia-gpu-llvm-ir-nvvm-alloca-instruction-to-amdgpus/64578)

<div class="topic-metadata">

**Author:** [@Zeyuli](https://discourse.llvm.org/u/Zeyuli)\
**Replies:** 7\
**Last updated:** [September 9, 2022, 6:00am UTC](https://discourse.llvm.org/t/convert-nvidia-gpu-llvm-ir-nvvm-alloca-instruction-to-amdgpus/64578 "2022-09-09T06:00:12Z")

</div>

I use clang++ and hipcc to generate LLVM IR for NVIDIA GPU and AMD GPU. They generate different alloca statements. Here is an example: \_\_device\_\_ void int\_a\_kernel() { int a = 1; } NVIDIA GPUs LLVM IR: define dso…

---

## [\[AMDGPU\] Drop the GCNRegBankReassign pass](https://discourse.llvm.org/t/amdgpu-drop-the-gcnregbankreassign-pass/5203)

<div class="topic-metadata">

**Author:** [@huoshanl](https://discourse.llvm.org/u/huoshanl)\
**Replies:** 1\
**Last updated:** [January 17, 2022, 10:15am UTC](https://discourse.llvm.org/t/amdgpu-drop-the-gcnregbankreassign-pass/5203 "2022-01-17T10:15:25Z")

</div>

hi if we can resolve reg bank conflict, some stall cycle may not happen. so why the newest llvm version delete this pass? commit link: https://reviews.llvm.org/D101313

---

## [GCNRegBankReassign pass issue](https://discourse.llvm.org/t/gcnregbankreassign-pass-issue/5303)

<div class="topic-metadata">

**Author:** [@huoshanl](https://discourse.llvm.org/u/huoshanl)\
**Replies:** 0\
**Last updated:** [January 11, 2022, 1:03am UTC](https://discourse.llvm.org/t/gcnregbankreassign-pass-issue/5303 "2022-01-11T01:03:27Z")

</div>

hi: why amdgpu backend Drop the GCNRegBankReassign pass ? if we can resolve reg bank conflict, some stall cycle may not happen. in theory，resolve bank conflict can avoid some stall cycles per instruction。so i don’t un…

---

## [The current state of spilling, function calls and related problems](https://discourse.llvm.org/t/the-current-state-of-spilling-function-calls-and-related-problems/2863)

<div class="topic-metadata">

**Author:** [@Flakebi](https://discourse.llvm.org/u/Flakebi)\
**Replies:** 0\
**Last updated:** [February 19, 2021, 11:03am UTC](https://discourse.llvm.org/t/the-current-state-of-spilling-function-calls-and-related-problems/2863 "2021-02-19T11:03:51Z")

</div>

This is an attempt to summarize the current state of spilling, function calls and related problems. A general problem that often manifests with LLVM is that LLVM (IR) only has the view of a single thread and not the whol…
