Repository navigation
metal: drop qwen27 prompt_glue/prompt_state and core tf_lane_rope, which nothing launches (#2251) - #3065
Conversation
|
Thanks @jschmied. This is the section 4 cleanup from #2251 in the shape we agreed, and the caller check holds up. What I checked:
One thing blocks it. Please also:
No launched kernel changes, so no token or speed A/B is needed. After the
|
|
@ashhart thanks, you were right about
The new commit changes only |
|
Thanks @jschmied. The fix in 52c867e is what was needed. Every ask is met, and no launched kernel changes, so we'll land it. The branch now conflicts with main in Thanks also for taking the
|
…x kernels nothing launches q27_prompt_product, _silu, _decay, _qk, q27_prompt_conv and q27_prompt_recur were reached only through prompt_gpu.Kernels and prompt_state_gpu.Kernels, which nothing builds with pipelines. The host records in prompt_glue.zig, prompt_gpu.zig, prompt_state.zig and prompt_state_gpu.zig, the build and runtime source lists, the runtime analysis line and the prompt.metal write in tests/qwen27/run.zig go with them.
…see calls No family calls rotate(); the shared attention's runtime callers (Gemma 4 and Qwen27 DFlash) rope their rows elsewhere. Shape loses rotary_dim and rope, which only the kernel read, and lanes_see feeds raw K and Q straight to append and attention.
…passed to shared_attention; changelog line
52c867e to
77be135
Compare
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @jschmied! This is in TensorFold 1.2.8, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.8
|
From #2251 section 4: the rest of the Metal kernels that no runtime path launches, after #2816. Head 52c867e, base main 3885dce.
What changes (2 commits, one per kernel group; 16 files, +32 −546)
qwen27/prompt_glue.metalandqwen27/prompt_state.metal, as whole files:q27_prompt_product,q27_prompt_silu,q27_prompt_decay,q27_prompt_qk,q27_prompt_conv,q27_prompt_recur.prompt_gpu.Kernelsandprompt_state_gpu.Kernels, whose pipeline fields nothing fills (noKernels{literal for either). Both were kept alive only bytests/qwen27/runtime.zig:16's "force analysis" line.prompt_glue.zigandprompt_state.zig(theConv/RecurABIs and checks) were used only by those two wrappers and their own tests.tests/qwen27/run.zig:37wrote the two sources out asprompt.metal, which nothing reads.prompt_glue.zig,prompt_gpu.zig,prompt_state.zig,prompt_state_gpu.zig, their exports and test refs inqwen27.zig, the two entries inbuild/qwen27.zig:19andruntime_sources/qwen27.zig:6, theprompt.metalwrite inrun.zig:37, and the analysis line.core/shared_attention.metal'stf_lane_ropeandAttention.rotate().src/core/shared_attention.zig:58, dispatched only fromrotate()(:149-165)..rotate(on anAttentionappears only intests/lanes_see.zig:140,176,222. The two runtime users ofshared_attention(gemma4/dflash.zig:112,qwen27/dflash/runtime_backend.zig:80) never call it.Shapelosesrotary_dimandrope(and theRopeenum,TF_RD/TF_INTERLEAVEDdefines): only this kernel read them. Both runtime callers drop.rotary_dim = c.head_dim.masked_attention_more.zig:108already compiled the source without those defines.lanes_see.zigfeeds raw K and Q straight to append and attention; the CPU reference, masks, serial equality and prompt-unchanged checks are unchanged. Its case count halves (no split-half/interleaved loop).ops/sdpa.metal: no Zig host, buttools/zig/check_mlx_ops.pylaunches it against MLX (mlx_op_cases.py:222,mtp_op_cases.py:280). Left alone as asked.kimi/mla.metal: live.native/kimi_metal.zigserveskimi_k3, whoselayer.zig:112sends.mlalayers tomla(), which launchesmla_cache,mla_qlat,mla_mergeandmla_uv(layer.zig:73-78).One visible effect:
qwen27/disk.zig'ssourceHashcoversqwen_runtime_sourcesandkernel_sources, so commits 1 and 2 both move it. Qwen27 prompt states saved to disk before this are recomputed once (as with #2816). Nothing else changes: no launched kernel's source or arguments move, so no token or speed change, and no A/B is needed.Checks
zig buildandzig build test: green (686/686 steps,MUD3-ARM-GREEN).zig build -Dfixed-cpu test test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths,check-native-cuda-host compile-cuda-tests,pr_check.py,zig fmt --check,git diff --checkon 8768267): green. On 52c867e, which only changeszig/runtime_sources/core.zig(built on macOS only) and CHANGELOG.md:zig fmt --check,git diff --checkandpr_check.py --pr 3065(lean 345 vs 345, 0 new) green.-Dcpu=apple_m1, on 8768267,zig build testrerun on 52c867e): native build 285/285 steps.zig build teston 52c867e: 13137 of 13241 tests pass, 103 skipped, 1 fails:dashboard_test"dashboard page polls the public stats snapshot without private details", which fails the same way on main 3885dce.test-qwen27*andtest-kernel-symbols-host22/22 tests;test-lanes-see87 cases pass (max fp32 error 1.04e-6). qwen27 kernel contract: 30 kernels pass gates 1-4 on both, and the branch's output equals main's apart from SUMMARY timings. Full contract with a freshtf-rotary-sweepreceipt (302,008,320 cases): 539 kernels pass gates 1-4, 0 fail, the 3 standing nonfinite findings, 575 of 575 controls red as planted, 0 limit problems.check_mlx_ops.pynot run: the branch touches no MLX-backed kernel (ops/sdpa.metaland the MLX case files are unchanged). On 52c867e the runtime-sources modes test compiles and passes,test-metal-runtime-sources1/1 andemit-metal-runtime-sources7/7 steps; on 8768267 all three stop atcore.zig:49:36(no memberRope).shared_attention.Attention.initcall with.rotary_dim = ...; whichever lands second drops that field (one line).CHANGELOG: line added under Unreleased in this PR, as asked.