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

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Fri Nov 28 03:57:46 PST 2025


  Branch: refs/heads/users/pierre-vh/refactor-insertwaitcnt-regunits
  Home:   https://github.com/llvm/llvm-project
  Commit: 8079999063ba83b4c60c0d858a25b231669c50b6
      https://github.com/llvm/llvm-project/commit/8079999063ba83b4c60c0d858a25b231669c50b6
  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: 158fa7d5d14c73798450518d383ff3f6e62c3656
      https://github.com/llvm/llvm-project/commit/158fa7d5d14c73798450518d383ff3f6e62c3656
  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: f3e2de7631ed25286936a1a65c153d089fe2274c
      https://github.com/llvm/llvm-project/commit/f3e2de7631ed25286936a1a65c153d089fe2274c
  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: de47afb640952967f9b690ec80e26ea98387ef40
      https://github.com/llvm/llvm-project/commit/de47afb640952967f9b690ec80e26ea98387ef40
  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: e944acdad5307d253516a74b2288264e6e71b80a
      https://github.com/llvm/llvm-project/commit/e944acdad5307d253516a74b2288264e6e71b80a
  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:
  -----------
  Remove bloating in map


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

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