Repository navigation
inkling2 vision: run the tower's two fp32 attention dots on 64 x 64 tiles, same bytes - #5119
Conversation
|
Thank you @BlivionIaG for the unusually careful exactness coverage. The staging maps both NT and NN operands into complete 16-step chunks, guards every ragged edge, and preserves one scalar FMA chain from zero in ascending k order for each output. The barriers protect prefetch/staging reuse, the I credit the supplied M4 Pro and M5 Ultra original-checkpoint tower hashes, equal greedy replies, contract summaries and faster cold-first-token samples as your evidence. It is ready for our device check. The remaining qualification is one Apple M3 Ultra cell with the same pinned original Inkling 2 Mini revision: pass the NT/NN bit tests and complete vision contract with the dropped-last-k control red, then compare main and the resolved candidate on the same five serial image prompts. Require equal tower hashes and greedy token hashes, plus an alternated cold-first-token no-slower check. No source correction is requested.
|
- q k^T and p v ran one thread an output; a 64 x 64 tile a group and 4 x 4 outputs a thread, operands staged through threadgroup memory, make them several times faster. - Every output is still one fma chain over k from zero, so the tower's output is bit-for-bit what it was: a device test now checks both kinds bit for bit against that chain, and a planted control drops the last k. - The launch record declares the 8.7 KB of threadgroup memory.
de5952a to
9b97a14
Compare
|
Thank you @BlivionIaG. 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. |
What this changes
The Inkling 2 Mini image tower's two fp32 attention dots (q k^T and p v,
ik2_gemm_f32_nt_*/ik2_gemm_f32_nn_*) ran one thread an output. They now run a 64 x 64 output tile a threadgroup and 4 x 4 outputs a thread, with operands staged through threadgroup memory in 16-step k chunks. Each output is still one fma chain over k from zero, in k order, so the tower's bytes do not change; the first token of an image prompt gets faster. This is the tile change promised in #4704, ported from #4337 (a305edd706) ontovision_gemm.metal.69b1fdf59b; one commit,de5952ae11.atc overlap --json: not run (no ATC session on this machine);gh pr listshows no open pull request touchingzig/kernels/metal/inkling2/vision_gemm.metal.Files:
vision_gemm.metal(the tiled dot),metal/vision_gemm.zig(dispatch by groups),inkling2_vision_metal_records.zig(declares the 8,704 bytes of threadgroup memory),metal/vision_test.zig(a device test: both kinds bit for bit against a host@mulAddchain, batched with padded pitches and strides, whole and ragged tiles),metal_inkling2_vision_controls.zig+metal_inkling2_vision.zig(a planted control that drops the last k).Checks on this head
de5952ae11.python3 tools/pr_check.py --base 69b1fdf59b: 0 errors, 4 advisory warnings: no--prnumber yet, three inherited import cycles).zig fmt --check build.zig zig: clean.zig build test-inkling2-media-metalwith the original checkpoint (TF_INKLING2_METAL_DIR): pass on both (M4 Pro: 26 pass, 2 skip, 0 fail on the stacked head; the skips are the JPEG tests, libjpeg-turbo here is not the pinned 3.1.4.1).zig build test-kernel-contract: pass.tf-kernel-contract --only "inkling2 vision"(see Kernel contract).zig build test test-golden; M1 to M3 (no such Mac here); CUDA and HIP (not touched).Receipt
serve --vision --context 8192 --parallel 1 --no-drafts --prompt-cache-gib 0 --no-thinking, cold first token of each picture (max_tokens1), then greedy 48-token replies on five pictures.--vision. Text-only prompts do not run the tower.69b1fdf59b, headde5952ae11; Zig 0.17.0, Xcode's Metal toolchain; Apple M4 Pro 48 GB and Apple M5 Ultra;thinkingmachines/Inkling-2-Mini@ed40e7da625f594fc9c4990f5f66be24873c22d7;-Doptimize=ReleaseFast.inkling2 image tower: ... sha256=log line) is equal main against branch for all five PNG pictures in every session, and the five greedy replies' hashes are equal (M5 Ultra and M4 Pro). The device test checks every output bit against the serial fma chain.M4 Pro load average 4.3 before and 2.5 after the run (a shared machine; the order cancels drift). Tower hashes differ between the two chips (the M5 projections run on tensor units), and within each chip main equals the branch.
Kernel contract
ik2_gemm_f32_nt_{00,01,10,11}andik2_gemm_f32_nn_*records now declare 8,704 threadgroup bytes; the kernel they replace is the one-thread-an-output dot of the same names.control: metal inkling2 vision ik2_gemm_f32_nt drops the last k, red as planted on both chips.tf-kernel-contract --only "inkling2 vision", exit 0:SUMMARY 13 kernels: 13 pass gates 1-4, 0 fail, 0 known findings; 12 controls: 12 red as planted, 0 missed; 0 limit problemsSUMMARY 13 kernels: 13 pass gates 1-4, 0 fail, 0 known findings; 11 controls: 11 red as planted, 0 missed; 0 limit problems(the 8x8 small-row control runs only without tensor units)Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Unchanged: the tower's bytes are equal.)