Repository navigation
Conversation
…r stalls other streams' rounds (#3021) The Metal backend now declares prefill_step and cancel_prefill beside reports_fill. The prompt pass moves out of backend.zig into prefill_metal.zig (the device side, unchanged) and prefill_steps.zig (whole pass and step, generic, with recording-fake tests). Both run the same chunk at prompt_flight's cuts, so replies are unchanged; each step lands the queue and reloads its own prompt ids before encoding, since the prompt buffer is shared.
|
Heads-up for landing order: #3045 adds a token-id bound to Nemotron's Metal prompt pass in
|
|
Pushed 081faec on top: the fixes for what the M5 matrix found on the first head.
No chunk, grid, kernel or arithmetic change. Host tests: the parent fails the kept-cursor, redundant drain/reload and terminal-credit regressions; this head passes them, the step and flight tests and the shared lane and cache suites. M5 Ultra rerun of the full matrix against main (240 replies, every one byte-identical): every cell level except plain lone decode at 239.04 tok/s against main's 239.12 (-0.03%); main's own two builds were 239.12 and 239.93, so that gap is inside main's spread, not a change.
|
Part of #3021 (#3025 did the same for Gemma 4). Nemotron on Metal ran a new stream's whole prompt in one call on the lane thread, so with shared rounds (#3005) every other stream's reply waited for the whole prefill.
Change (
families/nemotron/, Metal backend): the backend now declaresprefill_stepandcancel_prefillbesidereports_fill, so the lane host runs one chunk a call and decode rounds run between chunks.prefill_steps.zig'schunkis main's loop body: the cut fromprompt_flight.rows(planned starts, the lesson decision row, the row cap), thenkv_pages.growandprompt_flight.submit. The whole pass (whole, still the vtable'sprefill) and the stepped one (step) both run it, so the chunks are the same. Nemotron declares no chunk invariance, so the host never caps a step (core/lane_host_fill.zig) and nothing moves the cuts.Chunks.encode, the cache open and restore, the lesson trace) moves frombackend.zigtoprefill_metal.zig, unchanged apart from qualified names.backend.ziggoes from 589 to 500 lines.Tests (
test-nemotron-metal-steps-host, new; recording fakes, no GPU): one call submits one chunk at main's cuts, and the calls' chunks equal the whole pass's; the MTP head absorbs rows 0 to n-2 once each, chunk by chunk; a cancel between chunks keeps the state at the last chunk's end; a decode round runs between two chunks of a long prompt. Each fails on main, which has noprefill_step.check-nemotron-prefill-widths-hostnow also compilesprefill_stepandcancel_prefill;test-nemotron-prefill-widths-hostis unchanged. 12 of 12 steps and 9 of 9 tests pass on an arm64 Mac;zig fmt --checkis clean; lean finds 345 problems, the same as main.Before landing, on an M5: replies equal to main's for one stream (greedy, a long prompt that isn't a multiple of the chunk, with the MTP head), for two streams where the second sends a 32K prompt mid-decode, and for a resumed turn; cancel and resend; and stream 1's largest gap between tokens during stream 2's 32K fill (main: the whole fill; this: about one chunk and one round), with no slower time to first token.