Repository navigation
Conversation
|
Thanks @gilby. Running SenseNova-Loop-9B through the qwen27 lane host, with one copy of the trunk weights and a KV or delta-net slot for each of the 56 steps, is a clean way in. The oracle trace, the kernel contracts on both chip classes and the concurrent-equals-alone receipts give a solid base. Only Before it can land:
|
|
Addressed point 3 (and rebased onto current
(Remaining review points 1, 2, 4, and 5 from #3859 (comment) will be addressed separately.) |
|
Addressed the remaining points (1, 2, 4, and 5; point 3 was answered in comment #7003223145) and merged 1. Existing
|
|
Thanks @gilby. All five items are in: the shared paths are gated back to today behavior with the 9B and 27B level within a hair on both chip classes and every token hash equal, the SenseNova-only changes are gated or reverted, one set of config rules now matches the shared table with the fixture to prove it, the exactness receipts and the conversion recipe are posted, and the unused code is gone with green checks on the head. The three files that moved tonight are the usual take-both lists, which our side takes at landing. Nothing is left for you.
|
…al does The route kernel takes pre_scale as an f32. A positive f64 such as 1e-50 passed the reader and the finite check, then ran as 0. Admission now refuses it with UnsupportedSenseNovaMhc, matching ashhart#3859's reader. Two fixture cases: 1e-30 (a normal f32) accepts, 1e-50 is refused at admission.
|
On M5 Max with Zig 0.17.0, the exact zig build test-sensenova-loop-config-host test-qwen27 test-native \
test-environment-host test-env-defaults-host -Dcpu=apple_m1 -j5 --summary allThe current trial merge into Igor Lessio - AIFLOW LABS |
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
c07419f to
5c61232
Compare
|
I checked the revised head zig build test-sensenova-loop-config-host test-qwen27 test-native test-environment-host test-env-defaults-host -Dcpu=apple_m1 -j3 --summary allExit 0 on M5 Max with Zig 0.17.0. 505 tests passed and nine skipped across 84 build steps. These are the host checks from my previous review on the resolved tree. The earlier served exactness and throughput receipts remain separate. After #3377 landed, merging #4278 ( zig build test-sensenova-loop-config-host test-qwen27 test-qwen27-reply-cache-host test-qwen27-startup-host test-kv-pool test-prefill-service-host tf-qwen27-pages-resume -Dcpu=apple_m1 -Dversion=0.0.0 -j3 --summary all
./zig-out/bin/tf-qwen27-pages-resume351 tests passed with three skips. The synthetic resume run matched the restored, moved and fresh slot digests. These checks are on the scratch resolution. Igor Lessio - AIFLOW LABS |
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
5c61232 to
cd8f3ea
Compare
|
Fast-forward commit Local verification on
CI status for
|
…al does The route kernel takes pre_scale as an f32. A positive f64 such as 1e-50 passed the reader and the finite check, then ran as 0. Admission now refuses it with UnsupportedSenseNovaMhc, matching ashhart#3859's reader. Two fixture cases: 1e-30 (a normal f32) accepts, 1e-50 is refused at admission.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
|
On main There is an independently testable parent slice at That slice gives a tested route for updating the parent first. This run was scoped to family config and host residency, without a live checkpoint. Igor Lessio - AIFLOW LABS |
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
…al does The route kernel takes pre_scale as an f32. A positive f64 such as 1e-50 passed the reader and the finite check, then ran as 0. Admission now refuses it with UnsupportedSenseNovaMhc, matching ashhart#3859's reader. Two fixture cases: 1e-30 (a normal f32) accepts, 1e-50 is refused at admission.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
The net change of ashhart#3859 at c07419f over its merge base 6858510, carried as one commit because four of the branch's merge commits hold changes of their own.
What this changes
Adds native Metal inference support for
sensenova/SenseNova-Loop-9B(sensenova_loop/sensenova_loop_text) through theqwen27lane backend in both BF16 and AWQ W4A16 (group_size=128) weights, including the 56-step looped execution schedule (stem0..3, trunk4..27run twice, tail28..31), two-stream Sinkhorn-Knopp mHC kernels,OutSplitssibling linear stacking (281 -> 226dense dispatches/token), fusedXS128AWQ xsum+scale (Q27_XS=128),512Kstatic YaRN scaling (factor=2.0, honoringo.rope_yarn),model.visual.image inputs,2048-rowwide_promptchunks, Copy-Draft enabled by default forconfig.looped, and thetf-sensenova-oracleHugging Face trace verifier.mtp.safetensorsmulti-token speculative drafting).main(685851076f2bf2a0710565dc6095ea407c5ea930).quantize_sensenova_awq.pyexport recipe are published at this public Gist.Review updates since initial posting
qwen27/ shared paths:zig/src/families/qwen27/decode_round.zig: scoped relaxed verify-tail andloop.encodeAttnProjtor.model.config.looped; restored strictaccepted or head != .allcheck and "accepted round" test case inzig/qwen27_bank_boundary_host.zig.zig/src/families/qwen27/attention.zig: preserved existingchunks * plan.tiles * 16 <= scratch.tail_chunks * scratch.limits.rows * 16bound whenwide_prompt == false.zig/src/native/metal.zig&zig/src/families/qwen27/{config,model,yarn}.zig: scoped--rope-yarnacceptance andfactor != 1YaRN resolution to SenseNova (isSenseNova/config.looped), checked resolvedsenseNovaMaxContextceiling instead of hardcoding524,288, readgeneration_config.jsononly whenisSenseNovaRoot, and keptroot.get("max_position_embeddings")fallback gated tolooped.zig/src/core/qwen_vl/weights.zig: keptloadWithdefaulting toNoVisionToweron"vision_tower."; SenseNova opts into"model.visual."vialoadWithPrefixes, and unit test checksshards.headersForwithout emittingstd.log.err.zig/src/families/qwen27/widths.zig: hashesx.kindincostShapeonly whenx.kind != .affineso existing affine checkpoints retain prior timed cost keys.sensenova_loopconfig.jsonparser & fixture with qwen3_5 cuda: SenseNova-Loop-9B (sensenova_loop) in BF16, text only #3723: Merged config alignment (20f85515c) per@Maxrio9's note (use_gate, strict root keys,iterations=20,pre_scale=1,layer_types, non-tied head, mHC range validation).sn_awq_int4_embed,sn_awq_quantize_bf16,awq_quant.metal, andLinearGpu.quantizeBf16ToAwq; removed unusedqwen27_served.Options.draftsfield in this base PR; added bit-exact factor-2 YaRN test inzig/src/core/rope_yarn.zigagainsttransformers 5.14.1(0x3f88df4e+ 32u32words); enabled lone Copy-Draft forloopedinqwen27_lanes.zigand ordered"copy"first intools/conformance_profiles/sensenova-loop-metal.jsonsoconformance.pypasses7/7on both BF16 and AWQ.Checks on this head
c07419f1f8b0d0e6b5fbe28560dcabecd219c2d5python3 tools/pr_check.py --base origin/main --pr 3859:merge base 685851076f2bf2a0710565dc6095ea407c5ea930; 83 changed files; lean 189 vs 189, 0 new; 0 error(s), 0 warning(s).zig fmt --check build.zig zigexit0;git diff --check origin/main...HEADexit0.c07419f1f(Apple M5 Ultra):zig build test-golden test-native test-qwen27 test-sensenova-loop-config-host test-kernel-contract test-environment-host test-env-defaults-host dev-tools --summary all: exit0,347/347 steps succeeded; 739/747 tests passed (8 skipped)(includestest-golden322/335with0unexpected diffs,test-native156/159,test-qwen27158+21+5,test-sensenova-loop-config-host3/3,rope_yarnfactor-2 word-for-word test, andqwen27_bank_boundary_host; full1131/1131build/test15065/15194passed earlier on39386ed14).tools/zig86/86(3skipped),tools/tests/test_bench_conformance.py45/45;tools/tests366/367(test_eval_sandbox.py:145hits unrelatedorigin/mainmacOS SIPchflagsPermissionErrorcopying/usr/bin/open; skipped on Ubuntu CIpytest).f76202899/c64b6cf5b; subsequent merges39386ed14andc07419f1fonly merged upstreamCHANGELOG.md,nccl,server, and#3716config_fields/checkpoint_eosplumbing):./zig-out/bin/tf-sensenova-oracle: BF16 (exec55=0.9998916,logits=0.9999594, TOP14/4, TOP1616/16,6/6greedy exact4/4, 4/4, 42/42, 64/64, 64/64, 64/64); AWQ g128 (exec55=0.9999162,logits=0.9999633, TOP14/4, TOP1616/16,6/6greedy exact4/4, 42/42, 22/22, 64/64, 96/96, 64/64).python3 tools/conformance.py tools/conformance_profiles/sensenova-loop-metal.json:7 passed, 0 failed, 0 skippedon both BF16 (drafted == plain:10/10 equal,98/108drafts accepted;resumed == fresh:6/6 equal,cached_tokens [6107, 6191, 6107, 6191]) and AWQ g128 (drafted == plain:10/10 equal,106/116drafts accepted;resumed == fresh:6/6 equal,cached_tokens [6107, 6191, 6107, 6191]).tools/bench_concurrent.py --levels 1,4 --temperatures 0,1.0 --tokens 128 --reps 2 --alone --serial:0failed,0unmeasured,0unequal on all 8 cells (alone2/2&8/8,serial1/1&4/4) in both BF16 and AWQ g128.tools/bench_cache_agents.py --trace agent_loops --conversations 2 --rounds 4 --prefix-tokens 4096 --tokens 64: BF16 (qualified: true,24/24 usage_verified,22/24cached_tokens > 0,rebuilt_rows: 71423) and AWQ g128 (qualified: true,24/24 usage_verified,22/24cached_tokens > 0,rebuilt_rows: 71219).c07419f1f: all 9 checks green (benchmark-clients (ubuntu-latest),benchmark-clients (windows-latest),fmt,pytest,release-paths (ubuntu-24.04),zig,zig-b,zig-macos-dev-tools,zig-windowsSUCCESS;host-nightly-linuxandhost-nightly-macosSKIPPED).-Dnvcc), HIP (-Dhip=true), XPU, Windows, and Apple M1/M2/M4 chips — changes target Metalsensenova_loop/qwen27(looped/wide_promptgated) and were qualified on Apple M5 Ultra (applegpu_g17, tensor units) and Apple M3 Ultra (applegpu_g15, non-tensor-unit SIMDgroup path).Receipt
main(685851076),model_type: "sensenova_loop"is refused asUnsupportedModel. Cooled 4-pass A-B-B-A (main32c4e3d8fvs#3859) on both Apple M5 Ultra and Apple M3 Ultra forQwen3.5-9B-4bitandQwen3.8-27B-MLX-4bitshows identicaltoken_shaon all deterministic runs and no regression (0.9895x–1.0685x, full table in Gist).zig/src/families/sensenova_loop/*,zig/kernels/metal/core/sensenova_mhc.metal,zig/kernels/metal/qwen27/{bf16_linear,awq_w4a16,awq_m5_fast,glue,mlp_xs,norm_input,norm_xs}.metal,zig/src/families/qwen27/*,zig/src/core/{rope_yarn,qwen_vl/weights,qwen_vl/tower,contract/sensenova_*}.zig,zig/src/native/{metal,qwen27_engine,qwen27_reserve,qwen27_served,qwen27_lanes,qwen27_images,slide_open_test}.zig,zig/src/cli/hub.zig,zig/src/server/family_sampling.zig,zig/tests/{contract/metal_*,qwen27/sensenova_oracle}.zig,tools/conformance_profiles/sensenova-loop-metal.json.TF_*environment variable in this PR (--rope-yarnalready onmainis wired into SenseNova checkpoints, resolving againstconfig.jsonceiling; Copy-Draft defaults on forloopedwhenTF_QWEN27_COPIESis unset; conformance profiletools/conformance_profiles/sensenova-loop-metal.json).685851076f2bf2a0710565dc6095ea407c5ea930, headc07419f1f8b0d0e6b5fbe28560dcabecd219c2d5; Zig0.17.0; Apple Metal32023.922; macOS27.2.1on Apple M5 Ultra512 GB(applegpu_g17) and macOS26.6.2on Apple M3 Ultra512 GB(applegpu_g15);sensenova/SenseNova-Loop-9Brevision3e1ba6e8ac98090f9f7c03a55f26269eb3850fb6(BF16andquantize_sensenova_awq.pyW4A16 g128conversion).qwen27/sensenova_loopBF16 & AWQ g128 host tests, Metal kernel contracts on M5 Ultra and M3 Ultra, cooled 4-pass A-B-B-A non-regression on M5 Ultra and M3 Ultra, HF oracle parity,conformance.py 7/7,bench_concurrent.py, andbench_cache_agents.py. Could not run Apple M1/M2/M4, CUDA, HIP, XPU, or Windows.tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false:tools/bench_concurrent.py --levels 1,4 --temperatures 0,1.0 --tokens 128 --reps 2 --alone --serial: BF16 (code&chat) and AWQ g128 (code&chat)failed: 0,unmeasured: 0,alone2/2atc=1and8/8atc=4(unequal: 0),serial1/1(T=0) and4/4(T=1.0) (unequal: 0).conformance.pydrafted == plain:10/10 equalon both BF16 (98/108drafts accepted) and AWQ (106/116drafts accepted).mainrefusessensenova_loop(UnsupportedModel). For existingqwen27checkpoints (Qwen3.5-9B-4bitandQwen3.8-27B-MLX-4bit), cooled 4-pass A-B-B-A (main32c4e3d8fvs#3859) on M5 Ultra and M3 Ultra shows zero regression and identicaltoken_sha:--parallel 4 --prompt-cache-gib 0,TF_QWEN27_SLOT_RESUME=0,cached_tokens == 0):Qwen3.5-9B-4bitprefill20480.3530s -> 0.3522s(1.0022x,sha=0295af491acd),81921.4111s -> 1.4088s(1.0016x,sha=b0bf2d60cd68), decode120.01 -> 120.16(T=0 fib,bd2789147d7e) /130.10 -> 130.12(T=1.0);Qwen3.8-27B-MLX-4bitprefill20481.0724s -> 1.0721s(1.0003x,12b2383204bb),81924.3496s -> 4.3475s(1.0005x,85ea6fe29514), decode47.21 -> 47.24(T=0 fib,a10c9b848ed9) /48.75 -> 48.73(T=1.0).Qwen3.5-9B-4bitprefill20481.6359s -> 1.5421s(1.0608x,0295af491acd),81926.7437s -> 6.4126s(1.0516x,b0bf2d60cd68), decode92.24 -> 92.17(T=0 fib,92e7d77ab272) /99.52 -> 99.38(T=1.0);Qwen3.8-27B-MLX-4bitprefill20485.1365s -> 5.1368s(0.9999x,12b2383204bb),819221.2363s -> 21.3384s(0.9952x,85ea6fe29514), decode118.89 -> 118.61(T=0 fib,2b28aa2108de) /136.88 -> 135.45(T=1.0).tools/bench_openai.py&tools/bench_concurrent.py:--parallel 4 --context 36864 --prompt-cache-gib 0,bench_openai.py256tok3reps on0ff2bcc51): BF1628.94–29.06 tok/s, AWQ g12854.30–55.51 tok/s.bench_concurrent.py(128tok,2reps,--prompt-cache-gib 8): BF16c=1 29.0–29.3,c=4 agg 103.9–106.4(per 26.8–27.3); AWQ g128c=1 54.4–55.9,c=4 agg 191.2–196.3(per 49.8–50.5).ttft_sfromtools/bench_cache.py --require-cold(0ff2bcc51,cached_tokens: 0,qualified: true,--prompt-cache-gib 0, plus 4-run median in parens):2,048tok0.601s(3,405 tok/s, median0.594s/3,445 tok/s);8,192tok2.390s(3,427 tok/s, median2.345s/3,493 tok/s);32,768tok10.247s(3,198 tok/s, median10.227s/3,204 tok/s).2,048tok0.767s(2,670 tok/s, median0.735s/2,786 tok/s);8,192tok2.914s(2,812 tok/s, median2.885s/2,840 tok/s);32,768tok12.588s(2,603 tok/s, median12.543s/2,613 tok/s).sensenova/SenseNova-Loop-9BisApache-2.0(no external drafter weights in this PR).Kernel contract, only when a GPU kernel is new or changed
sensenova_mhc_records.zig&sensenova_linear_records.zig; no priorsensenova_loopkernels replaced):sn_mhc_enter,sn_mhc_pre_norm,sn_mhc_post_merge,sn_mhc_post_and_pre_norm(verified against sequentialpostMerge -> preNorm),sn_bf16_mv_*,sn_bf16_gemm_*,sn_bf16_gemm_splitk_*,sn_bf16_gemm_splitk_sum,sn_awq_lane_*,sn_awq_m5_mv_*,sn_awq_gemm_m5,sn_awq_row_mv_*,sn_awq_qmm_m3,sn_awq_xsum_128,sn_awq_scale_input; plusQ27_XS=128, YaRNq27_rope,q27_head_normshift, andq27_embed_bf16tested in theqwen27contract suite (--only qwen27). (Unusedsn_awq_int4_embedandsn_awq_quantize_bf16were removed.)45M5 /37M3sensenovacontrols and6M5 /3M3qwen27controls — all fail red as planted (0missed).SUMMARYline and exit status:applegpu_g17,tensor_units=true, exit0):./zig-out/bin/tf-kernel-contract --only sensenova:SUMMARY 24 kernels: 24 pass gates 1-4, 0 fail, 0 known findings; 45 controls: 45 red as planted, 0 missed; 0 limit problems; gates 18457 ms, limits 409 ms./zig-out/bin/tf-kernel-contract --only qwen27:SUMMARY 40 kernels: 40 pass gates 1-4, 0 fail, 0 known findings; 6 controls: 6 red as planted, 0 missed; 0 limit problems; gates 306596 ms, limits 387 msapplegpu_g15,tensor_units=false, exit0):./zig-out/bin/tf-kernel-contract --only sensenova:SUMMARY 17 kernels: 17 pass gates 1-4, 0 fail, 0 known findings; 37 controls: 37 red as planted, 0 missed; 0 limit problems; gates 13069 ms, limits 43 ms./zig-out/bin/tf-kernel-contract --only qwen27:SUMMARY 30 kernels: 30 pass gates 1-4, 0 fail, 0 known findings; 3 controls: 3 red as planted, 0 missed; 0 limit problems; gates 117016 ms, limits 33 msChecklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled