Repository navigation
Conversation
Main's zig/src/families/flashnext/cuda_batch.zig was 599 lines and #4529 adds six. Its scratch-size test moves unchanged into cuda_paging_batch_test.zig, which it already imported; the private unused ple import and the unreferenced proj_row constant (cuda_batch_state.zig keeps its own) go. No code that runs changes; the gradient-serving pin is re-hashed.
…ws the hold drafts
…s; contract pins for the base and attention kernels
…are a round of 16 rows
…s streams, and one in all when they are greedy
…window costs and a hold timed at load, up to the whole block
…e step against the recurrent kernel and the pick against a scan
…t draft pays from a third landing
Integrate PR #4699's DSpark kernel, weight-packing, online-softmax multi-stream attention, batched GPU chain sampling, host SIMD draw, and shared depth pricing optimizations cleanly onto #4465 (03bb79e): - Transpose folded phi ([256, 201024]) and load-time split/transposed RNN weights (rnn_kappa, rnn_rec) for coalesced GPU loads. - Replace score-buffer DSpark attention with zero-scratch 768-thread online softmax with M5 tensor-unit and TF_SIMD_FRAGS=1 pre-M5 paths, plus tiled base and two-stage group softmax/argmax logits. - Wire batched multi-stream absorb/hold, chances with softmax reach, two-pass GPU top-k sampling, host SIMD top-k/greedy draws, and shared-batch target pricing while preserving #4465 invariants (DSP_SCALE, FP32 kappa, plain_guard = false, dspark.warm/measure, and firstLogprobRow). Refs #4652
… on non-macOS Refs #4652
…he DSpark block) #4699's rebase commit adds the "metal inkling2 dspark " block to resolve() followed by an extra `}`, which closes the function early, so the file fails zig ast-check and the Metal contract limits cannot build. The extra brace goes; the block and the rest of resolve() are unchanged.
…ark.zig under 600 lines With #4699's overhaul and main's DSpark lane snapshots (#4542) both in it, dspark.zig came to 639 lines. Main's resolveTailTap, its test and the tap-row size check move unchanged to dspark_snap.zig, which dspark.zig imports and whose test it references. A failed tail restore and resetLane share one clearLane there, which also clears the overhaul's sampled flag. No launch or bit changes.
…anks routes once - The four expert dot kernels run one lane to one output weight row: a simdgroup covers 32 consecutive rows, a threadgroup eight simdgroups, and the activation row is read in uniform 16-byte loads. The NVFP4 and MXFP8 weights are decoded from 16-byte words, two elements at a time, through FP16 bit patterns that equal the reference's E2M1 and E4M3 values and scale exactly; the MXFP8 path falls back to the reference decode for scales outside the exact range and for NaN codes. - Sum order preserved: each output is still one serial chain over its row's columns in index order, starting at zero, adding the BF16 weight times the BF16 activation product one term at a time with the same rounding points and no fused multiply-add, so every output bit equals the previous kernel's. - tf_ink2_combine launches 256 outputs a threadgroup. A threadgroup ranks the token's routes by (expert, route slot) once, drops experts outside the layer, and every output adds weight times down in that order from zero, which is the ascending-expert, ascending-slot order the old per-output scan visited. Same chain, same rounding. - Contract: dot kernels and combine at 256 threads; the combine control now plants route-slot order; the gate/up control plants a dropped pair swap.
…byte loads; router picks in parallel - tf_inkling2_router, tf_inkling2_conv_dynamic and tf_inkling2_logits keep one thread to one dot product but load eight BF16 columns of both rows at a time, four loads ahead of each step. - Sum order preserved: each dot is the same serial chain over columns 0..2303, product then add, with the rounding to BF16 or softcap after it as before. - The router ranks its 128 keys (score plus bias) in parallel: rank 0 to 7 by key descending, then expert index ascending, is exactly the set the serial first-greatest scan picks, and the ascending-expert normalization sum is unchanged. A NaN key makes the scan order dependent, so any NaN key runs the original serial scan. The control now plants the dropped bias.
- The zeta chain (64 ranks, 4,608 columns) and the forget and gain chains (64 ranks a channel) load eight BF16 weights at a time and batch the loads ahead of each step. - Sum order preserved: each zeta, forget and gain value is the same serial chain over its columns in index order, product then add, zeta rounded to BF16 as before, no fused multiply-add.
Every thread scans all 128 keys, so thread 0 alone stores any_nan before the barrier; the serial fallback is unchanged. The contract's router check adds six rows with NaN keys at varied experts, fifty launches each equal to the serial scan and to the first launch's bytes, with two planted controls: no fallback, and a flag from expert 0's key only.
…ulti-line comments)
8 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI for a landing train: #4529 #4699 #4919 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.