Skip to content

train 1115014632: #3318 #3321 #3345 #3365 (CI only) - #3400

Closed
ashhart wants to merge 19 commits into
mainfrom
lead/train-1115014632
Closed

ashhart wants to merge 19 commits into
mainfrom
lead/train-1115014632

Conversation

@ashhart

@ashhart ashhart commented Nov 15, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #3318 #3321 #3345 #3365 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.

BobClawblaw and others added 19 commits November 15, 2026 01:23
baidu/Unlimited-OCR-2 at its released bf16 weights on M5-class GPUs: the
publisher's preprocessing (bit-exact), the SAM and CLIP image encoder,
the DASH MoE decoder with greedy generation, chunked prefill
(bit-identical at any cut), serving through tensorfold-native --vision
with the family's chat template, and every kernel under the contract.

The SAM encoder, the decoder's attention, its page2d rotary and its MoE
gate are written from the papers and from the release's modules
measured through their inputs and outputs. tf-uocr-blocks gates each
encoder step alone against float32, tf-uocr-vision and tf-uocr-decode
gate a page's stages, and tools/zig/uocr_reference.py makes their cases
from the release's own code. Fed torch bf16's reply, tf-uocr-decode
accepts a departure only as a tie: the same two contenders on both
sides, each margin within one bf16 step (the reference records every
step's two highest logits); --reply-reported reports them instead.

The server's built-in templates share one helper (hf_text_parse.zig):
Nemotron Parse's replaces the checkpoint's, this family's fills in when
the checkpoint ships none, and a --chat-template wins over both.
Under slots_only without --prompt-cache-gib, plan sets aside the slots that fit past the engine's own window and each other stream's fixed part and page, TF_KV_SHARE at most, before windows and held count the rest. The rest of the default cache still becomes pages after the windows. Plans that already kept all n are unchanged, so is every plan without slots_only or with an asked cache.

GLM's advice under 4 states a stream names TF_KV_SHARE alone where its slots now fit, and --prompt-cache-gib only beside a named cache too small for them.
A row said which products its entry takes by rows, items and pairs, and
nothing about the weights' width. Timings on gfx1151 show a choice that
turns with it: of the two K-parallel tiles a plain prompt of 1 row can
run on, one is ahead on 2-bit and 3-bit codes and the other from 4-bit up.

`max_bits` is the most bits a weight code holds for the row to take a
product (0, the default: any). The registry's cost check refuses wider
codes for plain products and plans alike.

A bound that does not parse refuses its row instead of being ignored:

- a bound that is no code width (2, 3, 4, 5, 6 or 8) stops the build of
  the table that writes it, naming the entry and the bound, where 7 or 9
  would have read as "up to 6" or "any"; a row made by hand with such a
  bound takes no product. The registry and the kernel cases read the
  widths from one list, beside the row type;
- `tuning.build` copies an entry's fields by name and dropped the ones
  the row type lacks, so a misspelled bound left its row taking every
  product. Such a field now stops the build, naming the entry and the
  field. Every field the four tables carry is the row type's.

`hip-affine-tune` prints the bound with a row it proposes. No table sets
the bound yet, so no choice changes.

Refs #2923
…-parallel tile

A plain prompt product of 1 or 2 rows ran on `kp0` (8 columns a lane set,
1 row a pass) on every card. On gfx1151 `kp3` (4 columns, 2 rows a pass)
is ahead at 2 rows at every width, and at 1 row from 4-bit codes up; at
1 row of 2-bit or 3-bit codes `kp0` stays ahead. A resumed prompt ends in
such a piece whenever 1 or 2 tokens follow the kept state.

gfx1151's table now gives `kp0` one row of codes of at most 3 bits and
`kp3` the other plain products of up to 2 rows. Costs stay as they were,
so `kp0` keeps the products its row still takes and no row is shadowed.
Nothing else is chosen differently: products of 3 rows and more, routed
plans, decode and the other three tables keep their tiles.

Both tiles are one template and write the 128-row tile's bytes. Tests:

- launches: at every width gfx1151 picks `kp3` at 2 rows and, at 1 row,
  `kp0` for 2-bit and 3-bit codes and `kp3` from 4-bit up, with the
  matrix cores on or off; it keeps `kp1` and `kp2` past 2 rows and the
  reference tile with the dot2 GEMM tiles off; gfx1030, gfx1100 and
  gfx1201 still pick `kp0`.
- tuning: gfx1151's bound is set, so a table that lost it fails.
- kernel suite: `kp0`, `kp3` and the 128-row dot2 tile, launched by id
  whatever the card's table picks, write the same bytes at 1 and 2 rows,
  every width and group, fp32 and rounded into out16; an output left
  unwritten fails too.

Refs #2923
…ayers before them run

A prompt chunk with nothing staged used to read both Engram layers' rows on the host before its command
buffer started. It now writes the ids, starts every Engram layer's reads, commits the layers before the
first Engram layer, reads that layer's rows while they run, and so on: the chunk becomes up to three command
buffers on one queue, each committed once the rows it reads are written. Chunks filled ahead keep one.
…reports a failure

Review (D894): Chunk.wait returned at the first failed buffer while later ones could still run when the caller
reused the input set or freed its buffers.
The prompt scratch and buffers, each slot's KV regions, tail and taps, the forward buffers, the layer scratch
and the RoPE tables were in no residency set, so macOS could unmap them between command buffers and map them
again when the next one was submitted. Target.init now holds them in one residency set on the engine's queue
(requested resident at once), and deinit removes it before the buffers go.
…ide its load limit

Review (D894): the target's own residency set bypassed the 70% wired budget the weights' Resident enforces. The
target now hands its buffers to that owner (Resident.tryAddNow), which refuses and logs a join past its limit, and
removes them from it before they are freed; boot passes the owner through serve.Parts.
…urn and before a thinking prompt's <think>

A thinking prompt ends in <|Assistant|><think>, and the next turn renders that turn as <|Assistant|></think>..., so the
whole-prompt entry was never a prefix of a follow-up and every thinking turn read the whole conversation again. A new
conversation sharing the system prompt and tools found nothing either. Prefill now runs the prompt in up to three parts
and keeps a state at each cut (before the first <|User|> once the system part is 256 tokens or more, and before the final
<think>); the resume path is the one cached prompts already take.
Metal's served model fixed its calibration knobs to the built-in table, so a cost table measured on the serving
machine could not be used. It now passes TF_DSV41_CALIB_FILE through when set (the cached path that already reads
such a file); unset, the built-in table as before.
@ashhart

ashhart commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Held: main is red.

@ashhart ashhart closed this Nov 15, 2026
@ashhart
ashhart deleted the lead/train-1115014632 branch November 15, 2026 04:07
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.

4 participants