Skip to content

hexagon: correct HMX FA sinks - #30581

Merged
jhen0409 merged 2 commits into
ggml-org:masterfrom
jhen0409:wt/hexagon-hmx-fa-sinks
Oct 16, 2026
Merged

jhen0409 merged 2 commits into
ggml-org:masterfrom
jhen0409:wt/hexagon-hmx-fa-sinks

Conversation

@jhen0409

Copy link
Copy Markdown
Member

Overview

Related to my finding in #30218, test-backend-ops -o FLASH_ATTN_EXT was 2541/2604 (63 failed on sinks=1) on single NPU, 2549/2604 on row split.

In this PR:

  • QK output scales: from 16-bit splat / bias = scale to 32-bit splat / bias = 0
  • sinks: l += 2^(sink * log2e - m), move to fa_build_d_diag_inv_l

Additional information

test-backend-ops -o FLASH_ATTN_EXT (IQ-9075)

config master patch
single NPU (HTP0:0), passed 2541/2604 2604/2604
single NPU, failures with sinks=1 63 0
row split (HTP0[0-1]), passed 2549/2604 2604/2604
row split, failures with sinks=1 55 0

No performance regression found. Also tested on gpt-oss 20b mxfp4 (IQ-9075 with NPU, 8-session layer split), prefill KLD vs CPU 0.0410 -> 0.0293.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, Claude Code. The agent also wrote a temp code to verify the NMSE result. I've reviewed and simplified the code.

@jhen0409
jhen0409 requested a review from a team as a code owner October 15, 2026 09:09
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning Hexagon labels Oct 15, 2026
@max-krasnyansky

Copy link
Copy Markdown
Member

Nice. I've been meaning to revisit those accuracy mismatches with sinks. The HVX FA is passing all tests cleanly (you can force it with GGML_HEXAGON_FA_SELECT=1) but the HMX always had a slight mismatch ever since I added the sinks (specifically for better GPT-OSS-20B support). Will check it out on my setups asap.

@max-krasnyansky
max-krasnyansky force-pushed the wt/hexagon-hmx-fa-sinks branch from f27115c to 7cb3a89 Compare October 16, 2026 05:24
@max-krasnyansky

Copy link
Copy Markdown
Member

Vectorized sinks logic and removed register spills.
Looks good to me. And we're passing all FA tests now.
@lhez for another ack

@jhen0409
jhen0409 merged commit ceefd16 into ggml-org:master Oct 16, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning Hexagon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants