Repository navigation
qwen4-35b-a3b: ModelOpt loader, repeat-2 GDN fusion, batched MoE I=512, native tokenizer, and GB10 validation - #462
Open
maplepaladin73 wants to merge 13 commits into
Conversation
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Add repeat=2 CUDA/HIP fused GDN decode and batched-row variants, extend the exact harnesses, resolve HIP compatibility headers in closure attestations, and download Qwen4 native tokenizer reference artifacts. Generated with [Devin](https://devin.ai)
Add __cluster_dims__(2, 1, 1) siblings for qwen4exp_gdn_verify_fused_rows, qwen4exp_gdn_verify_defer_rows, and qwen4exp_gdn_commit_layers so Qwen4's 2:1 value/key-head ratio runs the fused exact-verify and deferred-commit paths instead of falling back. Extend batch_small and gdn_defer parity harnesses to validate Qwen4 TP1 (16k/32v) and TP2 (8k/16v) shapes. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Allow overriding H/I/TOPK/NE/EL via Q4_* macros and add QWEN4_35B=1 (plus QWEN4_EP2=1) in qwen4exp_moe_w4a4_bench.sh to validate Qwen4's 2048/512/top-8/256-expert geometry in both single-GPU and EP2 modes. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Port encoding_qwen4.py's Qwen4ChatEncoder as ChatEncoding::Qwen4 so protocol delimiters encode with special tokens enabled while user, assistant, reasoning, and tool-body data segments encode on an added-token-free tokenizer (preventing control-token injection). Supports reasoning_effort mapping (including none -> off), tool-result reordering by tool_call_id, preserve_thinking, and multimodal pads. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nels Add K=512 instantiations of qwen4exp_moe_rows_silu_down[_nc] and H=2048/I=512 instantiations of qwen4exp_moe_c8_tc3[_nc], and wire them into Qwen4ExpMoeRows and MoeLayer::rows_pair_eligible so Qwen4-35B-A3B uses batched expert-sorted MoE on verify and multi-sequence decode instead of falling back to per-row launches. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…..8-row FP8 GDN tier Allow DFlash2 on the qwen4_exp exact batching lane to verify up to DEEP_MAX_DEPTH (7 drafts) without requiring ATLAS_QWEN4EXP_MTP_DEPTH, and route 5..8-row FP8 GDN exact projections through fp8_verify_gemv_tier. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh
force-pushed
the
feat/qwen4-35b-a3b-targets
branch
from
December 4, 2026 18:53
e1601ac to
f5c8c5b
Compare
…512) Templatize qwen4exp_moe_tcp_gate_up[_nc] and qwen4exp_moe_tcp_down for H=2048/I=512 and admit (2048, 512) in forward_prefill_tcp and forward_prefill_w4a4 so Qwen4-35B-A3B runs native FP4 tensor-core MoE prefill and skips the 16.9 GiB routed-expert K-major transpose pass. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Use dense_gemv_fp8w_batchm (up to 8 rows per weight pass, bit-identical per row to dense_gemv_fp8w) in lm_head_batched and the multi-token verify head instead of looping dense_gemv_fp8w per row. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… v3 units warn - Switch PLE slot staging copy from copy_h2d_async to copy_h2d_async_retained (backed by long-lived slots_pinned), avoiding a forced cuStreamSynchronize on every gather. - Set default_num_drafts = 2 in kernels/gb10/qwen4-35b-a3b/MODEL.toml and allow K=3 built-in MTP on the qwen4_exp H=2048 exact lane without requiring ATLAS_QWEN4EXP_MTP_DEPTH=2. - Silence the spurious non-TC units_fit warning when ATLAS_QWEN4EXP_MOE_TC=1 is active on H=2048/I=512 (covered by tc3_2048). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh
force-pushed
the
feat/qwen4-35b-a3b-targets
branch
from
December 4, 2026 19:31
f5c8c5b to
4f1be0b
Compare
This branch has not been deployed
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.
Summary
Stacked on top of PR #459 (
feat/qwen4-35b-a3b-targets), this completes Qwen4-35B-A3B-NVFP4 runtime support, kernel fusion, checkpoint-native tokenizer parity, and GB10 performance optimization:ModelOpt checkpoint & PLE compatibility (
9a2f2cbf,1dd9d66a,29d7a126,42445023)config_groupsinto quantization specs inatlas-core.ple_host.rs) and switch PLE pinned slot staging tocopy_h2d_async_retained(eliminating per-gathercuStreamSynchronizestalls).hf_quant_config.json) and Qwen4 native tokenizer artifacts (tiktoken.model,encoding_qwen4.py,tokenization_qwen4.py,qwen4_detector.py).Fused GDN
repeat=2decode, batched rows, exact verify, defer, and commit (e3d7fcbc,81d32d0d)__cluster_dims__(2, 1, 1)CUDA siblings (and Strix-HIP decode/rows siblings) forqwen4exp_gdn_decode_fused_r2,qwen4exp_gdn_decode_fused_rows_r2,qwen4exp_gdn_verify_fused_rows_r2,qwen4exp_gdn_verify_defer_rows_r2, andqwen4exp_gdn_commit_layers_r2, selected bynv/nkratio.atlas-closurequoted-include search roots so HIP compat headers are content-hashed and thevision_encoder.cu -> atlas_ptx_emu.hunresolved-include warning is eliminated.Qwen4
H=2048/I=512MoE kernels, W4A4 prefill, batched FP8 LM head, and speculative defaults (d2af1378,f29e5a6c,d6a91555,94d83984,18605e5a,42445023)K=512instantiations ofqwen4exp_moe_rows_silu_down[_nc]_512,H=2048/I=512instantiations of persistent TC v3qwen4exp_moe_c8_tc3[_nc]_2048, andqwen4exp_moe_tcp_{gate_up[_nc],down}_2048.ATLAS_QWEN4EXP_PREFILL_W4A4=1) on(2048, 512), skipping the 16.9 GiB routed-expert K-major transpose pass.dense_gemv_fp8w_batchm(up to 8 rows per weight pass, bit-identical per row) intolm_head_batched.rsandimpl_a3.rs.default_num_drafts = 2(K=3 MTP optimum on GB10) inkernels/gb10/qwen4-35b-a3b/MODEL.toml, unclampedverify_max_drafts()on theqwen4_expexact lane (K=3 for built-in MTP, K=8 for DFlash2), and wired 5..8-row FP8 GDN exact projections throughfp8_verify_gemv_tier.qwen4exp_moe_w4a4_bench(QWEN4_35B=1,QWEN4_EP2=1) for Qwen4's2048/512/top-8/256-expertgeometry.Checkpoint-native segment-aware Qwen4 tokenizer (
8dd3d93e)encoding_qwen4.py'sQwen4ChatEncoderasChatEncoding::Qwen4with an added-token-freeplain_tokenizerfor data segments (preventing control-token injection),reasoning_effortmapping (none→off),tool_call_idtool-result reordering,preserve_thinking, and multimodal marker triples.Verification
CI / unit checks (
rustc 1.93.1on GB10)cargo fmt --all -- --check— cleanATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests— zero warningsbash scripts/check-license-headers.sh— 4,483 files checked, 0 invalidatlas-kernelsqwen4_35b_a3b_resolution(1/1);spark-modelGDN defer (7/7), MoE (307/307),qwen4exp(96/96),exact_verify(20/20);spark-servertokenizer (126/126)encoding_qwen4.py+tokenization_qwen4.py(tiktoken.model): 4/4 fixtures identical (including<|im_end|>injection, out-of-order tool results,preserve_thinking=false,effort=none)GB10 GPU kernel harnesses (
sm_121)qwen4exp_decode_fuse_bench(16k/32v,8k/16v,16k/48v,8k/24v) — bitwise PASSqwen4exp_batch_exact_bench.sh check&small-check(8k/16v,16k/32v) — bitwise PASSqwen4exp_batch_exact_bench.sh defer-check(8k/16v843 commits,16k/32v879 commits) — bitwise PASSQWEN4_35B=1 qwen4exp_moe_w4a4_bench.sh check(single-GPUEL=256and EP2EL=128) — PASSGB10 runtime validation (
RadixArk/Qwen4-35B-A3B-NVFP4, single GB10, release build42445023)NgramRowCache92.7% hit, 0 evictions) +ATLAS_PLE_RESIDENT=1PCND rejection on FP8 PLE--video-allow-ffmpeg)f341, uncontended,--speculativedefault K=3,--lm-head-dtype fp8, 8 lanes × 262K, BF16 KV,MOE_TC=1,PREFILL_W4A4=1,BF16_GDN=0,DRAFT_HEAD_NVFP4=1,HC_FAST=1,MOE_NO_CLAMP=1,reasoning_effort=none, temp 0, median of n=3, 256 tok/stream):cached_tokens=0, chunk 8192): 3,330 tok/s @ 4K, 2,988 tok/s @ 8K, 2,869 tok/s @ 16K, 2,716 tok/s @ 32K.--kv-cache-dtype fp8/nvfp4are blocked by QSA sparse attention's raw BF16 gather (QSA selection requires a plain BF16 KV cache); BF16 KV remains the required default.Generated with Devin