Repository navigation
inkling2 metal dspark: match maxThreads guard to kappa (64) and attention (768) - #5041
Conversation
|
This fixes the M5 Max failure I reproduced on main after #4699. On a clean trial merge of zig build test-inkling2-metal-host test-inkling2-launch-map-host -Dfixed-cpu -j2 --summary allLanding this first gives #5020 Igor Lessio - AIFLOW LABS |
|
Thanks @gilby. The required widths now match all eleven shader reservations and the existing dispatches, including kappa at 64 and attention at 768. The shader and arithmetic are unchanged, and the existing load-failure cleanup still covers the pipeline that fails its guard. This looks safe to land through the normal checks.
|
2d7ce3c to
2ded151
Compare
|
Thank you @gilby. 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
Before: after #4981's load-time
maxThreads()guard merged alongside #4699's DSpark overhaul,zig/src/families/inkling2/metal/dspark_kernels.zigstill checked.attention => 128andelse => 256, whilezig/kernels/metal/inkling2/dspark.metaldeclares[[max_total_threads_per_threadgroup(64)]]ontf_ink2_dspark_kappa(dispatched at64) and[[max_total_threads_per_threadgroup(768)]]ontf_ink2_dspark_attention(dispatched at768). EveryPipelines.load/Pipelines.loadSourcecall failed immediately witherror: DsparkThreadsonkappaand under-checkedattention.After:
Kind.requiredThreads()returns.kappa => 64,.block_qkv, .context_kv => 128,.attention => 768, andelse => 256, matchingdspark.metal,inkling2_dspark_metal_records.zig, and the host dispatches.dspark_kernels_test.zigchecksKind.requiredThreads()against the contract records and adds aPipelines.load(device)GPU test (skipping cleanly when no Metal device is present).origin/main(9961ca4920848b84a98ec8eea978437662fd0300), 1 commit (2d7ce3cbb59f3b3e888c8d9d8a749023c596b773, 2 changed files,35 insertions(+), 12 deletions(-)).atc overlap --json:changedFiles: 2,overlaps: [].git merge-tree --write-tree origin/main HEAD:00cc83459119f1d5f934663b7e548fd9022469c2.Checks on this head
2d7ce3cbb59f3b3e888c8d9d8a749023c596b773python3 tools/pr_check.py --base origin/main:merge base 9961ca4920848b84a98ec8eea978437662fd0300; 2 changed files; lean 164 vs 164, 0 new; 0 error(s), 1 warning(s)(advisory--prUnreleased bullet notice;CHANGELOG.mdintentionally left untouched). Touched.zigfiles:dspark_kernels.zig(282lines),dspark_kernels_test.zig(185lines), both<= 600.zig fmt --check build.zig zig— exit0.git diff --check origin/main..HEAD— exit0.Zig 0.17.0, macOS27.0.1):zig build compile-inkling2-native-host— exit0.zig build compile-inkling2-native-host -Dtarget=x86_64-windows— exit0.zig build test-inkling2-host -Dcpu=apple_m1 -Doptimize=ReleaseFast --summary all:45 pass, 4 skip (49 total)— exit0.zig build test-inkling2-metal-host -Dcpu=apple_m1 -Doptimize=ReleaseFast+ binary--seed=0xcc8ea13fon Apple M5 Max (applegpu_g17, tensor unitstrue):110 passed; 6 skipped; 0 failed— exit0(before fix: new test failed109 pass, 6 skip, 1 failwitherror.DsparkThreads;tf-kernel-contract --only "metal inkling2 dspark"also failed witherror: DsparkThreads)../zig-out/bin/tf-kernel-contract --only "metal inkling2"on Apple M5 Max (applegpu_g17, tensor unitstrue):SUMMARY 61 kernels: 61 pass gates 1-4, 0 fail, 0 known findings; 67 controls: 67 red as planted, 0 missed; 0 limit problems; gates 10951 ms, limits 155 ms— exit0.2d7ce3cbb59.n/a— load-timemaxThreads()guard alignment only; zero kernel shader or dispatch-grid changes) and non-Apple GPU backends (Metal-only files).Receipt
error: DsparkThreadsonorigin/main(9961ca4920) caused by the inkling2 metal: match kernel threadgroup reservations and enforce load guards #4981 TG guard + inkling2: rebase DSpark overhaul onto #4465 #4699 DSpark overhaul merge interaction without changing any shader code, dispatch width, or arithmetic.zig/src/families/inkling2/metal/dspark_kernels.zig(Kind.requiredThreads,Pipelines.loadSource) andzig/src/families/inkling2/metal/dspark_kernels_test.zig.2d7ce3cbb59f3b3e888c8d9d8a749023c596b773onorigin/main9961ca4920848b84a98ec8eea978437662fd0300, Zig0.17.0(-Dcpu=apple_m1 -Doptimize=ReleaseFast), Apple M5 Max (applegpu_g17, macOS27.0.1, Metal 4 tensor unitstrue).Pipelines.load/Pipelines.loadSource), plus host tests and Windows/native host compilation checks.n/afor server inference; all 61metal inkling2contract kernels (including all 11 DSpark kernels) pass gates1-4andlimitchecks with0failures.n/a— load-timemaxThreads()guard only.n/a— load-timemaxThreads()guard only.n/a.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled.