Skip to content

train 1120072427: #3590 #3603 #1858 (CI only) - #4181

Closed
ashhart wants to merge 50 commits into
mainfrom
lead/train-1120072427
Closed

ashhart wants to merge 50 commits into
mainfrom
lead/train-1120072427

Conversation

@ashhart

@ashhart ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #3590 #3603 #1858 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.

jschmied and others added 30 commits November 20, 2026 07:24
…ad as format v1 Configs under the same checks

eagle3 joins the format's architectures (one row a pass); drafter_layout names a file's tensors under a published
layout (blocks.N, the target's own embed and head, unused tensors admitted by name).
… lane core's Drafted wrapper

The forward copies the drafter's tapped rows (layers 44/47/49, normed as the next layer reads them) and the backend
hands them out as Features (prepare_features/features); cuda/eagle3.zig runs the drafter's passes on shared operators
only (dense rows, norms, qk rows, window attention, SwiGLU, embedding gather, argmax): no new kernel. Without
--drafter nothing is tapped and no forward changes.
…he depth rule

Absorbs ran one drafter pass per stream, reading the weights once per
stream. absorbMany stages every stream's rows into one pass.

Kolibri reported no window costs, so the depth rule could not trade
drafts against verify rows and drafted at full depth at every stream
count. row_costs.zig times the target's rounds at 1 to 64 rows when the
drafter reserves (lanes.cost_rule's fastest and smooth, as the other
families time theirs) and the drafter passes them as window and lane
costs.
…fts)

The lane core applies the rule's depth cap to a shared round's holds only
under limit_shared_drafts, as Qwen's MTP head and Gemma's drafters set it.
Without it every stream drafted the release's full depth at any stream
count.
dense_rows' 32-row tile runs Kolibri's 128000 x 2560 head about 5x slower
than two 16-row launches on the GB10 (nsys: 15.4 vs 3.0 ms at 17-32 rows,
25.2 ms past 32), and a drafted round at 8 streams verifies about 24 rows.
dense_rows.cu sums each row in one order whatever the tile, so the bits do
not change. Rows past a round (prompt chunks) keep one launch.
…y is allocated

openDrafter refused below a fixed 1 GiB, after the weights were uploaded. Drafter.admit now
computes the need from the config alone: weights as upload puts them, the scratch (sizes shared
with Eagle3.init), and every stream's caches plus the timing slot (Dims.streamBytes). It runs
before the first allocation; DrafterPastMemory keeps its name.
…ds kept only while they beat a copy round

A Drafted model with limit_shared_drafts and Facts.hold_costs (no granted depth) now prices each head's
reserved depth through Rule.payHoldsFor, the granted path's existing costing: the drafter's pass against
the round without it. Draft sources change, never tokens. Host test test-hold-pass-host: a cheap pass keeps
every depth, a dear one falls back to none, no timed pass leaves the legacy cap as it was.
wrap read Drafted.facts when the drafter opened, before Served.reserve timed it, so a drafter that times
at reserve (Kolibri-1's EAGLE-3: step, round costs) reached the lane core untimed: no shared prices at all.
Served.reserve now re-applies the drafter's facts after its reserve (idempotent; no --drafter: untouched).
…_costs)

At reserve, chains of 1, 2, 4 and 8 streams at depth 1 and the serving depth, best of three, on the streams'
slots (zeroed after, before any stream opens); the lane core prices a drafter round with them.
Keep actual XPU startup calls behind the Windows compile-time guard: they instantiate Linux Level Zero loading, mmap and signal code. Preserve the existing environment assertions on every host and every Linux assertion unchanged.
Follow main 3c29352 after the
TP parent moves step and verification into runner_tree. Forward the
candidate mode and use the synchronized row-token handoff. Keep both
environment-case orders and source comments within the required width.
Every pipeline of idol.metal and idol_attention.metal is registered: id_linear's eight forms (plain and GELU),
id_split's two, id_gemm32, id_norm (plain, affine, modulated), id_norm32 (affine, modulated), id_norm_split,
id_repo, id_qk, id_gate_add, id_embed, id_cond, id_bias32 and the attention's four forms. Each output is checked
at idol-sdk's fp16 points as the range its fp32 steps allow; the NAX projections against the tensor unit's
16-deep step bound, the attention against attention_ref's formula with P at the tensor unit's fp32. Inputs at the
large served shapes repeat at periods prime to every tile, so float64 stays cheap and every output is checked.

