Repository navigation
Inkling 2 Mini on AMD Strix Halo (strix-hip): Strict, Spark, DSpark - #403
Merged
Merged
Conversation
10 of 11 tasks
Contributor
Author
|
GB10 no-change check: the gb10 PTX of this PR is identical to its base. This PR (head afff3de) adds AMD-only branches to five Setup:
Conclusion: on GB10 the AMD branches compile out. This PR changes no gb10 PTX for inkling-2-mini or qwen3.8-27b, so no GB10 serving re-test is needed for it. 🤖 Generated with Claude Code |
…essage gates The gb10 Inkling kernels that are NVIDIA-only PTX get AMD builds; the plain-CUDA ones (decode attention + combine, short convs, block residuals, head norm, the two-kernel message gates, misc glue, the DSpark drafter kernels, logit softcap) compile unchanged under hipcc. - Prefill attention: inkling2_flash_prefill is mma.sync / cp.async / ldmatrix and builds as a trap stub under __SCALE__ / __HIP_PLATFORM_AMD__; under cfg!(atlas_scale) every prefill row count takes the per-head paged body, which on strix-hip is the WMMA port in strix-hip/common/prefill_paged_compute.cuh. That body gains the gb10 INKLING2_PREFILL_BIAS / INKLING2_ROW_SINKS hooks and INKLING2_PREFILL_BIAS_INLINE: the relative bias is computed where it is added (BF16(sum_j rel[j] * rel_proj[j][dist]) in fp32 j order, as inkling2_rel_bias_table rounds it) instead of a [rows, heads, 1024] table written and read every visit, whose grid.y passed 65,535 from 2,731 rows on this path. - Message gates: inkling2_msg_gate_fused (mma.sync) is a stub on AMD and the two-kernel path (msg_gate_z + msg_gate_out) runs for every row count. NVIDIA preprocessing is unchanged: every AMD branch sits under a macro nvcc never defines, and the gb10 bias path keeps its table. Verified on framework (Strix Halo gfx1151) with the rest of this series: prefill (echo) logprobs vs decode logprobs on the same 96 greedy token ids, prompts 166 to 11,886 tokens, 96/96 aligned, mean |dlogp| 0.007-0.032; the in-place bias left those numbers and the NLL bit-identical to the table path (f351 vs f353). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Expert decode GEMVs (inkling2_moe_decode.cu): an AMD branch for the instructions
hipcc lacks.
- E4M3 scales decode by bit math (the AMD compat __nv_fp8_e4m3 -> float decode is
not the standard format; same decode as common/dense_gemv_fp8w.cu).
- cvt.rn.f16x2.e2m1x2 -> exact and branch-free: a code's sign and 3 magnitude bits
placed at FP16 bits 15 and 9..11 read as 2^(e-15)(1 + m/2), or m 2^-15 when
subnormal, and times 2^14 that is E2M1 exactly. Two codes a half2.
- ld.global.nc.L1::no_allocate -> a plain 16-byte load.
- __syncwarp (not in hipcc) -> a wavefront fence + wave barrier around the
shared scale rows.
- Activation quantizers (inkling2_moe_prefill.cu): e2m1 / e4m3 cvt PTX, used only by
the block-scaled W4A4 / W8A8 GEMMs; trap stubs on AMD. interleave_rows (load time)
is unchanged.
- strix-hip inkling2_moe_gemm.cu: the W4A4 / W8A8 (mma.sync kind::mxf4nvf4 /
kind::mxf8f6f4) entries and their tile list as stubs; under cfg!(atlas_scale)
prefill rows take the grouped expert GEMVs over BF16 rows. The next commits replace
this with a WMMA GEMM.
Measured on framework: an earlier E2M1 stand-in (select + float assembly) ran
the NVFP4 gate_up / down GEMVs at 304 / 162 us against 120 / 68 us for the
LUT it replaced (rocprofv3, f361); this form brought Strict C1 decode from 20.5
back to 28.2 tok/s (f362) with prefill-vs-decode logprobs and NLL identical to
the digit (value-exact).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
kernels/strix-hip/inkling-2-mini serves Inkling 2 Mini (Strict and Spark) on Strix Halo: its nvfp4/ links the gb10 target's Inkling kernels (with the AMD branches of the two previous commits) over strix-hip/common, plus its own inkling2_moe_gemm.cu. No kernel_source (the gb10 target's, laguna-s-2.1, has no strix-hip twin; every module it supplies is in strix-hip/common). KERNEL.toml sets -DHDIM=128: the inherited paged decode / prefill bodies size per-lane vectors from HDIM (default 256) and would read past each 128-wide head silently. MODEL.toml is the gb10 target's plus [expected_absent] for the SSM h-dtype and token-overlay probes the model build issues (both gated on handle != 0, neither on Inkling's path). DSpark needs no AMD-specific code: its drafter kernels (inkling2_dspark.cu) are plain CUDA and the DFlash head runs on strix-hip/common's kernels. Verified on framework (Strix Halo, ROCm, util 0.80, BF16 KV), with this series: boots (20.4 GB pre-KV, 307,984 KV tokens), 0 ERROR / panic / hipError lines; greedy answers coherent and deterministic; SparkInkling task_probe 30/30 math, 10/10 tools in Strict and Spark (= the GB10 release receipt); the DSpark drafter loads (3 layers, rnn_hidden rank 256, taps 5/23/41/48) and serves coherent text. The DevLab Strix runner's all-models strix-hip build passes (runs 44951388440, 44954659451). Co-Authored-By: Claude Opus 5.5 <[email protected]>
strix-hip's inkling2_moe_gemm.cu gains the BF16-row grouped expert GEMMs on __builtin_amdgcn_wmma_f32_16x16x16_bf16_w32 (the path gb10 carried until #401's cb10558 moved its prefill to W4A4 / W8A8 only): NVFP4 and MXFP8 stacked checkpoint tensors dequantised per 32-wide K step to BF16 in gb10's order (BF16(e2m1 * (E4M3(scale) * s2[e])), BF16(E4M3(code) * 2^(E8M0 - 127))), E4M3 by bit math, tiles 128 (NVFP4) / 64 (MXFP8) rows x 128 outputs, 8 waves, WMMA operands by 16-byte shared loads; and inkling2_softcap_swiglu between gate_up and down. moe_prefill takes moe_prefill_bf16 under cfg!(atlas_scale) (kernel handles resolved only there) instead of the grouped GEMVs. A/B on framework (grouped GEMVs f350 vs WMMA f351, Strict, one sequence): the same ~1.8K-token prefill chunks 13.3 / 8.0 / 8.2 / 15.9 s -> 5.3 / 3.2 / 3.2 / 6.2 s (2.5x); NLL over 57,648 tokens code 0.63694 -> 0.63704, text 0.89798 -> 0.89694 (noise); prefill-vs-decode logprobs 96/96 aligned on all six prompts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
inkling2_msg_gate_fused gets an AMD branch on __builtin_amdgcn_wmma_f32_16x16x16_bf16_w32 with the gb10 kernel's phases, arguments and roundings: rms of every gate's h and m rows; z = BF16(D BF16([rms0(h); rms0(m)])) on waves 0-3 (one 16-wide rank tile each); then 64 channels a step, F z on waves 0-3 and G z on waves 4-7 staged in fp32, and out = (1 - tanh(F z)) * h + tanh(G z) * m with every gate's inputs read before its outputs are written (out may alias h). Operands by 16-byte shared loads; BF16 staged element-wise (hipcc's bf16 header has no __floats2bfloat162_rn). spark-model takes it on AMD from 16 rows, as on gb10. Why: rocprofv3 of a 4,778-token prefill (f355) put the two-kernel path at 15.6% of prefill (msg_gate_z 4.2 ms + msg_gate_out 2.2 ms per visit and chunk). A/B on framework (f358 two-kernel at 6eaa417 vs f360 this, which also carries #401 db19431): prefill 4,778 tokens 3,917 -> 3,524 ms (1,220 -> 1,356 tok/s), 16,725 tokens 1,140 -> 1,266 tok/s; NLL code 0.63704 -> 0.63689, text 0.89694 -> 0.89618; prefill-vs-decode logprobs 96/96 aligned, mean |dlogp| 0.007-0.027. Co-Authored-By: Claude Opus 5.5 <[email protected]>
One entry point in the serve-nemotron-strix-linux.sh mould: MODE=spark|strict and DSPARK=0|1 (default spark, no drafter: on framework DSpark gains only on Strict code). Downloads the pinned checkpoint, and the Spark overlay or the DSpark drafter as asked; assembles the index-mapped Spark directory (as SparkInkling's spark_overlay.py does) and #401's drafter directory (mtp.safetensors as model.safetensors, config = mtp_config + vocab_size). Refuses without /dev/kfd or a gfx1151 agent, caps GPU_UTIL at 0.82 below 80 GiB GPU-visible (the 64 GB-class host OOM line), builds the inkling-2-mini target when its inputs changed, serves with prefix caching on and prints a ready curl; --check starts, sends one request and stops. MODEL.toml gains a QUICKSTART note. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Formatting only: attn_ops.rs (AMD prefill ensure!) and moe_ops.rs (moe_prefill_bf16 launches), as cargo fmt lays them out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…V on AMD; rustfmt - pdl_tests::pdl_target_kernels_wait_exactly_when_listed reads every definition of a listed kernel, AMD branches included: the AMD stubs of inkling2_flash_prefill and the activation quantizers, and the WMMA branch of inkling2_msg_gate_fused, now call atlas_pdl_enter() (a no-op off sm_90+). - #401 c4db7a3's inkling2_router_gemv.cu #includes common/dense_gemv_bf16_batchm.cu; included text skips build.rs's warp-mask widening, and ROCm 10.1 (DevLab runner) static-asserts on the 32-bit __shfl_down_sync mask (run 44997959809). The AMD branch passes 0xFFFFFFFFULL; NVIDIA tokens are unchanged. - inkling_turn_tests.rs: cargo fmt layout of one assert (CI fmt). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Spark overlay's NVFP4 projections took w4a16_gemv for one row: 27% of Spark decode, 288 calls a token at ~20 us (~133 GB/s; rocprofv3 f370, bin 00d6e75e4aa3). Under cfg!(atlas_scale) one row takes w4a16_gemv_sw when it resolves: the same partial and reduction (bit-identical outputs), 8 outputs a 256-thread block on one wave each instead of 4 on two. NVIDIA unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es only) moe_ops.rs 564->455 (moe_prefill_bf16 + the GEMM_M_TILE_* consts -> moe_prefill_hip.rs), ops.rs 519->392 (the MsgGate/msg_gate cluster -> gate_ops.rs, re-exported as ops::* like attn_ops/moe_ops). No logic changes; with #401's four splits the CI file-size cap goes green.
AzeezIsh
force-pushed
the
feat/inkling2-hip-pr
branch
from
November 23, 2026 05:22
48df64f to
0ecff7a
Compare
AzeezIsh
marked this pull request as ready for review
November 23, 2026 06:09
Closed
7 of 8 tasks
data-angel
added a commit
to Enntity/atlas
that referenced
this pull request
Nov 23, 2026
…split, Atlas-Inf#403, Atlas-Inf#404, Atlas-Inf#406, Atlas-Inf#410) into the images follow-up Two conflicts, both from the split of 401: layers/inkling2/mod.rs declares owner_runs and proj, and inkling2_proj_gemv joins the PDL list in its new file pdl_inkling2.rs. The tree equals this branch's five commits replayed onto main. Co-Authored-By: Claude Fable 5.2 <[email protected]>
1 of 3 tasks
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.
Based on main. #401 merged as 992eab2, including its file-size split 9132aa7. The branch is a linear series of 10 commits (the earlier merges of #401 heads were replayed as a rebase; the tree equals the verified 48df64f plus #401's split and #402's docs). The last commit,
inkling2 on AMD: split moe_ops / ops under the 500-line cap (code moves only), keeps CI's file-size cap green. On framework (f376/f378) it is exact: greedy Strict and Spark identical, pd 96/96 x6 and NLL 0.63689 / 0.89618 to every digit under f373's serve setup. DevLab strix-hip build 45117369384: success.What and why
Inkling 2 Mini (#401, by @data-angel) on AMD Strix Halo (gfx1151,
strix-hip): Strict and Spark modes, the DSpark drafter, prefix caching, and a start script.kernels/strix-hip/inkling-2-minilinks the gb10 Inkling kernels, exceptinkling2_moe_gemm.cu, which is its own WMMA file.spark-modelroutes around the remaining PTX-only kernels undercfg!(atlas_scale).scripts/serve-inkling2-strix-linux.sh, described in the QUICKSTART section below.feat/inkling2-hip. Its tree matched this PR's pre-rebase head 48df64f.HIP replacements for each GB10-only instruction
inkling2_moe_gemm_w4a4/_w8a8(mma.sync kind::mxf4nvf4/kind::mxf8f6f4) and thecvt.rn.satfinite.e2m1x2/e4m3x2activation quantizers__builtin_amdgcn_wmma_f32_16x16x16_bf16_w32), which dequantise the stacked NVFP4 / MXFP8 experts in gb10's order, with the softcapped SwiGLU between gate_up and downinkling2_flash_prefill(mma.syncm16n8k16,cp.async,ldmatrix)strix-hip/common/prefill_paged_compute.cuh), which gains the Inkling relative bias computed in place (bit-identical toinkling2_rel_bias_table) and per-row sinksinkling2_msg_gate_fused(mma.sync)cvt.rn.f16x2.e2m1x2ld.global.nc.L1::no_allocate__syncwarp(not available in hipcc)__builtin_amdgcn_wave_barrier(float)__nv_fp8_e4m3(non-standard on the AMD compat header)common/dense_gemv_bf16_batchm.cuthroughinkling2_router_gemv.cu's#include__shfl_down_syncmask on AMD. Included text skips build.rs's mask widening, and ROCm 10.1 static-asserts on 32 bitsDSpark needed no AMD-specific code.
QUICKSTART
The script:
/dev/kfd;DSpark is off by default because it loses on AMD everywhere except Strict code (see below).
Verification (framework = Framework Desktop, Strix Halo 128 GB, ROCm; runner = DevLab Strix Halo)
Binary = sha256 prefix of
spark. Measured on the merged head 48df64f unless the row names another head.2c7f8270136c(f373)317c5b254a169c7999f4893e--checkrc 0; READY,17 * 23 = 391mainitself (run 44991651911) and on #401's head; this PR adds noATLAS_*namesProfiling-driven changes: the WMMA expert GEMM cut prefill time 2.5× against grouped GEMVs (f350 → f351), and the WMMA fused gates sped prefill up 11% (f358 → f360). The single-warp NVFP4 GEMV for Spark decode is bit-identical (8/8 greedy) and +1.4% at C1 (f371). A 64-wide-K GEMM variant measured 9% slower and was dropped.
Head-to-head (each block on one runner, same client and prompts; reasoning off; medians)
--original-weightsFileNotFoundError 'layer6.pt'(its launcher has no path for the checkpoint's own experts)thinkingmachines/Inkling-2-Mini has no qwen38-flash-next-v2.hgn(Flash-Next-only pack format)Runs: Atlas / llama.cpp 44993335678; Ciru + Atlas anchor 44998230706; Ciru agentic 45004732792; llama.cpp agentic 45004734856.
Atlas leads llama.cpp on every leg and Ciru's concurrent mode at C1–C4. Ciru leads on C1 decode, prefill, C8 and agentic turn time. Ciru serves its own fitted expert weights, and its checkpoint-expert path does not start, so this is not fully like-for-like. Closing the gap is follow-up work: launch gaps (85% GPU busy), NVFP4 GEMV efficiency, a multi-head prefill attention kernel, and the expert GEMM at about 19 TFLOP/s.
Known gaps
ATLAS_DFLASH_BATCH_DEPTHsets the batched depth only)..cufiles got AMD-only branches (inkling2_flash_prefill,_head_ops,_moe_decode,_moe_prefill,_prefill_attn, andcommon/dense_gemv_bf16_batchm.cu). The GB10 PTX byte-identity check is pending from the GB10 worker. Every NVIDIA token stream is unchanged by construction.Credit
Inkling 2 support, its kernels, DSpark and the Spark overlay are @data-angel's (#401, Enntity/sparkinkling). References: huggingface/transformers#51050, ggml-org/llama.cpp#32694, vllm-project/vllm#69028.
🤖 Generated with Claude Code