Repository navigation
hexagon: Op Fusion refactoring, optimizations and new fusions like BINARY_NX (back-to-back ADDs, etc) - #30843
Merged
Merged
Conversation
max-krasnyansky
force-pushed
the
hexagon-opfusion-v2
branch
2 times, most recently
from
October 20, 2026 22:32
1247e27 to
7b74bb4
Compare
max-krasnyansky
force-pushed
the
hexagon-opfusion-v2
branch
from
October 21, 2026 05:10
a3d6aea to
ea50374
Compare
…-to-back ADD/MUL/...)
…ate all related code
max-krasnyansky
force-pushed
the
hexagon-opfusion-v2
branch
from
October 21, 2026 14:54
ea50374 to
545e398
Compare
ebateni
added a commit
to ebateni/llama.cpp
that referenced
this pull request
Oct 22, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-krasnyansky
marked this pull request as ready for review
October 22, 2026 06:41
Member
Author
|
@lhez for review and ack |
lhez
approved these changes
Oct 22, 2026
Merged
jhen0409
approved these changes
Oct 23, 2026
danielhanchen
added a commit
to unslothai/llama.cpp
that referenced
this pull request
Oct 23, 2026
- ggml-hexagon.cpp: upstream replaced the per-op supports_op switch with htp_kparams_check() (ggml-org#30843); the page-table refusal is re-applied as a FLASH_ATTN_EXT case in the new switch, refusing src[5] before the kparams check - tests/CMakeLists.txt: upstream's behavior labels (ggml-org#31036) kept; the pin's tests added beside them with their labels unchanged
edwardyoon
pushed a commit
to edwardyoon/focus-llama
that referenced
this pull request
Oct 24, 2026
…INARY_NX` (back-to-back ADDs, etc) (ggml-org#30843) * hex-fusion: support for GELU+MUL, REPEAT+GET_ROWS and BINARY_NX (back-to-back ADD/MUL/...) * hex-fusion: factor out fusion logic into separate .h and .cpp and update all related code * hex-fusion: allow for RMS_NORM+MUL fusions for non-contig tensors * hex-fusion: streamline fusion eligibility checks and cover missing corner cases * hex-fusion: streamline fusion flow * hex-opbatch: make n_tensors limit more scalable * hex-bufs: adjust the trace buff sizing * hex-glu: cleanup glu-ops interfaces and add kernel_params * hex-kparams: clean up kparams handling in unary, ssm-conv, and other ops * hex-kparams: update the rest of the ops PAD,DIAG,... to use kparams * hex-unary: add support for collapsing dims * hex-ops: cleanup redundant runtime checks * hex-ops: consistent use of kernel_type in all kparams * hex-fusion: remove redundant check in gdn+cpy * hex-fusion: further streamlining of fusion rules and code * hex-fusion: cleanup naming * hex-opfmt: cleanup op formatting * hex-fusion: bump fusion lookahead to 64 * hex-fusion: fuse SSM_CONV+SILU * hex-fusion: fix hvx register spills in fused ssm_conv+silu * hex-fusion: add more GLU fusions * hex-fusion: remove duplicate checks and use ggml-common helpers * hex-kparams: refactor kparams into htp-kparams.h/cpp * hex-fusion: fix binary-nx fusion regression * hex-kparams: another pass at cleaning up kparams (removing unused, etc) * hex-kparams: streamling nameing and move _check_ wrappers into .h * hex-kparams: templetize htp_kparams_check_<op> to reduce code bloat * hex-ops: de-duplicate op dispatch switches * hex-kparams: trim down exposed kparams calls * hex-kparams: simplify type casting of kparams structs * hex-fence: de-dup fence tensor construction * hex-opbatch: simplify tensor shape init/checks * hex-mm: cleanup leftovers of the original QK defines * hex-fa: fix stack overflow on older npu firmware * hex-ctx: move dma_caches into ops_ctx
auRose94
pushed a commit
to auRose94/llama.cpp
that referenced
this pull request
Oct 28, 2026
…INARY_NX` (back-to-back ADDs, etc) (ggml-org#30843) * hex-fusion: support for GELU+MUL, REPEAT+GET_ROWS and BINARY_NX (back-to-back ADD/MUL/...) * hex-fusion: factor out fusion logic into separate .h and .cpp and update all related code * hex-fusion: allow for RMS_NORM+MUL fusions for non-contig tensors * hex-fusion: streamline fusion eligibility checks and cover missing corner cases * hex-fusion: streamline fusion flow * hex-opbatch: make n_tensors limit more scalable * hex-bufs: adjust the trace buff sizing * hex-glu: cleanup glu-ops interfaces and add kernel_params * hex-kparams: clean up kparams handling in unary, ssm-conv, and other ops * hex-kparams: update the rest of the ops PAD,DIAG,... to use kparams * hex-unary: add support for collapsing dims * hex-ops: cleanup redundant runtime checks * hex-ops: consistent use of kernel_type in all kparams * hex-fusion: remove redundant check in gdn+cpy * hex-fusion: further streamlining of fusion rules and code * hex-fusion: cleanup naming * hex-opfmt: cleanup op formatting * hex-fusion: bump fusion lookahead to 64 * hex-fusion: fuse SSM_CONV+SILU * hex-fusion: fix hvx register spills in fused ssm_conv+silu * hex-fusion: add more GLU fusions * hex-fusion: remove duplicate checks and use ggml-common helpers * hex-kparams: refactor kparams into htp-kparams.h/cpp * hex-fusion: fix binary-nx fusion regression * hex-kparams: another pass at cleaning up kparams (removing unused, etc) * hex-kparams: streamling nameing and move _check_ wrappers into .h * hex-kparams: templetize htp_kparams_check_<op> to reduce code bloat * hex-ops: de-duplicate op dispatch switches * hex-kparams: trim down exposed kparams calls * hex-kparams: simplify type casting of kparams structs * hex-fence: de-dup fence tensor construction * hex-opbatch: simplify tensor shape init/checks * hex-mm: cleanup leftovers of the original QK defines * hex-fa: fix stack overflow on older npu firmware * hex-ctx: move dma_caches into ops_ctx
1 task done
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.
Overview
Another round of overdue cleanup and refactoring.
ggml-hexagonops collection have been growing and we've accumulated lots of duplicate logic and special cases.This PR cleans most of that up. Lots of changes but mostly refactoring and de-dup.
Added/expanded op fusion infrastructure: new
htp-fusion.{h,cpp}, fusion logic pulled out of ggml-hexagon.cpp, withnew fusions for GELU+MUL, REPEAT+GET_ROWS, BINARY_NX chains, RMS_NORM+MUL, SSM_CONV+SILU, and more GLU variants.
Complete refactoring of Kernel Params : new
htp-kparams.{h,cpp}, less exposed API, templated/check wrapper cleanup, fewer casts, and wider use across UNARY, GLU, SSM_CONV, PAD, DIAG, etc.Simplified op dispatch and batching, de-duplicated op dispatch switches
Reworked GLU/UNARY op plumbing:
act-ops.crenamed intoglu-ops.c, addedglu-ops.h, broader kernel param use, unary dim collapsing, and cleaner op formatting/runtime checks.Flash Attention fixes: large FA scratch state moved off small callback-thread stacks into DDR scratch, and moved DMA caches into
htp_ops_contextso FA no longer stores those cache structs on stack.Additional information
New fusions improve performance across the board in 20-30% range.
Tested on all supported platforms: single-NPU v73...v85 and dual-NPU v73, quad-NPU v81.
Requirements