Skip to content

metal: Nemotron's expert up and down kernels from one source each (#2251) - #4738

Merged
ashhart merged 2 commits into
ashhart:mainfrom
jschmied:dedup-2251-nemotron-expert
Nov 23, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
jschmied:dedup-2251-nemotron-expert

Conversation

@jschmied

Copy link
Copy Markdown
Contributor

Part of #2251 (group: nemotron_expert_{up,down}). Head b83b26a, one commit on main b192eaa.

What changes

  • tensorfold.metallib compiled zig/kernels/metal/nemotron_expert_up.metal and nemotron_expert_down.metal. They were byte copies of nemotron/expert_up.metal and nemotron/expert_down.metal, apart from the first comment line (which named a generator that no longer exists).
  • The two top-level copies are deleted. zig/build/metal_source_lists.zig now lists the nemotron/ files, which the Nemotron host already embeds (nemotron/kernels.zig:86-87).
  • No kernel name, signature, source text or host code changes. 3 files, +2 −173.

Core vs backend-only: no core code; build list (zig/build/metal_source_lists.zig) and Metal sources only.

Same bits (M3 Pro, macOS 27.2, metal 32023.921, Zig 0.17.0; main b192eaa against this head)

  • IR: expert_up and expert_down compiled with -std=metal4.1 -S -emit-llvm, under the metallib's flags (safe, fp32 fast) and the nemotron_fastmath control's (fast): all 4 identical, 2 functions each in the same order. Only ModuleID, source_filename and the source path differ.

  • The metallib itself: zig build metallib gives a byte-identical tensorfold.metallib on both arms (md5 906cd638db46a69cb1fabc6b21d11e3e); metal-nm lists the same 9 functions.

  • Kernel contract, tf-kernel-contract --only nemotron, main and head: 67 kernels: 67 pass gates 1-4, 0 fail, 1 known findings; 29 controls: 29 red as planted, 0 missed; 0 limit problems, line for line the same except timings.

  • Family checks: test-kernel-symbols-host test-nemotron-experts-contract-host tf-nemotron-experts: 72/72 steps, 15/15 tests; tf-nemotron-experts (no weights needed): every kernel's bits equal the engine's, rows exact.

  • Served hash: not run. The served kernels' compiled IR, and the whole metallib, are identical, so no reply can change. For the same reason no seeded, resume, concurrency or refusal checks against main: no served path changes.

  • x86 CI green on a merge of this head with three sibling metal: unify duplicated kernels (attention partials, norms, gemm_nax wrappers, glue, RoPE) #2251 groups: merge 72b153f490 of b83b26a, a3e5359, 478fcb6 and ebf6db7 on main b192eaa (the groups touch separate files, apart from separate hunks of sources.zig in the copy and vision groups). zig build -Dfixed-cpu test-host test test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths: 2431/2431 steps, 16239/16350 tests (111 skipped); check-native-cuda-host compile-cuda-tests 17/17; zig fmt --check and git diff --check clean. pr_check and lean flagged one new multi-line comment in the prompt-pick group's core/prompt_pick.metal; on the merge with that one-line fix (16ea8fe6e4, prompt pick at 7cd71d9): pr_check 0 errors, lean 165 vs 165 on main, 0 new.

Proposed CHANGELOG line (for you to place):

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

jschmied and others added 2 commits November 23, 2026 16:04
…hhart#2251)

tensorfold.metallib compiled top-level copies of nemotron/expert_up.metal and expert_down.metal that differed
only in their first comment line. The metallib now compiles the nemotron/ files that the Nemotron host embeds.
@ashhart
ashhart force-pushed the dedup-2251-nemotron-expert branch from b83b26a to f34cbb0 Compare November 23, 2026 16:04
@ashhart
ashhart merged commit 7b851b2 into ashhart:main Nov 23, 2026
8 of 12 checks passed
@ashhart

ashhart commented Nov 23, 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 to Bizuayeu/TensorFold that referenced this pull request Nov 23, 2026
ashhart added a commit that referenced this pull request Nov 23, 2026
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