Skip to content

feat(strix-hip): add qwen4-27b dense H=5120 target (gfx1151) - #456

Draft
AzeezIsh wants to merge 1 commit into
feat/qwen4-35b-dense-corefrom
feat/qwen4-35b-strix-hip
Draft

AzeezIsh wants to merge 1 commit into
feat/qwen4-35b-dense-corefrom
feat/qwen4-35b-strix-hip

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PR (2/3) in the Qwen4-35B bring-up stack (stacked on #455), focused on AMD Strix Halo (strix-hip / gfx1151).

Adds the kernels/strix-hip/qwen4-35b/ target for the dense qwen4_exp backbone (hidden_size = 5120, hc_dim = 20480, num_experts = 0):

  • Hybrid kernel shadow (kernels/strix-hip/qwen4-35b/nvfp4/): Rather than pointing kernel_source = "qwen3.8-flash-next" (which inherits the MoE qwen3.6-35b-a3b w4a16_gemm.cu), this target composes:
    • qwen3.8-flash-next/nvfp4/ HIP overrides: hyper_connection.cu (carries the 16 KB-LDS hc_pre_down_tiled arm selected by feat(qwen4_exp): dense FFN backbone + H=5120 hyper-connection support (Qwen4-27B dense) #455 at hc_dim = 20480), qsa_attn_tc2.cu, qwen4exp_decode_fuse.cu, ple.cu, qsa_indexer.cu, gated_delta_rule_wy17.cu.
    • qwen3.6-27b/nvfp4/ dense overrides: w4a16_gemm.cu (ships the dense-FFN w4a16_gemm_t_m128_k16 prefill arm and DFlash/MTP verify w4a16_rowgemv_m9/m17/reduce kernels missing from Flash-Next's shadow) and gated_delta_rule.cu (48V/16K dense GDN spine).
    • Standard dense GEMM/GEMV (w4a16_gemv*, w8a16_gemm*, dense_gemm_bf16, dense_gemv_bf16*, gated_delta_rule_wyn K=5..8, gdn_verify_fused_*) inherited directly from kernels/strix-hip/common/.
  • Target manifest & boot-audit table (kernels/strix-hip/qwen4-35b/MODEL.toml):
    • Binds unique (model_type = "qwen4_exp", hidden_size = 5120) with match_names = ["qwen4-35b", "qwen4-27b"].
    • Merges the dense-FFN [expected_absent.*] entries from strix-hip/qwen3.8-27b (q4k_mmq, q4k_quantize, dequant_nvfp4_bf16, nvfp4_mmq, w8a16_gemv_fused, dense w4a16 probes) with strix-hip/qwen3.8-flash-next's qwen4_exp entries and [expected_absent.moe_persist_marker] (required by atlas-kernels lib_tests).
    • Sets default_kv_dtype = "bf16", default_num_drafts = 1, tool_call_parser = "qwen3_coder", and reference-parity [behavior] (verbatim_prompt = true, tool_call_steering = false, max_inter_tool_prose = 0, ban_tool_call_without_tools = true).
  • Resolution & contract tests (crates/atlas-kernels/tests/qwen4_35b_resolution.rs): Pins (qwen4_exp, 5120) resolution on strix-hip, non-collision with qwen3.8-flash-next (2560), and moe_persist_marker absence.

Strix Halo (gfx1151) Notes & Day-0 Checklist

  1. Build prerequisite on main: strix-hip builds currently need PR strix-hip: fix main's AMD build (vision_encoder raw mma.sync since #397) #444 (fixes raw mma.sync PTX in vision_encoder.cu introduced by score: images in /v1/score, image packs with an FP8 store, NVMe tier and read-ahead (stacked on #332) #397). Rebase or merge strix-hip: fix main's AMD build (vision_encoder raw mma.sync since #397) #444 before compiling ATLAS_MODELS=qwen4-35b on ROCm/HIP.
  2. Hyper-connection decode at hc_dim = 20480: With feat(qwen4_exp): dense FFN backbone + H=5120 hyper-connection support (Qwen4-27B dense) #455, decode falls back from single-pass hc_pre_down (80 KB > 48 KB LDS) to hc_pre_down_tiled (16 KB LDS, bitwise identical, 40 barrier rounds per token). Once real weights run on Strix, profile hc_pre_down_tiled in decode — a 4H-capable split-K / register-staged HIP decode kernel (following PR22's 40-way K-split design) is the primary mHC decode optimization lever if it shows up hot.
  3. QSA prefill at kv_heads = 4 (if QSA ships): strix-hip/qwen3.8-flash-next/nvfp4/qsa_attn_tc2.cu and qsa_prefill_attn_tc2_ok require num_kv_heads == 2. At kv_heads = 4 (24Q / 4KV, gqa = 6), dispatch safely falls back to qsa_prefill_attn (non-WMMA). If the released Qwen4-35B checkpoint includes QSA indexer weights, generalizing qsa_attn_tc2.cu to launch grid.x = num_kv_heads / 2 (two KV heads per CTA) will recover WMMA QSA prefill on Strix with minimal code change.
  4. Memory fit on Strix Halo (128 GB vs 64 GB unified):
    • BF16 ~35B dense weights (~70 GB) exceed a 64 GB Strix box and leave tight headroom on 128 GB; NVFP4 (~18–20 GB weights) or FP8 (~35–38 GB weights) is the target serving format on Strix Halo (plus demand-paged PLE n-gram rows if PLE ships).
    • Verify dense FFN quantize-at-load vs pre-quantized NVFP4/FP8 on day 0.
  5. MTP / speculation tuning: Spec calls out MTP draft length 4; strix-hip/common/gated_delta_rule_wyn.cu already builds K=5..8 (wy5..wy8), so --num-drafts 4 + ATLAS_QWEN4EXP_MTP_DEPTH=4 + ATLAS_QWEN4EXP_EXACT_VERIFY=1 + ATLAS_QWEN4EXP_BATCH_FAST=1 is directly testable on Strix once weights drop (alongside w4a16_rowgemv_m9/m17 from qwen3.6-27b/nvfp4/w4a16_gemm.cu).
  6. First-boot expected_absent audit: Run one spark serve boot on gfx1151 (Linux DevLab / Framework Strix) to confirm zero undeclared unresolved probes and prune any dead entries from MODEL.toml.
  7. Lock config deltas on day 0: Confirm model_type string, layer count / GDN:full ratio, intermediate_size (14336 vs 17408), whether QSA/PLE ship, BA/QKVZ projection split, and MTP HC layout against the released config.json.

Stack

  1. feat(qwen4_exp): dense FFN backbone + H=5120 hyper-connection support (Qwen4-27B dense) #455 (feat/qwen4-35b-dense-core → main)
  2. This PR (feat/qwen4-35b-strix-hip → feat/qwen4-35b-dense-core)
  3. feat(gb10): add qwen4-27b dense H=5120 target (sm_121) + NVIDIA follow-up checklist #457 (feat/qwen4-35b-gb10 → feat/qwen4-35b-strix-hip)

Verification

  • Local (macOS, ATLAS_SKIP_BUILD=1):
    • All symlinks in kernels/strix-hip/qwen4-35b/nvfp4/ verified live
    • cargo fmt --check — pass
    • cargo test -p atlas-kernels — pass (incl. no_model_shadow_drops_a_common_kernel, qwen4_35b_resolution, target_resolution)
    • cargo clippy -p atlas-kernels --tests -- -D warnings — pass
    • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p atlas-kernels — pass
  • Not yet compiled with hipcc or tested on real Qwen4-35B weights (opened as draft).

@AzeezIsh AzeezIsh changed the title feat(strix-hip): add qwen4-35b dense target (gfx1151) feat(strix-hip): add qwen4-27b dense H=5120 target (gfx1151) Dec 4, 2026

This branch has not been deployed

No deployments
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.

1 participant