Repository navigation
metal: the image steps' threadgroup sums and the bf16 bias from the vision glue (#2251) - #5047
Merged
Merged
Conversation
Owner
|
Thank you @jschmied. The seven reduction helpers and both bias bodies keep their existing arithmetic. Qwen-VL's thread reservation and the bias rounding are retained, and the revised OCR control still matches once. This looks ready to land through the usual checks. The compiler evidence and the limits of the chip coverage are recorded.
|
…ision glue (ashhart#2251) Qwen-Image's qi_sum, MOSS-Image's mi_sum, Unlimited-OCR-2's uv_sum, ud_sum and ud_max, Idol's id_sum and DINOv3's dn_sum were copies of vision_glue.metal's tf_vis_sum and tf_vis_max. Those libraries now start with the vision glue and call its helpers; vision_glue.metal includes metal_stdlib itself, so the OCR libraries, which have no template ahead of it, compile it too. GLM's glmv_bias and Qwen-VL's qwv_bias had the same body, bf16(y + b) after the rounded product: both come from TF_VIS_BIAS, qwv_bias keeping its 256-thread reservation. Kernel names and signatures are unchanged.
ashhart
force-pushed
the
dedup-2251-vision
branch
from
November 25, 2026 16:28
0814748 to
48ef65c
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 jschmied/TensorFold
that referenced
this pull request
Nov 25, 2026
ashhart
added a commit
that referenced
this pull request
Nov 25, 2026
ashhart
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 25, 2026
ashhart
added a commit
that referenced
this pull request
Nov 25, 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: the vision sums and bias). Head 0814748, one commit on main 0a5c699.
What changes
prefill/vision_glue.metal'stf_vis_sumandtf_vis_max:qi_sum, MOSS-Image'smi_sum;uv_sum(image encoder),ud_sumandud_max(decoder);id_sum, DINOv3'sdn_sum.tf_vis_sum/tf_vis_max.vision_glue.metalnow includesmetal_stdlibitself, so it can also head the two OCR libraries, which have no template ahead of it.glmv_biasand Qwen-VL'sqwv_biashad the same body,bf16(y + b)after the rounded product. Both come fromTF_VIS_BIAS(NAME)in the vision glue;qwv_biaskeeps itsmax_total_threads_per_threadgroup(256).s5v_biasanduv_biascheck bounds, anduv_biasandmi_biasround once from fp32 sums.*_bfone-liners stay: MOSS-Image's planted controls edit text that namesmi_bf.metal_uocr_vision.zig'snorm_mean_over_threadsnameduv_sum. Its line alone now also matches the vision glue's LayerNorm macro in the assembled OCR source, so the edit includes the line before; it still matches once and still goes red.Core vs backend-only: the shared Metal piece is
prefill/vision_glue.metal(already shared by the four towers and Inkling 2's image tower); the rest is each family's Metal source and its assembly insources.zig. 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)
IR,
-std=metal4.1 -S -emit-llvmunder each library's flags, fromzig build emit-metal-runtime-sourceswith and without tensor units. Idol, DINOv3, MOSS-Image, Qwen-Image and both OCR libraries were assembled throughfrags.source, as this Mac compiles them.inkling2/vision_sources.zig, which also starts withvision_glue.metal), throughfrags.sourceas its loader and contract compile it: 85 functions without tensor units, 84 with, identical.Kernel contract,
tf-kernel-contract --only, main = head (logs identical apart from timings):norm_mean_over_threads; 0 limit problems;Family checks:
test-contract-images-host test-qwen-vision-weights-host test-glm-image-cache-host test-gemma4-tower-host test-vision-cli-host test-kernel-symbols-host test-inkling2-controls-host test-inkling2-metal-host, the MOSS-Image rotary, teacher and generate host tests, andtest-idol-cuda-host: 54/54 steps, 322/328 tests (6 skipped).test-inkling2-media-metal(the tower on this GPU): 24/27 (3 skipped) on head and main.test-uocrdoes not compile on main 0a5c699 either (std.mem.zeroesinuocr/serve.zig), so it is not in this list.Served hash: not run. Every served library's IR is identical, so no reply can change; for the same reason no seeded, resume, concurrency or refusal checks against main.
x86 CI green on this head:
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, 26970/27137 tests (167 skipped);check-native-cuda-host compile-cuda-tests21/21; pr_check 0 errors; lean 164 vs 164 on main, 0 new;zig fmt --checkandgit diff --checkclean.Proposed CHANGELOG line (for you to place):