Skip to content

ricursive-ripple-65b: Strix Halo (gfx1151) support with DFlash2, on #328 - #334

Merged
AzeezIsh merged 40 commits into
mainfrom
feat/ripple-65b-amd
Nov 10, 2026
Merged

AzeezIsh merged 40 commits into
mainfrom
feat/ripple-65b-amd

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Ripple-65B (ricursiveAI/Ripple-65B-Preview, NVFP4) with DFlash2 on Strix Halo (gfx1151), built on #328's GB10 Ripple "Strict" support. This branch contains #328's commits plus the AMD side; it supersedes nothing in #328 and should land with or after it.

AMD side (8 commits)

  • New target kernels/strix-hip/ricursive-ripple-65b on the qwen3.6-27b gfx1151 tree: -DHDIM=128, the portable Ripple overlay kernels (embed_scale, ricursive_swiglu, value_residual, rms_norm_vanilla_strided, ricursive_verify_attn), DFlash gamma 16, the qwen3.8-27b expected_absent tables.
  • dflash2_candidate_selector_k32 twin for Ripple's selector_top_k 32.
  • gfx1151 has no FP4 MMA and no bf16_gemv_m32: multi-row FFN passes run W4A16 on transposed twins (w4a16_gemm_t_m128_f16a) instead of W4A4 rows, and verify-row q/k/v use the BF16 GEMM. These are cfg!(atlas_hip) arms; the GB10 path is unchanged.
  • Small-M FFN is off for Ripple on HIP (m128 beats t/k64 on gfx1151 at these shapes).
  • cutlass/prequant.rs: allow the CUTLASS-only helpers to be dead on non-CUTLASS builds (ricursive: Ripple-65B Preview, Strict, single Spark (prefill +49%, DFlash2 decode +7% vs SGLang) #328 fails -D warnings on HIP without this).
  • Small-M W4A16 row-GEMV (w4a16_rowgemv_m{9,17}) for the M=17 verify-row FFN, default on for Ripple strix-hip only (ATLAS_FFN_ROWGEMV=0 opts out; opt-in elsewhere): 0.97 vs 1.59 ms/call against m128_f16a, fib request 7.3 vs 9.6 s, greedy identical (framework f257).
  • After merging qwen3.8-27b: exact speculative serving on one GB10 — DFlash2/DSpine, batched to 64, 262K context (stacked on #331) #333 (the drafter is now built before the KV budget), Ripple's 7.5 GB BF16 drafter left 0.1 GB of KV. MODEL.toml [dflash].drop_bf16 (on for strix-hip Ripple, applied only at max_batch_size x γ <= 16) runs the existing ATLAS_DFLASH_DROP_BF16 preshrink on the batched-GEMV tier: 6.84 GiB freed, KV 6640 tokens (pre-merge 2496), drafter on NVFP4 (+15% fib tok/s).
  • The drafter NVFP4 install skips with a warning when its twins do not fit, instead of failing the boot.

Verification (framework, gfx1151 Linux; DevLab strix runner)

  • Runner job=build: green on the merged head (42740899881) and on b3160b4 (42756988525).
  • f259 (b3160b4 minus rowgemv default): Ripple greedy 4/4 identical to pre-merge; fib 9.97 / sky 3.28 / essay 3.89 tok/s; Qwen3.8-27B branch == main 8/8 greedy, tok/s equal (f251).
  • Ripple + DFlash2 (f247, pre-merge): coherent, 0 GPU faults; fib 8.72 / sky 3.07 / essay 3.63 / capital 5.70 tok/s (old AMD branch 7.54 / 2.45 / 2.88).
  • Qwen3.8-27B on this branch == main: greedy 4/4 identical, fib 45.5 vs 45.7 tok/s (f247).
  • Pending: f260 Ripple ST-995 on b3160b4 (old AMD branch: 77.49 / 78.47).

🤖 Generated with Claude Code

data-angel and others added 30 commits November 4, 2026 20:34
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]>
…); fused q|gate split store

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…checkpoint and reference engine

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]>
…ector_top_k 32)

Same module/symbol names as kernels/gb10/common/dflash2_candidate_selector_k32.cu,
which dflash2_selector_build routes top_k 17..32 to. K=32 per-thread register
lists spill on gfx1151, so the twin takes the round top-K form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…DIM=128, portable Ripple overlay)

The gb10 target's portable kernels verbatim: embed_scale, value_residual,
ricursive_swiglu, rms_norm_vanilla_strided, ricursive_verify_attn. gamma 16.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, soft bf16_gemv_m32, small-M FFN off

gfx1151 has no FP4 MMA and the strix tree ships neither the W4A4 multi-row
FFN nor the cp.async m32 GEMVs. On HIP the loader builds transposed FFN twins
(m128 GEMM) and skips enable_w4a4_rows; a missing bf16_gemv_m32 sends verify
projections to the BF16 GEMM. Small-M FFN dispatch defaults off for Ripple on
HIP: m128 is 1.5-2.4x faster and bit-identical at its verify shapes (kbench
42541712895, e2e f243 +5% DFlash2, greedy identical). GB10 is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3.8-27b expected_absent tables (same tree)

The boot audit fails closed on unresolved lookups, so the absent cp.async GEMV
is skipped rather than probed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rows (ATLAS_FFN_ROWGEMV=1)

