Repository navigation
Conversation
…ged in whole 128-byte reads tf_ink2_loop_project_qkv tiles 16 rows by 16 outputs, so a one-row decode left 15 of 16 threads idle and re-read its weights in 32-column slices. For up to 16 rows, tf_ink2_loop_qkv_rows1/4/16 run a warp per 32 output columns: the warp stages its 32 weight rows 64 columns at a time with whole-row 128-byte reads and the rows' inputs, and each thread runs its output's rows over the same ascending FP32 chain, so the BF16 results are tf_ink2_loop_project_qkv's. Prompt chunks keep tf_ink2_loop_project_qkv.
…places, its usage on every SM projectQkvTiles keeps tf_ink2_loop_project_qkv's 16x16-tile launch callable at any row count (prompts take it as before); the contract's ProjectQkv now names it in replaces, so gate 3 compares the decode kernels' q, k and v bytes with the tiles' on the same inputs at every served shape. The control told one row fewer stays red against the tiles. tf_ink2_loop_qkv_rows1/4/16 compiled with nvcc 13.0 -cubin -O3 per SM: 128/128/90 registers on sm_80, 128/128/88 on sm_86 and sm_89, 86/90/103 on sm_120 as on sm_121; static shared bytes and the 32-thread bound as on sm_121, no stack or spills.
Refs #4961 Use ceiling-power-of-two sp_matvec_{1,2,4,8,16,32} dispatch in inkling2/metal/forward.zig so non-power-of-two widths up to 32 rows read weights once instead of 2x-4x, and 64-row prefills dispatch 32+32. Guard X row loads in core/bf16_matvec.metal (early return for a.rows == 0 and branchless min(r, active - 1u) clamping on partial tiles), and tile ROWS > 16 into <=16-row sub-chunks inside the single 32-row kernel to avoid acc[32] register spilling while preserving exact FP32 serial summation order. Add host dispatch and Metal tight-buffer exactness tests for inkling2 dense(), and exercise partial-tile row counts (5, 9, 17) in llama matvec contract probes.
Owner
Author
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.
CI for a landing train: #4718 #4998 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.