Skip to content

Build1 publisher2 min readPublished

Walking the stall counter down puts SM120's fixed-latency window at four cycles

A dev.to microbenchmark hand-encodes SASS control words on SM120 and shrinks each stall until the consumer reads stale data; interleaving independent pairs then spreads the same four cycles across more producers.

The Engineer · Build desk

Illustration accompanying Walking the stall counter down puts SM120's fixed-latency window at four cycles

What happened

  • A dev.to post microbenchmarks SM120 by hand-encoding the Stall field of each producer and walking it down until the consumer reads a stale register, following Jia et al.'s Volta method.
  • Huerta et al. found the required producer stall does not change with register bank conflicts, which they take as ruling out a variable-latency Operand Collector stage during instruction execution.
  • The FADD-to-FFMA pair runs in five cycles, and interleaving two, three and four independent pairs takes six, seven and eight cycles, one extra cycle per pair added.
  • The post reports that a Stall Counter of 4 does not satisfy every data dependency, naming producer and consumer instruction type, forwarding and write-back paths, execution pipeline and ILP among the factors.
  • Every measurement ran on SASS-Testbench, with registers R52 to R60 zeroed ahead of each snippet so uninitialized values could not mask a bad read.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • constraint Anyone emitting SASS by hand cannot rely on one global latency constant; the stall value has to be chosen per producer-consumer pair, per pipeline, and against whatever independent work sits between them.
  • exposure An under-encoded stall hands the consumer a stale register without faulting or stalling, so the defect surfaces as bad numerics well downstream of the instruction that caused it.
  • capability Because the wait can be spread across independent producers, the published snippets take issue rate from 0.4 instructions per cycle at one pair to 1.0 at four, a factor of 2.5 for the same dependency structure.
  • contradiction The post's stated finding is that a stall of 4 is not always sufficient, yet every threshold in the published excerpt, arithmetic pairs and MOV pairs alike, is consistent with 4.

In Huerta et al.'s model the compiler owns the dependency and the hardware only runs the wait it was handed [1]. For a fixed-latency producer that wait is the Stall field of the control word; variable-latency producers get a Dependence counter instead [2]. Take a cycle off the Stall field and no interlock catches it. The stopping condition in the Jia-style method is that the consumer's result becomes incorrect, and the last stall value that still yields a correct result is recorded as the producer's latency [3].

The ILP snippets show where the wait goes. At two pairs the producers carry S01 and S03, at three they carry S01, S01 and S02, and at four every instruction in the block carries S01 [9][10][11]. The stalls ahead of the first FFMA sum to 4 in all three cases: 1+3, 1+1+2, and 1+1+1+1 [15]. The independent producers sitting between the first FADD and the first FFMA absorb the wait.

Those cycle counts are a claim about a hand-built snippet. Every producer in the series is a FADD reading the same two source registers, R8 and R9, every consumer is an FFMA multiplying by RZ, and nothing in the series touches memory [20]. For the numbers to mean anything in code you did not hand-encode, the compiler would have to pick the same stall values for the same instruction pairs, and your producers would have to issue down the same pipeline.

Two of the results the post rests on are cited to Huerta et al. rather than re-measured: the bank-conflict sweep behind the Operand Collector conclusion, and the finding that MOV-MOV and MOV-LDG latencies differ. They attribute that difference to a possible forwarding path inside the pipeline MOV belongs to [4][5]. What this post adds is the comparison across classes of fixed-latency instruction and the ILP series [19]. In its own MOV-MOV measurement the producer carries S04 and the block runs in 5 cycles, the same shape as FADD-FFMA [13][8]. The published text does not include the minimum stall figures in the sentences that report them, so the only readable values are the encoded S-fields in the listings. The MOV series breaks off partway through the ILP=2 case [14].

What to watch

  • Published stall thresholds for the cross-class pairs the post says it investigates, which is where a counterexample to 4 would have to appear.
  • A corrected version of the post that prints the minimum stall figures alongside the listings.
  • A reproduction of the ILP series on a second SM120 part or a different NVIDIA architecture.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories