[llvm-branch-commits] [llvm] [AMDGPU][NewInsertWaitcnt] Event Tracker (2/2) (PR #232344)
Sameer Sahasrabuddhe via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Oct 19 02:44:28 PDT 2026
================
@@ -63,27 +68,71 @@ struct CounterInfo {
/// Represents a record within the \ref EventTracker's timeline
/// for one \ref InstCounterType. A record is a pair of \ref MachineInstr
-/// and \ref SingleHWEvent.
+/// and \ref SingleHWEvent with a height in the timeline.
+///
+/// The height is a conservative minimum estimate of *when* the event it
+/// represents occurred. It is used to emit a wait instruction that ensures the
+/// event has completed (e.g. Height = 2 means "wait 2" on the counter ensures
+/// completion of the event across all control-flow paths).
+///
+/// Two examples illustrate how the height works:
+///
+/// If we are iterating a single block where there are no records inherited from
+/// incoming basic blocks, then the height of a record is trivial: if there are
+/// N records, the oldest is at N-1, while the youngest is at 0.
+/// The height of each existing record increases whenever a new one is added.
----------------
ssahasra wrote:
I am still struggling to think of this as a "height". The event is on a timeline, and there are events before and after this one. Sure, there are other timelines, but they can be merged. Height conjures the picture of a stack, but then a stack is a LIFO, not a FIFO.
https://github.com/llvm/llvm-project/pull/232344
More information about the llvm-branch-commits
mailing list