Repository navigation
metal: Flash Next's rotary scalar from fn_rotary_scalar.metal in the three prompt libraries that copied it (#2251) - #5061
Merged
Conversation
Owner
|
Thank you @jschmied. The three assembled libraries are byte-identical, and each still contains the exact scalar text once for the rotary-cache replacement. No arithmetic or caller change remains open. This looks ready to land through the usual checks. Thank you for keeping the hash-named copies separate.
|
…three prompt libraries that copied it (ashhart#2251) fn_select, fn_pool_pos and fn_mrope each carried fn_rotary_scalar.metal's text verbatim. They now include it, and sources.zig puts the file in at that line, so the assembled libraries are byte-identical to before.
ashhart
force-pushed
the
dedup-2251-rotary-scalar
branch
from
November 25, 2026 16:29
3d6950a to
1a6e989
Compare
ashhart
added a commit
that referenced
this pull request
Nov 25, 2026
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. |
Merged
1 task done
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:
tf_rotary_scalar). Head 3d6950a, one commit on main 0a5c699.What changes
prefill/fn_select.metal,fn_pool_pos.metalandfn_mrope.metaleach carriedfn_rotary_scalar.metal's text verbatim (theTF_RotaryScalarstruct andtf_rotary_scalar).#include "fn_rotary_scalar.metal"in its place.sources.zig'swithRotaryScalarputs the file in at that line at comptime, assources.drama3.codecdoes for its include, because the runtime compiler has no include path.flashnext_select,flashnext_pool_posandflashnext_mropeare byte-identical to main's.rotary_cache.zig:23needs no change: it still findsflashnext_rotary_scalar's text exactly once in each of them.q4_attn_prep_*andq4_idx_pool_*copies stay as recorded.Core vs backend-only:
prefill/fn_rotary_scalar.metalwas already the shared Metal piece (the rotary cache and sweep use it); only Flash Next's Metal sources and their assembly change. No CUDA files.Same bits (M3 Pro, no tensor units; macOS 27.2, metal 32023.921, Zig 0.17.0; main 0a5c699 against this head)
Source text:
emit-metal-runtime-sourceswithout tensor units (1044 files) and with them (1070), andemit-qwen4-metal-sources(81):diff -rmain against this head, 0 files differ. Every assembled library is byte-identical, so no IR step was needed.Kernel contract,
tf-kernel-contract --only, main = head (logs identical apart from timings): flashnext rotary 10 pass gates 1-4, 0 fail, 0 limit problems; flashnext vision 3 pass, 0 fail, 0 limit problems.Family checks:
test-flashnext-rotary-bound-host test-flashnext-vision-contracts-host test-flashnext-precise-host test-flashnext-bound-probes-host test-rotary-sweep-host test-kernel-symbols-hoston the Mac: 21/21 steps, 79/79 tests. On Linux arm64,test-flashnext-rotary-bound-host test-flashnext-vision-contracts-host: 7/7 steps, 33/33 tests.Served hash: not run. The compiled texts are byte-identical, so no reply can change; for the same reason no seeded, resume, concurrency or refusal checks against main.
x86 CI green on a merge of this head with two sibling metal: unify duplicated kernels (attention partials, norms, gemm_nax wrappers, glue, RoPE) #2251 groups: merge e239bd5c70 of cbcadb0 (stream_rinv), 3d6950a (rotary scalar) and 36cd5f9 (quantized embed) on main 0a5c699.
zig build -Dfixed-cpu test-host test test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths: 2622/2622 steps, 27591/27761 tests (170 skipped);check-native-cuda-host compile-cuda-tests21/21;zig fmt --checkandgit diff --checkclean. pr_check on this head alone: 0 errors, lean 164 vs 164 on main, 0 new.Proposed CHANGELOG line (for you to place):