[llvm] [AMDGPU] Handle expert scheduling VA_VDST WAR hazards (PR #201619)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 00:54:45 PDT 2026


================
@@ -32,8 +32,9 @@ enum InstCounterType {
   ASYNC_CNT,                         // gfx1250.
   TENSOR_CNT,                        // gfx1250.
   NUM_EXTENDED_INST_CNTS,
-  VA_VDST = NUM_EXTENDED_INST_CNTS, // gfx12+ expert mode only.
-  VM_VSRC,                          // gfx12+ expert mode only.
+  VA_VDST_RD = NUM_EXTENDED_INST_CNTS, // gfx12+ expert mode only.
+  VA_VDST_WR,                          // gfx12+ expert mode only.
----------------
jayfoad wrote:

> I am not sure about the naming. It looks like `VA_VDST_WR` does the job of the original `VA_VDST` (that is tracking writes), but you also need a new helper/non-hardware counter to track the reads.

It's not really a "new helper/non-hardware counter". It is literally using the same hardware counter, it's just that we sometimes need to remember two different values of that counter for each VGPR.

I realize that the name "VA_VDST_RD" might look a bit odd because "DST" sort of implies a write. But it's not my fault the counter was named VA_VDST! I still need to use it to track both reads and writes.

> In that case I would suggest leaving the VA_VDST counter unchanged to match the hardware counter, and name the new helper counter something completely different, like REG_READ_PSEUDO. Just because both counters are used for deciding the wait value for S_WAITCNT_DEPCTR it doesn't mean that they need the VA_VDST prefix.

It's not just that both counters are used for deciding the wait value for S_WAITCNT_DEPCTR, they both determine the value of the VA_VDST wait, so I think the VA_VDST prefix is justified.

Anyway are you OK with me committing the patch as-is for now, or should I hold off?

https://github.com/llvm/llvm-project/pull/201619


More information about the llvm-commits mailing list