[all-commits] [llvm/llvm-project] 93d916: [AMDGPU] Measure MFMA read hazards at each producer

Michael Halkenhäuser via All-commits all-commits at lists.llvm.org
Fri Sep 25 17:22:58 PDT 2026


  Branch: refs/heads/users/mhalk/fix/amdgpu-mfma-hazard-window-pairing
  Home:   https://github.com/llvm/llvm-project
  Commit: 93d916ba268c6136ef45ce034d1b304c0637c58d
      https://github.com/llvm/llvm-project/commit/93d916ba268c6136ef45ce034d1b304c0637c58d
  Author: Michael Halkenhaeuser <MichaelGerald.Halkenhauser at amd.com>
  Date:   2026-09-26 (Sat, 26 Sep 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
    M llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h
    M llvm/test/CodeGen/AMDGPU/mai-hazards-gfx90a.mir
    M llvm/test/CodeGen/AMDGPU/mai-hazards-gfx942.mir
    M llvm/test/CodeGen/AMDGPU/rewrite-vgpr-mfma-to-agpr.ll

  Log Message:
  -----------
  [AMDGPU] Measure MFMA read hazards at each producer

Introduce more sophisticated traversal to avoid the following traps:
 - order-dependent traversal and discarding seen BBs despite shorter path
 - mis-matching distance and window of different producers

Record the best distance per BB instead of a visited flag and sweep the
arrivals in nondecreasing distance (bucket queue). This pairs producers
with their actual distance to a consumer in one go.

Fixed scenarios:
 - MFMA reading an MFMA result as srcA, srcB or srcC
 - VALU, memory or export instruction reading an MFMA result

rewrite-vgpr-mfma-to-agpr.ll gains an s_nop 2: a 4-pass XDL write that
partially overlaps the srcC read two slots later requires five wait
states, and none were emitted because the nearest producer wrote the
register in full.

AI-assisted.


  Commit: eba3a84c3b777bd6b98894def7803a3a4eb1006f
      https://github.com/llvm/llvm-project/commit/eba3a84c3b777bd6b98894def7803a3a4eb1006f
  Author: Michael Halkenhaeuser <MichaelGerald.Halkenhauser at amd.com>
  Date:   2026-09-26 (Sat, 26 Sep 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
    M llvm/test/CodeGen/AMDGPU/mai-hazards-gfx90a.mir
    M llvm/test/CodeGen/AMDGPU/mai-hazards-gfx942.mir

  Log Message:
  -----------
  [AMDGPU] Measure MFMA overwrite hazards at each instruction

Apply previously established processing to:
 - VALU overwriting an MFMA result
 - VALU overwriting a register an MFMA took as srcC

AI-assisted.


Compare: https://github.com/llvm/llvm-project/compare/c85fe980f514...eba3a84c3b77

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list