fix(sdk): prefetch the right weight chunk in batched F16 HMX matmul - #1505
Open
Tadayuki Okada (TadayukiOkada) wants to merge 1 commit into
Open
Tadayuki Okada (TadayukiOkada) wants to merge 1 commit into
Tadayuki Okada (TadayukiOkada) wants to merge 1 commit into
Conversation
The batched F16 HMX matmul (GQA broadcast) prefetched the second weight chunk from one row past the first chunk instead of from the next chunk, so the second chunk's output was wrong whenever the weights span more than one chunk. Signed-off-by: Tadayuki OKADA <TadayukiOkada@users.noreply.github.com>
12 of 13 tasks
Tadayuki Okada (TadayukiOkada)
marked this pull request as ready for review
October 2, 2026 22:25
This branch has not been deployed
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.
Summary
sdk/patches/llama-hexagon-hmx-f16-batched-prefetch.patch: one-line fix in ggml-hexagonhmx_mm_f16_f32_batched. With GQA broadcast (F16 weights, r2 > 1) the second weight chunk was prefetched fromweight_group + weight_stride(one row past the first chunk) instead ofweight_group + n_chunk_n_cols * weight_stride. The output of the second chunk was wrong whenever the weights span more than one chunk.Test plan
test-backend-ops -o MUL_MATon a v73 dev kit with a regression case (m 3072, n 512, k 128, bs [8,1], nr [2,1]): fails without the fix, passes with it (upstream llama.cpp 876c75b1f: 763/764 -> 764/764)🤖 Generated with Claude Code