L1 reuse of synchronous loads between co-resident CTAs: core form and its test (registration)
Registered before any implementation, new capture or prediction of the form. For the ROADMAP.md item "Model L1 reuse of synchronous loads between co-resident CTAs: register a core form, score it on sync-load-reuse on GB10 and the RTX 4070, before the v0.3 freeze". Nothing below changes after the scoring data are taken. The core change itself goes through a pull request after this registration.
What is known
- On GB10, synchronous loads (
ld.global.v4with the default cache operator, which Triton emits fornum_stages = 1) are served from L1 when another CTA on the same SM read the same addresses in the same step. Two CTAs per SM reading the same 16 KiB stage took 564 ns per step, against 541 ns for one CTA alone and 863 to 867 ns when they read different addresses or bypass L1 (.cg) (result). At one CTA per SM the two load paths do not differ. - The core has no L1 for global loads. It treats synchronous loads as prefetch distance 0 and sends every CTA's bytes to L2 (the tensor cache policy reaches only the L2 split), so it charges a second co-resident reader as a full second stream.
- On the archived v0.2 GB10 GEMM holdout IRs, 101 of 108
num_stages = 1configurations have co-resident CTAs that read the same A or B tile in the first wave, under the core's own occupancy and round-robin dispatch (same result, "reported without a verdict"). The development set put these configurations +9.1% slow warm and +2.2% cold (design.md 9.2).
The 12 points of that capture found the mechanism, so they do not test the form on GB10.
The form (R1, no fitted parameter)
For a phase whose global loads are synchronous (async_copy is none in the KernelIR) and L1-allocating (the tensor's cache policy is neither bypass_l1 nor streaming):
- Sharing set. Among the CTAs resident on one SM, those that read the same bytes of a tensor in the same loop step (same access-map base and stride, the same step index, as the core's dispatch places them) form a sharing set for those bytes.
- Bytes. The set's bytes for that load are charged to L2, DRAM and the SM's L2 port once, as one CTA's, not once per member.
- Time. Each member's stage still waits for the round trip of those bytes; the members after the first add no bytes to it.
- When it applies. Only if one CTA's stage bytes for the load fit in the L1 that the SM's shared memory carveout leaves, so the first reader's lines are still there when the others read them in the same step: stage bytes per CTA at most the L1 capacity that
l1_to_l2_spill_threshold_by_carveoutgives at the carveout the core already computes for the resident CTAs (occupancy), with the same curve lookup the spill model uses. Otherwise R1 changes nothing.
It reads no new profile field: the carveout options and reserved shared memory per CTA in specs (through the existing occupancy), and l1_to_l2_spill_threshold_by_carveout. Asynchronous copies (cp.async.cg, which bypass L1) and loads with a bypassing policy are unchanged, and so is every kernel without co-resident readers of the same bytes.
A second form, in which the later members also see a shorter, L1-hit round trip, would need local_mem_l1_hit_latency_ns, which is still an estimate on every profile. It is not registered.
Scoring data
GB10: new points of the same kernel
A new run of the sync-load-reuse kernel (microbench/src/sync_load_reuse.cuh), registered here as the mode sync-load-share, at geometries the discovery capture did not read. All on the L2-resident level (a 64 KiB region per CTA), 4 warps, a 16 KiB stage (8 KiB A, 8 KiB B), the carveout forced to the largest option by each CTA's dynamic shared memory request as in the amended plan, with the request set so the asked number of CTAs fits (102400 / n - 1024 B, rounded down to the 128 B granularity):
ctas_per_sm2, 3 and 4;sharing:none(every CTA its own A and B),a_only(the CTAs of an SM read the same A, each its own B: GEMM's row of tiles),full(the same A and B);load: default-cached and.cg;- one CTA per SM, default-cached and
.cg, as the base.
20 L2-resident points. The two at two CTAs per SM with full sharing repeat a discovery geometry and are measured but not judged, so 18 are judged: 9 default-cached (5 of them with sharing: a_only at 2, 3 and 4 CTAs per SM, full at 3 and 4) and 9 .cg. Four DRAM-level points are added for the check described at the end, not judged. Co-residency from %smid as before; a point whose CTAs are not as many per SM as asked is void. The long-launch protocol, three host-checked processes on Spark 1 under the GPU lock, and the capture rules are those of the original plan.
RTX 4070
When the quiet desktop gate allows: the original 12 points of sync-load-reuse and the 20 points above. The RTX 4070 has not been measured with this kernel, so all of them are new data there.
Model side
Each point is written as a synthetic KernelIR with scripts/recheck_mechanisms.py's builders: grid = CTAs per SM x SM count, 4 warps, the static shared memory of the point's request, synchronous loads of 8 KiB A and 8 KiB B per step from an access map whose per-CTA bases repeat on one SM exactly as the kernel's do, the per-step ldmatrix and MMA work of the kernel, one barrier. The predicted time per step is the difference of the core's makespan_ns at the frozen length and half of it, over the step difference, draws = 0, warm. The same IRs are run through the core without R1 (the base) and with it.
Decision
On GB10 and, separately, on the RTX 4070:
- Adopt R1 when, on the judged default-cached points where R1 and the base differ by more than 2%, R1's median absolute error is below half of the base's and R1 is closer on at least two thirds of them, and on every
.cgpoint R1 equals the base (it must change nothing there). - Reject R1 otherwise. If both medians exceed 25%, both are reported wrong and no form is fitted to these points.
- Not decided while a device has no valid capture, or fewer than four judged default-cached points where the forms differ.
R1 enters the core only if it is adopted on both GB10 and the RTX 4070 before the v0.3 freeze; a rejection or a missing decision on either device keeps it out.
Expected effect (stated now, not a criterion)
On num_stages = 1 configurations with co-resident readers of the same tiles, R1 removes L2 and port bytes, so their predictions get faster. The development set has them slow (+9.1% warm, +2.2% cold), so R1 is expected to move that residual toward zero, more warm than cold. Configurations with asynchronous copies are unchanged. The pull request carries the prediction diff on the archived IRs required by CONTRIBUTING.md, which validates nothing.
The DRAM level of the discovery capture
At the DRAM level the shared arm was about twice as fast as disjoint for both load paths, .cg included, so it was not resolved for L1: the second reader is served by L2 even when it bypasses L1, and the GPU reads half as many distinct bytes from DRAM. That is reuse in L2 within a wave, which the core's L2 split already models for any load; R1 is not meant to explain it and is not scored there. The DRAM points are not part of the decision. With the new points, the DRAM level (regions of 4 MiB per CTA behind the read-only flush, as in the original plan) is measured for the full and none arms at two CTAs per SM, both load paths, and the base and R1 predictions are reported beside them without a verdict, as a check that R1 does not count the same bytes twice where L2 already serves them.
Owners: 7 (registration, measurement); the core change, 4 or the author of the pull request; review 6.