Skip to content

train 1119085904: #2571 #2730 #3374 #3419 (CI only) - #3934

Closed
ashhart wants to merge 25 commits into
mainfrom
lead/train-1119085904
Closed

ashhart wants to merge 25 commits into
mainfrom
lead/train-1119085904

Conversation

@ashhart

@ashhart ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #2571 #2730 #3374 #3419 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.

laudney and others added 25 commits November 19, 2026 08:59
OCR reads PDF pages by index under a page budget sized for one
generation per page, and must know every page's size before any
inference while holding one rendered page at a time. renderPages
takes a page selection and caps from the caller over its running
budget, measurePages reports the document's page count and each
selected page's size and DPI without a bitmap, the render worker's
request carries both and renderer failures take the caller's error
kind. Chat PDF input keeps its limits, messages and error kinds.
A Mistral client sends whole PDFs and picks pages with pages, so the
route now reads PDF documents with --vision-pdf and the pages list
or range string, bounded before it expands and deduplicated under
the request's page budget. Every PDF is measured before the first
generation, so an index out of range or a request over the budget
is refused whole before any inference, and each page then renders
alone in its page arena just before it is read, so one rendered
page is in memory at a time; a client that leaves renders nothing.
The API guide described an image-only route. It now gives the PDF
render limits and DPI, the measuring before inference with one
rendered page in memory at a time, the shared page budget, PDF
fetches under --vision-pdf, renderer failures, and the pages field;
the changelog line names PDFs and the page budget.
…calls, for queues made with Device.queue4

A queue from Device.queue4 (macOS 26 and later) takes the same calls as a Metal 3 queue and sends them through
an MTL4CommandQueue: a ring of command buffers, each with its own allocator, argument table and constants pages
in place of setBytes; a queue barrier at each encoder's start where Metal 3's hazard tracking ordered encoders;
barriers that flush to the device's coherence point, and one after each dispatch of a serial encoder; copies and
fills on a compute encoder; a shared event for waits; commit feedback for GPU times and failures; and a residency
set that follows every buffer bound, releasing a freed buffer once the queue has nothing in flight. Metal 3
queues are unchanged. TF_METAL4_TIMELINE=n stamps every stage of n named rounds on a Metal 4 queue and logs their
GPU time by kernel and the longest stages. Pipelines carry their kernel's name as their label.
…ounds named for the timeline

boot.openQueue gives the family, and its test rigs, a Metal 4 queue under TF_METAL4=1 where the Mac has one, and
Metal 3 otherwise; the kernels and their order are the same. The decode forward names each round by its rows for
TF_METAL4_TIMELINE, and TF_DSV41_ROUND_PROF=1 logs rounds' host and GPU milliseconds by rows on either queue. A new
device test checks decode rounds of 1 to 16 rows, a prompt's chunks and timestamped rounds on a Metal 4 queue
against a Metal 3 queue, bit for bit.
…ps Metal 3

Served DeepSeek-V4.1 replies were equal on Metal 3 and Metal 4 (48 of 48 in every pairing of two runs each), and
decode rounds took less GPU time on Metal 4 at every row count, so the served family's queue is Metal 4 wherever
the device has Metal 4's command queues. Macs without it, and TF_METAL4=0, stay on Metal 3. The device test rigs
stay on Metal 3 unless TF_METAL4=1, as the timing harnesses sample Metal 3 encoders; metal4_test compares both.
… failure check awaits its own feedback

Review fixes. A queue's commit feedback handlers live in its State: close now waits for every commit's feedback
and, if one is still owed after 2 s, keeps the State's memory instead of freeing it, so a late handler never writes
freed storage (closeWithin is the bounded form; a test closes one queue with every feedback in and one with a
feedback owed). A command buffer's failure check waits for that use's own feedback (a short spin, then naps up to
2 s) before it reports no failure, since Metal 4 delivers errors in the handler apart from the GPU event a wait
watches; one that never arrives is a failure. The DeepSeek-V4.1 round profiler reads and drops its pending round
before the engine closes its queue (a test checks nothing is left pending). Pipelines carry their kernel's name
only under TF_METAL4_TIMELINE, the label's one reader, so other families' pipeline builds do no extra work.
…d in tests

A balanced 27B rerun on the native binary showed tiny but consistent losses against main under a rule fixed before the
run. The Metal 4 path is now compiled in only where the program's root asks for it (the server's root reads the
engines' `metal4`, which DeepSeek-V4.1's Metal entry sets) and in tests. Elsewhere the wrapper's calls go through
inline accessors that are compile-time null, so the Metal 3 path carries no Metal 4 branch, a buffer's release no
Metal 4 step (forget also sits behind a plain flag set when the first Metal 4 queue opens), queue4 is Unsupported and
pipelines take no label. The native binary has none of the Metal 4 selectors; tensorfold-dsv41 keeps them.
test-dsv41-metal still compares Metal 4 against Metal 3 bit for bit.
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Conflicts with main (main moved after stacking); restacking.

@ashhart ashhart closed this Nov 19, 2026
@ashhart
ashhart deleted the lead/train-1119085904 branch November 19, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants