Repository navigation
[Engine] prefill timing: do not record a mark in the phase already running (the breakdown charged copy waits to "dequant" on Windows HIP) - #4006
Open
Vop3p wants to merge 1 commit into
Conversation
STRATA_PREFILL_TIMING's PfTimer recorded a timing event at every mark, and compute() marks "dequant" once per expert. Under WDDM each record is a submission of its own (~80 us on an RX 6900 XT, Windows 11), so the timer put ~16 records per MMQ group on the stream, slowed the run it measured and charged the launch gaps it made to "dequant". A mark in the phase already running adds nothing to the totals (the gap is charged to the earlier mark's phase either way), so it is skipped. Only the timing build path changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
The Those are macOS 26 SDK symbols, and the runner builds with Marking it ready for review. It has still not run on NVIDIA, SYCL or Metal hardware (CUDA compile only; see "Not run" in the description), and the switches it adds are off by default. |
Vop3p
marked this pull request as ready for review
October 25, 2026 03:57
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.
Branch:
Vop3p/Strata:prefill-timer-coalesce(one commit onmain7dd5cf1, +5 lines inPfTimer::mark). Not run on NVIDIA, SYCL or Metal hardware.Problem and result
STRATA_PREFILL_TIMING=1records a timing event at everyPfTimer::mark, andcompute()marksdequantonce per expert. Under WDDM eachcudaEventRecordis a submission of its own (~80 µs on an RX 6900 XT under Windows 11, ~3 µs on Linux), so the timer put ~16 records per MMQ group on the compute stream. The launch gaps it made were charged todequant, so the breakdown pointed at the wrong stage, and it slowed the run it measured.Two marks in a row in the same phase add nothing to the totals: the gap between them is charged to that phase either way. This change skips such a mark. Totals are the same, with a fraction of the records.
The same 32K prompt, the same build otherwise (
main7dd5cf1 vs this branch),STRATA_PREFILL_TIMING=1, ms of GPU timeline:mainAbout 3.3 s that
mainreports asdequantis the compute stream waiting for expert copies; with this change it shows aswait copy, which is where the time goes (the copy-event PR, #4005, then removes most of it).Speed with the timer on, 5 interleaved cold-start pairs, prompt tok/s (median): 4K 587.4 (
main) vs 589.1 (this branch, faster in 4/5); 32K 823.2 vs 830.0 (5/5). The timer off, same config: 589.2 / 828.7. So onmainalone the timer costs 0.2-0.7%. It costs more once the copy waits are gone: with the copy-event switches on, the timer cost 8% of a 32K read before this change and 2.7% after (measured on a v0.2.3-based build of both patches).Related discussion
None. Found while measuring the prompt path on Windows (the copy-event PR, #4005).
Approach
if (used > 0 && ph[used - 1] == phase) return;at the top ofmark(), after theoncheck.fold()keeps the last mark and its phase, so a same-phase mark after a fold is skipped too, and the interval simply continues. Only builds run withSTRATA_PREFILL_TIMINGset are affected.Validation
Passed:
tools\hip\build_windows.bat(ROCm 10.2.0a20260930): the pairs and the breakdown above.setup.pyoptions, gfx1030; CUDA 13.2.86strata_prefillcompiles.Not run:
Limits
On
mainalone the speed effect is 0.2-0.7%: the change is about a correct breakdown, and about the timer's own cost once the copies are fast.The peer timer (
PeTimer) has the same pattern on a second GPU; not changed here (no multi-GPU Windows box to measure it).Developed with an AI coding assistant; every number above was measured on the RX 6900 XT machines named in it (Windows 11 / i9-10900K and Linux / Ryzen 5 5600X).
🤖 Generated with Claude Code