Repository navigation
Residency is measured, and cuBLASLt's configuration is read (#80) - #85
Merged
Merged
Conversation
…read rather than inferred (#80) cuOccupancyMaxActiveClusters put the shipped cg2 shape at 74 clusters -- half the 148 MAX_CLUSTERS launches -- which would make the persistent wave two sequential waves and reinterpret every wave number on #80. src/residency_probe.rs holds an SM for a fixed globaltimer interval and reports %smid, so overlap is counted rather than modelled; bin/residency.rs runs that beside every occupancy query the driver will answer and beside the shipped kernel timed across grid widths. baselines/cublas_decode.cu reads the library's own launches through CUPTI's callback API -- Nsight Compute's counter library will not initialise in this container, but a launch configuration needs no counters.
This was referenced Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two instruments and no kernel change.
#80had two open anomalies that were both about what is actually running rather than about the pipeline, and neither could be settled from inside the source.1. Residency: measured instead of modelled
cuOccupancyMaxActiveClustersputs the shippedcta_group::2shape at 74 clusters whileMAX_CLUSTERSlaunches 148, and the whole grouped-walk and wave arithmetic inoptimized.rsassumes all 296 CTAs are resident. If the driver were right, main has been running two sequential waves of its "single persistent wave" since it was written.src/residency_probe.rsanswers it directly: every CTA takes its tensor-memory columns, reads%smid, holds its SM for a fixed wall-clock interval (%globaltimer—clock64is per-SM and cannot order two CTAs against each other) and reports the interval. A grid the device runs in one wave takes the hold; one it runs in two takes twice the hold, and the packing and peak overlap come out of the same launch.src/bin/residency.rsruns that beside every occupancy query the driver will answer, and beside the shipped kernel timed across grid widths (tcgen05_launch_config_over, the onlysrc/change — the kernel already reads its own grid throughWalk::open, so any width computes the sameC).Measured, one B200:
All 296 CTAs are co-resident, two an SM. Every wave figure on #80 stands. The driver query answers
floor(SMs / cluster CTAs)and does not model two clusters sharing an SM — it reports the same 74 for a 133-register kernel, a 168-register kernel and an 18-register probe, at 114 816 B and at 1 024 B, at every carveout and every grid. That is why the query ships beside the measurement in one binary and not instead of it: on its own it says 74, and 74 is wrong.The 4-CTA rows are the same instrument answering #80's multicast negative: that grid reaches 142 SMs at two CTAs each, so 71 clusters fit and the 72nd costs a whole second wave. The kernel launched 74.
2. cuBLASLt: read instead of inferred
Nsight Compute does not initialise on the Modal container —
Failed to initialize the profiler: LibraryNotLoaded, which is the driver's profiling support and not something an image can install (ncuitself is already at/usr/local/cuda/bin/ncu;modal_app.pygrows aprofileentry point andNCU=1 ./run.shanyway, so the next person does not have to find that out).A launch configuration needs no performance counters.
baselines/cublas_decode.cureads it from CUPTI's callback API —cuLaunchKernelExparameters, pluscuFuncGetAttributeandcuOccupancyMaxActiveBlocksPerMultiprocessoron the handle the library is passing — at three shallow-K shapes, withdescribe's own fields printed so the algorithm is confirmed to be the onemodel_shapesdivides by.src/bin/cublas_decode.rsis the same three shapes with both sides launched once, for a profiler that can attach.Identical at all three shapes:
cluster=3is 2×1×1, andtile=23is [256, 256] — our tile, over our cluster, at ourBLOCK_K = 64. Outputs over clusters confirms it without trusting the symbol: 65 536 at all three shapes. What differs is six K stages at one CTA an SM against our three at two.Not in this PR
No kernel behaviour changes. The probe entry points live in
optimized::kernelsbecause a binary gets one device artifact (the same reason80-phase-probeput its two there); they are unreachable from every shipped path and add no register or shared-memory cost to the three shipped entry points.Gates
--kernel gemm: parity green, budgets unchanged at 133 / 168 / 145, zero spill — the shipped kernels are byte-identical tomain's, which is the point.