Repository navigation
metal: Nemotron's expert up and down kernels from one source each (#2251) - #4738
Merged
Merged
Conversation
…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
force-pushed
the
dedup-2251-nemotron-expert
branch
from
November 23, 2026 16:04
b83b26a to
f34cbb0
Compare
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
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.
Part of #2251 (group:
nemotron_expert_{up,down}). Head b83b26a, one commit on main b192eaa.What changes
tensorfold.metallibcompiledzig/kernels/metal/nemotron_expert_up.metalandnemotron_expert_down.metal. They were byte copies ofnemotron/expert_up.metalandnemotron/expert_down.metal, apart from the first comment line (which named a generator that no longer exists).zig/build/metal_source_lists.zignow lists thenemotron/files, which the Nemotron host already embeds (nemotron/kernels.zig:86-87).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 thenemotron_fastmathcontrol'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 metallibgives a byte-identicaltensorfold.metallibon both arms (md5 906cd638db46a69cb1fabc6b21d11e3e);metal-nmlists 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.zigin 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-tests17/17;zig fmt --checkandgit diff --checkclean. pr_check and lean flagged one new multi-line comment in the prompt-pick group'score/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):