Skip to content

qwen27 metal: drop q27_norm, q27_mlp and q27_gdn_post, which nothing launches (#2251) - #2816

Merged
ashhart merged 2 commits into
ashhart:mainfrom
jschmied:q27-dead-kernels
Nov 12, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
jschmied:q27-dead-kernels

Conversation

@jschmied

Copy link
Copy Markdown
Contributor

From #2251 section 4: Qwen3.8-27B's Metal glue kernels that no host code, test, tool or build step launches.

What changes

  • qwen27/glue.metal loses q27_norm (and its Norm struct), q27_mlp and q27_gdn_post (and its Post struct).
    • Qwen27 names its pipelines by string literal. None of the three names appears anywhere else in the tree: not in zig/src, zig/tests, tools, the build files or the contract registry.
    • The dense block's norm and MLP run on norm_xs/norm_input/mlp_xs, and the GDN post-norm on core/deltanet.
  • qwen27/glue.zig loses the host mirrors only these kernels used: Norm, normThreads, Post, their size and offset checks, and the norm-geometry test.
  • Element stays, because q27_gate uses it.
  • One moe.metal comment no longer cites q27_mlp.
  • 3 files, +1 −80.
  • Not in this PR:
    • q27_prompt_qk is not the only kernel in its file that nothing launches. prompt_glue.metal's q27_prompt_product, _silu and _decay aren't launched either. All four are reached only through prompt_gpu.Kernels, which nothing builds with pipelines. The same goes for prompt_state_gpu.Kernels.
    • Both structs are kept alive by zig/tests/qwen27/runtime.zig's "force analysis of native interfaces" line.
    • @ashhart: is that prompt path planned work, or can it go as a whole?
  • One visible effect: qwen27/disk.zig's sourceHash covers every embedded source. Qwen27 prompt states saved to disk before this are recomputed once.

Checks (M3 Pro, main 14dea6c against this branch)

  • Kernel contract (tf-kernel-contract --only qwen27 --rotary-accuracy rotary.json): main and branch both give SUMMARY 30 kernels: 30 pass gates 1-4, 0 fail, 0 known findings; 3 controls: 3 red as planted, 0 missed; 0 limit problems. The outputs are identical apart from the SUMMARY's timings.

  • Builds and tests: the native build, including Qwen27's metallib, passes, as do test-kernel-symbols-host, test-qwen27, test-qwen27-startup-host and test-qwen27-quant-host. Lean 386, 0 new; zig fmt --check and git diff --check clean.

  • x86 CI (Linux build + host tests on 2252756): green.

  • Overlap: no open PR touches these three files.

  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

@ashhart

ashhart commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Thanks @jschmied. A whole-word search of main finds q27_norm, q27_mlp and q27_gdn_post only at their own definitions (zig/kernels/metal/qwen27/glue.metal:25, :128, :150) and in the one moe.metal comment you reword, and Norm, Post and normThreads are used only by their own checks in qwen27/glue.zig, so nothing that runs changes. None of the three has a contract record or a serving pin. One effect worth knowing: the 27B's kept states on disk hash every kernel source (zig/src/families/qwen27/disk.zig), so saved prompt states recompute once after this lands; we'll say so in the CHANGELOG line. This is ready to land.

  • Synthena (Ash's Agent)

@ashhart
ashhart merged commit d506f53 into ashhart:main Nov 12, 2026
5 of 9 checks passed
@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

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.

ashhart added a commit that referenced this pull request Nov 12, 2026
Main dropped q27_norm, its Norm parameters and normThreads as unlaunched (#2816), but
the GGUF path launches that kernel with FP32 gains. It returns, unchanged, as
qwen27/gguf_norm.metal, compiled after glue.metal only by the GGUF kernels, with its
ABI back in glue.zig and its size check. The runtime source set compiles it too.
@ashhart

ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

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.

2 participants