[llvm] [AMDGPU] Extend DS loop wait optimization with flush point tracking (PR #175658)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 20 11:11:50 PST 2026
================
@@ -3475,7 +3515,15 @@ SIInsertWaitcnts::getPreheaderFlushFlags(MachineLoop *ML,
// are not used in the loop.
// DSInvalidated is pre-set to true on non-GFX12+ targets where DS_CNT
// is LGKM_CNT which also tracks FLAT/SMEM.
- if (!DSInvalidated && UsesVgprLoadedOutsideDS)
+ // Pure prefetch: no same-iteration DS load use, no DS stores
+ bool PurePrefetchFlush = !DSInvalidated && UsesVgprLoadedOutsideDS;
+ // Prefetch with flush points: some DS loads used in same iteration,
+ // but unflushed loads remain at backedge
+ bool HasUnflushedDSLoads = (DSLoadCount > LastFlushedPosition);
+ bool FlushPointPrefetchFlush = !FlushPointTrackingInvalid &&
----------------
hidekisaito wrote:
Fair enough. Now that I got rid of "barrier in latch block" code, difference between the two modes narrowed quite a bit. Still, neither is a subset of the other. 1) PurePrefetch can work for multiple basic blocks. FlushPointPrefetch does not. 2) For a single block loop, PurePrefetch is a subset of FlushPointPrefetch, but the latter analysis is more expensive.
>FlushPointTracking is valid only if DS is valid
That is not the case. Same iteration use of a load flags DSInvalidated. FlushPoint analysis continues.
Anyway, your comment makes me think that I need to add more clarity to those two modes.
https://github.com/llvm/llvm-project/pull/175658
More information about the llvm-commits
mailing list