[llvm] [AMDGPU] Prefer `s_memtime` for `readcyclecounter` on GFX10 (PR #80211)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 20:07:33 PST 2024


================
@@ -1065,8 +1065,6 @@ def : GCNPat <
   (REG_SEQUENCE SReg_64,
     (S_GETREG_B32 getHwRegImm<HWREG.SHADER_CYCLES, 0, -12>.ret), sub0,
     (S_MOV_B32 (i32 0)), sub1)> {
-  // Prefer this to s_memtime because it has lower and more predictable latency.
-  let AddedComplexity = 1;
----------------
jhuber6 wrote:

I'm not intimately familiar with the backend. My understanding is that the added complexity ensures SelectionDAG will choose this lowering instead of the `s_memtime` one in cases where both are available. The only platform where both are available is gfx10 AFAIK, so removing this makes it work on gfx10. Would we need some more specific predicates? My assumption was that no new cards would have `s_memtime` and the shader counter at the same time.

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


More information about the llvm-commits mailing list