19 controls: rounding points dropped or added (gate 3), fp16 sums in id_norm32, id_repo, id_qk, id_embed and
id_gemm32, and the NAX fp32 path in id_gemm32's place (gate 4), and the attention's tail keys unmasked.
Gate 5 holds the 24 launches, each reserved by its source.

Known finding: id_qk gives a head holding a NaN +-inf in its other outputs where F.normalize gives NaN, as
Metal's max drops the NaN norm that clamp_min keeps.
…the values the units multiply

--
2.43.0
--
2.43.0
…awn N(0, 1) from a seed

--synthetic-conditioning --cond-seed N replaces the encoders' features with seeded normal draws at the shapes and
dtypes tf-idol reads, so a case holds nothing from a third-party encoder and can be shared. The denoiser run, its
seed, schedule and files are unchanged; reference.json records the conditioning seed.
--
2.43.0
--
2.43.0
…build file

metal_targets.zig was 600 lines on main and tf-idol's row made it 601, so the
image families' program rows (tf-qwen-image, tf-moss-image*, tf-idol and
tf-uocr-*) move to zig/build/metal_image_programs.zig, which also names the
program struct; the table joins them in the same place, so no step changes.
tensorfold.zig's idol export gets a doc comment like its neighbours'.
CHANGELOG gains the line for #1766, and the recipe gains jayleaton's
synthetic-case run at 9aaf5d3 on an M5 Ultra.
--
2.43.0
--
2.43.0
jayleaton and others added 20 commits November 20, 2026 07:24
Port Idol's denoiser from Metal to CUDA under the same precision contract:
fp16 block linears via cuBLASLt with fp32 sums and one rounding after the
bias (tf_idol_bias), LayerNorm32 to fp16 with fp16 modulation, true-fp32
RePo/condition/output projections (CUBLAS_COMPUTE_32F), and a head-64 fp16
attention with fp32 softmax and accumulation in its own image (idol.cu,
idol_attention.cuh), leaving prefill_attention.cu and its SASS untouched.

- family modules zig/src/families/idol/cuda*.zig; the model refuses any GPU
  but sm_120/sm_121 by name with a log line; timing via the sys shim
- tf-idol on CUDA (idol-cuda step) sharing the case driver with Metal
  (zig/tests/idol_run.zig)
- cuBLASLt Linear.initTyped for fp16 and fp32 inputs; bf16 path unchanged
- kernel contract: idol-contract (gates 1-4 over every idol.cu kernel and
  the attention, three controls dropping an fp16 rounding, in their own
  contract_idol_controls.cuh), Idol's set after joint_schema; nvcc 13.0
  records for sm_80/86/89/120/121 joined through idol_cuda_sets.zig beside
  MOSS-Image's in registry_joins.zig; image in contract_limits
- host tests for the family and the contract's range references, beside
  MiniMax's in cuda_family_host.zig
--
2.43.0
--
2.43.0
--
2.43.0
--
2.43.0
… in every order

