mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4006] [CLOSED] [Engine] prefill timing: do not record a mark in the phase already running (the breakdown charged copy waits to "dequant" on Windows HIP) #4872
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4872
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4006
Author: @Vop3p
Created: 10/24/2026
Status: ❌ Closed
Base:
main← Head:prefill-timer-coalesce📝 Commits (1)
af3b4baprefill timing: do not record a mark in the phase already running📊 Changes
1 file changed (+5 additions, -0 deletions)
View changed files
📝
src/prefill/prefill.cpp(+5 -0)📄 Description
Branch:
Vop3p/Strata:prefill-timer-coalesce(one commit onmain7dd5cf18, +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 (
main7dd5cf18vs 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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.