[all-commits] [llvm/llvm-project] b96325: [AMDGPU][SIInsertWaitCnts] Use RegUnits-based trac...

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Fri Nov 28 02:14:52 PST 2025


  Branch: refs/heads/users/pierre-vh/refactor-insertwaitcnt-regunits
  Home:   https://github.com/llvm/llvm-project
  Commit: b96325de23fb1a46bcc20833dcbeba8989ba4445
      https://github.com/llvm/llvm-project/commit/b96325de23fb1a46bcc20833dcbeba8989ba4445
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-11-28 (Fri, 28 Nov 2025)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

  Log Message:
  -----------
  [AMDGPU][SIInsertWaitCnts] Use RegUnits-based tracking

Clean up the tracking logic to rely on register units. The pass was
already "reinventing" the concept just to deal with 16 bit registers.

There are no test changes, functionality is the same, except we can
now track more LDS DMA IDs if we need it. The debug prints also changed
a bit because we now talk in terms of register units.

This also changes the tracking to use a DenseMap instead of a massive
fixed size table. This trades a bit of access speed for a smaller
memory footprint. Allocating and memsetting a huge table to zero
caused a non-negligible performance impact (I've observed up to 50%
of the time in the pass spent in the `memcpy` built-in).

I also think we don't access these often enough to really justify
using a vector. We do a few accesses per instruction, but not much
more. In a huge 120MB LL file, I can barely see the trace of the DenseMap
accesses.

This still isn't as clean as I'd like it to be though. There is a mix
of "VMEMID", "LDS DMA ID", "SGPR RegUnit" and "PhysReg" in the API of WaitCntBrackets.
There is no type safety to avoid mix-ups as these are all integers.
We could add another layer of abstraction on top, but I feel like it's going to add
too much code/boilerplate for such a small issue.


  Commit: 848e2b9810013e07c11a40981f8300684e2d0285
      https://github.com/llvm/llvm-project/commit/848e2b9810013e07c11a40981f8300684e2d0285
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-11-28 (Fri, 28 Nov 2025)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

  Log Message:
  -----------
  comments


  Commit: b271b147d7ccaf0242dcb8c48a41c81bc0c8af40
      https://github.com/llvm/llvm-project/commit/b271b147d7ccaf0242dcb8c48a41c81bc0c8af40
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-11-28 (Fri, 28 Nov 2025)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

  Log Message:
  -----------
  Fix build


  Commit: f88e053f55344d4c08b5fc7920f5e6ff63de8434
      https://github.com/llvm/llvm-project/commit/f88e053f55344d4c08b5fc7920f5e6ff63de8434
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-11-28 (Fri, 28 Nov 2025)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

  Log Message:
  -----------
  Comments


Compare: https://github.com/llvm/llvm-project/compare/9da138cf2000...f88e053f5534

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