engine: stream a step's tokens before the drafter's passes behind it end

Since 1.11.0 a block drafter's context and query passes (DFlash, DFlash2), like a serial drafter's
rounds (MTP), are queued behind the step before its readback, and the host waited for all of them
before it read the sampled ids. The ids' copy was already issued ahead of the passes, but the
commit that streams the tokens came only after the passes had run: every token, the first one
included, reached the client a drafter's passes late.

The copy now has an event of its own (tok_end_). collect_step waits on it, the commit streams the
tokens while the card runs the passes, and the step loop waits for the step's end (step_end_)
right after the commit, before finish_*_drafter reads the slots and before anything else is
issued. The commit issues no device work, so whatever it releases is in use only by the passes
that wait covers, and the next work that could reuse it is issued after the wait. KL mode and
embedding programs keep the old wait; RADIANCE_IDS_EARLY=0 restores it, for an A/B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AshlynandClaude Opus 5.5 authored and StillDeadcode committed 2026-10-26 09:18:57 +01:00
1 parent f55570e351
commit bf6c019571
5 files changed
+72 -15

No files matched your search

+1
View File
@@ -3491,6 +3491,7 @@ The four slots are what the amdgpu kernel driver leaves to user queues. It keeps
| `RADIANCE_PROFILE_EVERY` | with `--profile-ops`, dump the per-op table every N steps (default 32) |
| `RADIANCE_AQL_STAMP`, `RADIANCE_AQL_STAMP_OUT` | `N`: every dispatch of one recorded pass in N on card 0 gets a completion signal of its own, which carries its start and end; the barrier bits and chains stay as unstamped, unlike `--profile-ops`, which plays no recorded pass. One CSV line a dispatch (pass, record, queue, kernel, whether it waited for the one before, whether it was chained, start and end in ns) is appended to `RADIANCE_AQL_STAMP_OUT` (default `/tmp/radiance-stamps-<pid>.csv`) once the card is done with it; `scripts/stampgaps.py` reads it per kind of pass (idle share, gaps before ordered starts, kernels by time). AQL backend only |
| `RADIANCE_LOG_STEPS` | log one line per step: its phase, sequences, and each one's token count and context (§4.5) |
| `RADIANCE_IDS_EARLY=0` | read a step's sampled tokens only once the drafter's passes behind it have run. By default they are read, committed and streamed while the card runs those passes. For an A/B |
Engine development has its own instruments: `RADIANCE_DEBUG_*` (residual probes, routing and issue
dumps), `RADIANCE_OP_ORACLE*` (named ops checked against `libref` on the operands the model issued;