Repository navigation
ricursive: Ripple-65B Preview, Strict, single Spark (prefill +49%, DFlash2 decode +7% vs SGLang) - #328
Conversation
The DFlash2 grouped dynamic causal conv hard-coded two taps in the kernel (delta row stride, output-side offsets) and in its Rust callers, while Ricursive's Ripple-65B DFlash2 drafter ships conv_kernel_size 4 (base_kernel [2, 4, 5120], kernel_projection [2560, 5120]). A 4-tap checkpoint would have run with the wrong coefficients and no error. - dflash2_conv.cu (gb10 + strix-hip): sum `taps` taps (new kernel arg), tap 0 first, so a 2-tap launch computes the expression it did before. - The loader derives (kernel_size, group_size) from the tensor shapes and fails when dflash_config.conv_kernel_size / conv_group_size disagree; from_weights sizes the delta scratch from that geometry instead of the `unwrap_or(16)` / `unwrap_or(2)` / `4 * hidden / 16` defaults, and fails when convs ship but the target has no dflash2_conv kernel. - Dflash2Conv owns the delta-row layout (delta_row_elems, output_delta_offset) for every caller. GPU test (ennspark03, qwen3.8-27b build): dflash2_conv_taps matches a host replica of SGLang's _grouped_conv bit for bit at 4 taps (gamma 16, 32) and 2 taps (gamma 8). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The on-device DFlash2 candidate selector caps top_k at 16 at compile time (per-warp candidate scoring, shared lists); Ripple-65B's DFlash2 drafter ships selector_top_k 32, which Dflash2CandidateSelector::new refused. - dflash2_candidate_selector_k32.cu: the common selector body under _k32 entry names with DF2_SEL_MAX_TOP_K 32, 1024 threads (one warp a candidate), launch bounds for the 64-register budget, a 1024-entry pool for the overflow path's 32 x 32 warp lists, and 8 staged walk rows to stay under 48 KB of static shared memory. No batched entry at this cap. - The common file only gains #ifndef guards, an empty launch-bounds hook and a pool-size static_assert: its PTX is byte-identical to main's (nvcc sm_121, checked on ennspark03), so every 16-candidate drafter launches exactly what it did. - ops::dflash2_selector_build picks module, entry and block size from one top_k; scratch is sized for the widest selector; the rank-split walk and the batched entry refuse top_k > 16 instead of returning unwritten. GPU test (ennspark03): dflash2_selector_parity, host reference = SGLang 0.5.19 CandidateSelector greedy walk, passes at Ripple's geometry (vocab 100352, rank 256, top_k 32, gamma 32 and 16), top_k 20 / gamma 13 and the overflow path (gamma 8, 688-column slices), plus the existing top_k 16/4 cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ripple-65B's DFlash2 drafter declares layer_types [sliding x4, full_attention] with sliding_window 4096 and no_rope_layers [4]; Ricursive serves it (SGLang 0.5.19 + their patch) with RoPE skipped on layer 4 and a 16384-token draft window so the global layer sees its training rows. Atlas applied one window to every layer (use_sliding_window: true made it 4096 everywhere) and RoPE to every layer. - DflashConfig: mixed_layer_windows() (per-layer HF window, fails on an unknown type, a short list or a missing window), rope_layers() from no_rope_layers (fails on out-of-range or repeated indices); a mixed layout has no single sliding_window(). - DflashLayer carries `rope` and `attn_window`. Every attention launch (contiguous, paged, indirect, batched) takes layer_attn_window(layer): the layer's own window on sliding layers of a mixed drafter, else the head-wide window as before. The kernels mask in KV-slot space, so this is SGLang's per-query window over the compacted context. - RoPE goes through layer_rope(); the fused ctx-K RoPE in precompute runs once per run of RoPE layers (one launch when there is no NoPE layer). - resolve_context_window: a mixed drafter takes --dflash-window-size as its global draft window (SGLang's --speculative-draft-window-size); it must exceed every sliding window (the 4096 CLI default fails fast) and sizes the ctx scratch unless ATLAS_DFLASH_CTX_WINDOW is larger. Uniform drafters keep their resolution (4096 scratch default, CLI window or the checkpoint's). Unit tests: Ripple / GLM-5.3 / Qwen3.8 config resolution, malformed declarations, rope runs, window resolution. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…residuals) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ursive Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…layer windows/NoPE Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ut norms) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…amma 32 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nclamped kernel Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-M W4A4 GEMV Co-Authored-By: Claude Opus 5.5 <[email protected]>
… strided Q/K norm Co-Authored-By: Claude Opus 5.5 <[email protected]>
…EL.toml for W4A4 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… on the verify GEMVs Co-Authored-By: Claude Opus 5.5 <[email protected]>
…); fused q|gate split store Co-Authored-By: Claude Opus 5.5 <[email protected]>
…GB/s on GB10) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…checkpoint and reference engine Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fy rows Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m32 for PDL Co-Authored-By: Claude Opus 5.5 <[email protected]>
- FFN prefill on CUTLASS SM120 block-scaled NVFP4 (new pre-quantized entry point): activations quantized at the checkpoint input_scale with flashinfer's arithmetic, weight SFBs packed once at load, the clamped SwiGLU fused into the down input's quantization, persistent-scheduler swizzle (down 92 -> 215 TFLOPS, gate/up 234 -> 309). Shared CUTLASS NVFP4 types moved to a header. - dense_gemm_bf16_pipelined takes the tuned CUTLASS BF16 tiles at large M under ATLAS_BF16_GEMM_CUTLASS (bit-identical; 57 -> 93 TFLOPS on Ripple's attention projections). - rope_forward_rows: rope_forward with each block covering 16 position groups, amortizing the per-block FP64 frequencies (714 -> 92 ms per 6.6K prefill); ops::rope prefers it where the target ships it. OpCache::kernel_or_null. - Review fixes: value residuals require dense BF16 Q/K/V at install (covers every quantized-V arm); drop the PeriNorm gate's redundant re-check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@AzeezIsh: pushed the prefill pass (76e8c2a). Ripple prefill went from 306 to 907 tok/s at 6.6K tokens, +49% over SGLang. The FFN runs on a new pre-quantized CUTLASS SM120 NVFP4 entry point, the BF16 projections on the tuned CUTLASS tiles (bit-identical, under |
Local GB10 smoke (PR #5 comment) refused clean serve: two lookups resolved to handle 0 for target (ripple-65b, sm_121, nvfp4) — w4a16::w4a16_gemm_t_m128_k16 (strix-hip-only kernel) and w4a4::w4a4_gemm_mfast — and there was no BENCH.toml so no PR gate existed for ricursive. Fixes (mirroring upstream PR Atlas-Inf#328's ricursive-ripple-65b target): - kernel_source qwen3.6-27b -> laguna-s-2.1 (HDIM=128 sliding-window paged attention + w4a16 dense FFN tree; same choice as Atlas-Inf#328). - overlay adds nvfp4/w4a4_gemm.cu (glm-5.3-flash's w4a4_gemm_mfast) and KERNEL.toml maps w4a4_gemm = "w4a4" so the lookup resolves. - MODEL.toml gains laguna's [expected_absent.*] sections (incl. w4a16_gemm_t_m128_k16) minus w4a4_gemm_mfast, which the overlay now ships. - new kernels/gb10/ripple-65b/BENCH.toml: unmeasured baselines for bfcl-subset / agentic-webserver / decode-floor / ttft-cold-gate. Build audit: (gb10, ripple-65b, nvfp4) now compiles 202 kernels, 5 overrides; cargo test -p atlas-kernels + atlas-core ricursive green; check --workspace OK. Co-authored-by: maplepaladin73 <[email protected]>
…he strix-hip selector blob kernel_shadow_detector: #328's common/rope.cu rope_forward_rows is the rotate_half convention Mistral's interleaved shadow deliberately lacks; ops::rope looks it up with kernel_or_null and falls back to rope_forward. dflash2_selector_abi: b75da4a (#329, exact round top-K, qualified by the Qwen3.8-27B ST-995 gate) changed the pinned strix-hip selector without updating the hash, so main fails this test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@data-angel I tested this on one GB10 (head Rebase onto main
|
| prompt | Atlas target vs SGLang no-spec | SGLang spec vs SGLang no-spec | Atlas DFlash2 vs Atlas target |
|---|---|---|---|
| code | 31/512 | 37/512 | 54/512 |
| prose | 74/512 | 67/512 | 62/512 |
| math | 34/111 | 9/111 | 35/110 |
| tool | 5/52 | 52/52 | 7/50 |
| long (5.4K) | 29/384 | 38/384 | 74/384 |
| very_long (22.7K) | 3/384 | 55/384 | 57/384 |
Speculative output is not byte-identical to target-only decode on either engine. That's consistent with "lossless" meaning in-distribution rather than serial-exact, but it may be worth saying explicitly in the PR text, given that qwen3.8-27b: exact speculative serving on one GB10 — DFlash2/DSpine, batched to 64, 262K context (stacked on #331) #333's 27B path is serial-exact. The very_long divergence at token 3 against SGLang is the earliest; I'd look at long-context prefill numerics there.
Everything else passed; that conflict-plus-lookup fix is all that's needed. Happy to push the rebased branch for you to cherry-pick from if that's easier.
|
This landed on main through #334's merge ( On my rebased tree, the same fix gave Ripple output token-identical to |
…ets boot Main (4e239ae, Merge Atlas-Inf#334) carries Atlas-Inf#328's Ripple commits, whose shared DFlash head and attention init issue plain try_kernel lookups of kernels that compile only into the ricursive-ripple-65b target: bf16_gemv_m32, fp8_gemv_m32 (dflash_head/from_weights.rs) and rms_norm_vanilla_strided (qwen3_attention/init.rs). Every non-ricursive target that reaches those constructors then fails the boot kernel-audit with unresolved lookups — confirmed on the 4e239ae build: 2 unresolved for (qwen3.8-27b, sm_121, nvfp4). Affected: every DFlash target but ricursive (qwen3.8-27b, qwen3.6-27b, qwen3.6-35b-a3b, holo-3.1-35b-a3b, longcat-flash-lite, nemotron-3.5-*) plus every vanilla-norm attention model for the strided arm. Gate the lookups on model identity with try_kernel_gated, so the lookup is never issued where the kernel cannot exist: a lookup that is never issued leaves no failed row in the boot audit (kernel_pick.rs contract). Handle 0 keeps the existing fallbacks (per-row Q/K-norm loop; small-M GEMV pipelined tier; fp8_m32 only activates under ATLAS_DFLASH_DRAFTER_FP8_M32=1, which is a ricursive lever). Verified on GB10: qwen3.8-27b + DFlash2 boots to /health and serves chat (was refused at audit); ricursive-ripple-65b boots and still builds its 37 FP8 GEMV mirrors. fmt/clippy/dflash_head(197)/pdl(6) clean. Generated-with: Devin Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…t in dflash_head.rs (Self::fp8_m32 -> BlockDiffusionDraftHead::fp8_m32; layer_attn_window -> code span), ops/verify_rows.rs (w4a4_gemm_mfast_scaled, prefill_attention_paged -> code spans), qwen3_attention/value_residual.rs (Self::value_residual_input -> code span). cargo doc --workspace --no-deps is clean under the docs.yml env. Generated-with: Devin Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@AzeezIsh thanks for the rebase notes, for #341 and for the rustdoc and dead-code follow-ups. Sorry I didn't reply sooner. Two of your points are still open on our side, and I'll take both:
|
Summary
Adds Ricursive Ripple-65B Preview (
model_type: ricursive, NVFP4 ModelOpt checkpoint plus its DFlash2 drafter) to Atlas. It uses the new kernel targetricursive-ripple-65b, which takes its kernel sources fromlaguna-s-2.1. This first pass covers Strict numerics on a single Spark (GB10), single stream. Compared with Ricursive's reference SGLang engine on the same Spark:cc @AzeezIsh: this is ready for a look.
Architecture handled
x * wweights, per-head QK norm.g_proj), interleaved into q_proj per head at load. The verify GEMV deinterleaves it as it stores.v = v_proj(lerp(x0, normed, bf16(sigmoid(λ)))), wherex0is the scaled embedding (embed_scale 71.55). Layer 0 snapshots x0, and every V path blends throughvalue_residual_input. Installing value residuals now requires dense BF16 Q/K/V, which keeps every quantized-V arm out of reach.[1,20,39,58,77], γ=32. This needed general conv taps and a K=32 selector twin in the shared DFlash2 code.What "Strict" means here
input_scale, which is what SGLangmodelopt_fp4runs. Single-token decode stays W4A16.cvt_warp_fp16_to_fp4arithmetic.ATLAS_DFLASH_DRAFTER_FP8_M32=1serves it from FP8 mirrors. Verification is exact, so this can change acceptance but never output.Prefill work
At 6.6K tokens, Atlas's GPU time per prefill went from 21.4 s to 7.1 s:
w4a4_gemm_mfast(~62 TFLOPS) replaced by CUTLASS SM120 NVFP4 at ~270 TFLOPSdense_gemm_bf16_pipelined(25 TFLOPS) replaced by tuned CUTLASS tiles at 93 TFLOPSrope_forwardNew shared pieces:
spark-runtime/cuda/cutlass_nvfp4_prequant.cu. A dense NVFP4 GEMM on pre-quantized operands:[N, K/16]scales;input_scale × weight_scale_2;cutlass_nvfp4_types.cuh. Unlike that wrapper, nothing is packed per call, and small activation blocks don't underflow ue4m3.dense_gemm_bf16_pipelined. At M ≥ 256 it takes the tuned CUTLASS BF16 tiles whenATLAS_BF16_GEMM_CUTLASS=1. Those tiles are bit-identical to it at K % 16 == 0. Every model that already sets the flag (SparkGLM) gets this too, with no change in numerics.rope_forward_rowsincommon/rope.cu, with the same rotation per element.ops::ropeprefers it when the target ships it. Targets that shadowrope(Mistral-Small-4) keeprope_forward. Lookup goes through the newOpCache::kernel_or_null.Other kernels (
kernels/gb10/ricursive-ripple-65b/nvfp4/)bf16_gemv_m32,w4a4_gemv_m32(bn32/bn16) andfp8_gemv_m32: small-M verify GEMVs.cp.async.ca, which streams at ~238 GB/s against ~192 for.cg. The pure-read roofline is ~240.ricursive_verify_attn: graph-safe prefill-style attention for one sequence's verify rows.value_residual_lerp,silu_mul_clamp20andrms_norm_vanilla_strided.ATLAS_RICURSIVE_PDL.Benchmarks: one GB10 (spark04), single stream, vs SGLang
Reference: Ricursive's SGLang runner (
inference/local/spark.py,speculative=True, 32 draft tokens), using the same NVFP4 checkpoint and DFlash2 drafter on the same Spark. Atlas runs through its OpenAI-compatible server (command below). Both engines get the same prompts and chat template.Prefill (TTFT with max_tokens 1, unique prompts, 4 reps), tok/s
SGLang's first 1674-token run (45 s) included warmup and is excluded.
Decode (DFlash2, lossless), tok/s
Parity
Caveats
--max-num-seqs 1. The batched-verify graph key includes each slot's row count, so the one-sequence verify attention is chosen per composition. Concurrent DFlash has not been benchmarked.ATLAS_CUBLAS_GEMM=1for Ripple. With it, greedy decode stopped mid-answer (an EOS inside a code block). My best guess: cuBLASLt picks a different algorithm for each verify width, so the target's numerics stop being batch-invariant across acceptance patterns. Not root-caused.CUTLASS_HOME). Without one it logs a warning once and falls back to the tile GEMM.kernels/strix-hip/common/dflash2_conv.cugets the same generic-tap change as the GB10 copy, but it has not been built or run on Strix (CI's release matrix compiles strix-hip).inferspark_prefill_64, 1.1 s at 6.6K) is the next item. The flashinfer hd128 sliding-window prefill only runs on the co-dispatch path today.Serve command (the one benchmarked)
Tests
atlas-corericursive parser tests (3).spark-runtime: the SF-atom size test, the PDL kernel-list contract and the op-cache tests (7).spark-model: the value-residual blend, dispatch-config, BF16 CUTLASS config and vanilla-norm tests (11; 1 ignored, needs a cuBLASLt GPU run).dflash2_conv_taps,dflash2_selector_parityanddflash2_selector_bounds.cargo fmtis clean.cargo clippy --all-targets -D warningsis clean with CUTLASS enabled, on spark-runtime, spark-model and atlas-core. The 500-LoC cap and SPDX headers hold.🤖 Generated with Claude Code