w4a16_rowgemv_m{9,17} on the transposed NVFP4 layout: each weight dequantized
once (m128's exact decode) and applied to every row; 4 waves split K in-block
with a fixed LDS reduction, a deterministic block split-K (fp32 workspace +
ordered reduce) for N < 16384. gfx1151 kbench 42721529794 vs w4a16_gemm_t_m128:
Ripple M=17 gate/up 2098 -> 1379 us, down 2041 -> 1420; Qwen3.8-27B M=9
gate/up 1003 -> 329, down 865 -> 330. NOT bit-identical (fp32 order, relL2
1.5e-4..6.5e-4), so opt-in until an accuracy gate passes; the lookup is only
issued on HIP with the lever set (fail-closed boot audit elsewhere).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…TLASS builds

swizzle()/check() are only called under cfg(atlas_cutlass); the strix-hip
build (-D warnings) failed on them as dead code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…reak)

kbench 42729349013 vs the shipped m128_f16a: Ripple M=17 gate/up 1881->1161 us,
down 2463->1229; production instantiation was 3.93 ms/call in rocprof (f249),
consistent with the data-dependent break spilling acc[][].

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh and others added 9 commits November 9, 2026 21:09
pdl.rs: keep both new PDL targets (ricursive-ripple-65b, qwen3.8-27b).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
pdl.rs: the Ripple PDL target moves to the per-target switch list.
dflash_head / dflash_loader / ops: keep both module sets (DSpine + Ripple conv, tree_verify + verify_rows).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…KV budget

#333 gave γ 9..16 the w4a16_gemv_batch16 tier and builds the drafter before
the KV budget, so Ripple-65B's DFlash2 drafter (γ=16) now quantizes 7 GEMMs x 5
layers (~2.1 GB) beside its BF16 weights. On a 96 GB gfx1151 box Ripple leaves
~1.5 GB pre-KV and the boot fails (framework f251/f252: cuMemAlloc 0.0 MB free).
Skip with a warning when free memory would drop under a 2 GB floor; the drafter
keeps its BF16 arms, as it did before #333.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…atched-GEMV tiers; on for Ripple strix-hip

Since #333 the DFlash drafter is built before the KV budget. Ripple-65B's
drafter is 7.5 GB BF16, and on a 96 GB gfx1151 box that leaves 0.1 GB of KV
(256 tokens; framework f256) where pre-merge had 0.8 GB (the drafter then
loaded into the post-KV growth reserve).

ATLAS_DFLASH_DROP_BF16 already frees q/o/gate/up/down after NVFP4
quantization, but only with the tensor-core tiers. At gamma <= 16 and batch 1
every drafter pass is <= 16 rows, which the w4a16_gemv_batch16 tier serves from
the same twins, so allow the preshrink there too. A target opts in with
[dflash].drop_bf16; the server applies it only at max_batch_size x gamma <= 16,
and the env var still overrides. A dropped projection reaching a BF16 GEMM
fails loudly (small_m_gemm::ensure_bf16_present).

The NVFP4 install guard no longer skips when the twins were parked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
framework f257 (rocprof, Ripple-65B + DFlash2, 906273b): w4a16_rowgemv_m17
0.97 ms/call vs w4a16_gemm_t_m128_f16a 1.59 ms; fib request 7.1/7.5 s vs
9.6/9.6 s; greedy output md5 identical. Resolved by the Ripple FFN layers only
(other HIP targets never issue the lookup); ATLAS_FFN_ROWGEMV=0 opts out. The
Ripple ST-995 gate runs with it on.

Co-Authored-By: Claude Opus 5.5 <[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]>
Ripple compiles laguna-s-2.1's sources with its own nvfp4/ overlaid
(build.rs: target-local > kernel_source > common); the test only scanned
the borrowed dir, so Ripple's bf16_gemv_m32 looked undefined.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fers it off)

Reverts b3160b4. Framework ST-995 (BFCL golden draw, n=995, seed 42, temp 0) on the same
head, Ripple-65B NVFP4 + DFlash2:
  f260 row-GEMV on  (default):            overall 76.38 / normalized 79.55
  f263 row-GEMV off (ATLAS_FFN_ROWGEMV=0): overall 77.29 / normalized 80.87
  f244 old branch, reference:             overall 77.49 / normalized 78.47
Off is the build that matches the reference, so it ships off; ATLAS_FFN_ROWGEMV=1 still turns
it on (verify ~25% faster on fib, f257).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

AMD accuracy gate (framework, Strix Halo / gfx1151): ST-995 (BFCL golden draw, n=995, seed 42, temp 0), Ripple-65B NVFP4 + DFlash2:

build overall normalized
f244, old AMD branch (reference) 77.49 78.47
f260, b3160b4 (row-GEMV on by default) 76.38 79.55
f263, same head with ATLAS_FFN_ROWGEMV=0 77.29 80.87

The row-GEMV is the only output-changing difference between f260 and f263, and the build with it off matches the reference. So 37dfd64 reverts the Ripple default back to opt-in (ATLAS_FFN_ROWGEMV=1). f263 ran 0 errors, 0 panics, and 0 KV exhaustions. On 37dfd64, cargo fmt --check and cargo check -p spark-model pass on framework. Once CI matches main's existing failures, this merges and gets a post-merge build+serve on framework (strix is offline).

🤖 Generated with Claude Code

dflash2_selector_abi.rs: both sides pin the same strix-hip blob (315dab4d); kept main's comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh
AzeezIsh marked this pull request as ready for review November 10, 2026 19:34
@AzeezIsh
AzeezIsh merged commit 4e239ae into main Nov 10, 2026
22 of 27 checks passed
AzeezIsh added a commit that referenced this pull request Nov 10, 2026
maplepaladin73 pushed a commit to maplepaladin73/atlas that referenced this pull request Nov 11, 2026
…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>
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.

2 participants