The kernel sums P x V and l in fp32. With odd values up to 15, each strided fp16 lane stayed below 2048, where
fp16 integers are exact, so fp16 sums missed by only 0.3x (l's rounding). Odd values up to 255 push the lane sums
past 2048 while every fp32 partial sum stays an integer below 2^24. A host test runs gate 4's three orders.
--
2.43.0
--
2.43.0
…a_common_check asks

idol.cu, idol_attention.cuh and contract_idol_controls.cuh kept their own warp_sum, 8-warp block_sum and fp16 mma.
They now use tf_common::warp_sum (the same butterfly), tf_common::block_sum_serial (the same 8 adds in warp order
at Idol's 256 threads) and qmm_frag::mma_f16_v (the same volatile instruction). Under nvcc 13.0 every kernel but the
two norms and the norm control keeps its SASS byte for byte; the norms' sm_120 registers drop to 33 and 36.
--
2.43.0
--
2.43.0
The serving pins now run on every PR, and #1767 changes two pinned files:
cublaslt.zig gains Linear.initTyped (X and W as bf16, fp16 or fp32 for
Idol's denoiser; initEpilogue passes bf16, so existing plans are unchanged)
and kernels.zig registers the idol image.

test-gradient-serving: 1/1 pass.
--
2.43.0
--
2.43.0
…on sums P

The recipe still said no CUDA kernel of this family had run on a device.
It now quotes the idol-contract SUMMARY line from the GB10 (776a333,
and the same result on c3a6c0c) and from the RTX 5090 at sm_120
(f5b88dd), which also passed the shared synthetic case. A GB10 case run
is still to come.

The attention bullet notes that CUDA sums the softmax denominator over
fp32 P and rounds P to fp16 only for P.V, where Metal's id_attention
rounds P first and sums the rounded values.
--
2.43.0
--
2.43.0
…cipe

zig/tests/cuda/main.zig was 600 lines on main and the idol-contract usage
and dispatch lines made it 602, so the gb10-grouped and qmm-prefill-tile22
contract modules are imported at their only dispatch lines, as idol's is.
The recipe gives GustavBlack's GB10 run at 05ab199 (nvcc 13.0: contract
13 of 13 with 3 of 3 controls red, synthetic case 100 of 100, blocks 0 all
23, identical repeat, 53.04 s for 50 steps; peak memory not yet recorded)
and says the 776a333 and c3a6c0c contract runs come before 3682840.
CHANGELOG gains the line for #1767.
--
2.43.0
--
2.43.0
The octree decoder (4 blocks) and Gaussian decoder (16 blocks) run natively on
Metal from the released checkpoint. Host-side pieces: systematic resampling with
a pluggable RNG (native PRNG, or the SDK's recorded draws), compaction, leaves
and jitter, activations, the PLY writer and the camera JSON. tf-idol-decode
decodes a latent and gates it against an idol_case.py `decode` case.

New kernels live in idol_decoder.metal: the point embedding, K/V and head
packing, an fp32 attention for <= 8 query rows, and a copy of the idol
attention whose P.V uses an fp16 hi/lo split. This removes the -2^-12 per-pass
bias that fp32 P picks up on the tensor unit.

Gates are measured against fp32, allowing twice the worst of: the SDK's own
distance, the fp16 floor, and seeded nudged SDK reruns. Further gates:
per-block teacher-forced checks, counts identical given the SDK's
probabilities and draws, activated fields, the PLY's columns, the camera, and
byte-identical repeats. The comparators are covered by plant-a-mismatch unit
tests.

idol_case.py gains `decode`, which pins decoder.py, gaussian.py and camera.py by
sha256 and records levels, draws, counts, fields, the PLY and timings.
metal_idol_decoder*.zig registers dec_embed, dec_half, dec_kv, dec_heads,
dec_attention_few and dec_attention_{00,01,10,11} as "metal idol decoder
...", against float64 at idol-sdk's fp32 and fp16 points. Fifteen controls
each go red at their gate: an added or dropped rounding point, fp16 sums,
P's lo half dropped (caught on heads built so O is P's fp16 remainder
alone), keys past Lk unmasked, an input written, and the two NaN rules
below undone. Gate-5 records are in idol_records.zig; the common Lib is now
generic over a source and its launchers.

Gate 1 found two real rule breaks, fixed with finite outputs unchanged
(the 262k and 32k decode cases give byte-identical PLYs and gate lines):
dec_heads clamped its norm by max, dropping a NaN; and the tiled attention
gave NaN for an infinite value, because an fp16 lo of 0 or of the opposite
sign met the infinity. The lo half now meets the values clamped to fp16's
finite range (about 2% at 262k, 7% at 1M).

docs/recipes/idol.md gains a Decoders part with the precision, gates,
run-a-case commands, measurements and the contract SUMMARY.
… pending)

Port Idol's decoders from Metal to CUDA under the same precision contract,
sharing the host steps (decode.zig now takes either decoder) and the case
driver (tf-idol-decode: idol_decode_run.zig, thin Metal and CUDA mains; the
Metal tool's gate lines, JSON and PLY are unchanged on both Mac cases).

- idol_decoder.cu: dec_embed, dec_half, dec_kv, dec_heads (MultiHeadRMSNorm
  in place, NaN norm kept), the tiled cross attention (full<64, 8>'s row
  arithmetic from query rows to the latent's keys, P rounded to nearest fp16
  as torch's CUDA kernels do) and the fp32 short form for <= 8 query rows;
  each a template whose BREAK 0 ships
- self attention reuses idol.cu's tf_idol_attention; blocks reuse its
  cuBLASLt fp16 linears, norms and gated adds; stem and head in true fp32
- admission: sm_120/sm_121 only, others refused by name
- contract: idol-decoder-contract (gates 1-4 over the six kernels and
  tf_idol_attention at anchor shapes, 13 controls as other BREAK values),
  joined to the family sets; image in contract_limits
- host tests: launch geometry, scratch sizing, contract range references

Not yet compiled with nvcc (the Linux box was unreachable): gate-5 records
and the sm_120/121 fatbin build are pending. Never run on a GPU.
@ashhart

ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Held: main is red.

@ashhart ashhart closed this Nov 20, 2026
@ashhart
ashhart deleted the lead/train-1120072427 branch November 20, 2026 10:42
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