Fix qd8_f16_qb4w GEMM config getter always returning NULL on Arm#10537
Open
outum1500 wants to merge 1 commit into
Open
Fix qd8_f16_qb4w GEMM config getter always returning NULL on Arm#10537outum1500 wants to merge 1 commit into
outum1500 wants to merge 1 commit into
Conversation
xnn_init_qd8_f16_qb4w_gemm_config() gated its return on qd8_f16_qb4w_gemm_config.arch, but init_qd8_f16_qb4w_gemm_config() never assigns .arch on any branch (it sets only mr/nr/log2_kr/planes/dqgemm). On Arm this makes the getter always return NULL, so every QD8/F16/QB4W fully-connected op fails runtime creation with xnn_status_unsupported_hardware once the convert -> fully_connected packed-LHS path requests it. Return the config unconditionally, matching the sibling getters xnn_init_qd8_f16_qc4w_gemm_config() and xnn_init_qd8_f32_qb4w_gemm_config(), which likewise do not set .arch. Tested on Apple M4: a QD8/F16/QB4W linear that previously aborted at runtime creation with unsupported_hardware now runs to completion.
dsharlet
reviewed
Jun 19, 2026
| return NULL; | ||
| } | ||
| XNN_INIT_ONCE(qd8_f16_qb4w_gemm); | ||
| return qd8_f16_qb4w_gemm_config.arch ? &qd8_f16_qb4w_gemm_config : NULL; |
Collaborator
There was a problem hiding this comment.
Shouldn't we set arch, rather than ignoring it?
I think this is only used on x86 to do the qdu8 rewrite, but I'd rather not guess...
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.
Problem
On Arm, every
QD8/F16/QB4Wfully-connected op fails at runtime creation withxnn_status_unsupported_hardware, even though the microkernels are built and the hardware supports FP16 (reproduced on Apple M4:hw.optional.arm.FEAT_FP16=1, hardware config reportsneon_fp16_arith/neon_dot/neon_i8mm).Root cause
xnn_init_qd8_f16_qb4w_gemm_config()ends with:but
init_qd8_f16_qb4w_gemm_config()never assigns.archon any branch (it sets onlymr/nr/log2_kr/planes/dqgemm). Soqd8_f16_qb4w_gemm_config.archstays0and the getter always returnsNULLon Arm.This stays hidden until the
convert -> fully_connectedpacked-LHS path setsXNN_FLAG_INLINE_LHS_PACKING;setup_variant_and_gemm_config()then receives aNULLgemm config and returnsxnn_status_unsupported_hardware, aborting runtime creation.The sibling getters
xnn_init_qd8_f16_qc4w_gemm_config(),xnn_init_qd8_f16_qc8w_gemm_config()andxnn_init_qd8_f32_qb4w_gemm_config()return their config unconditionally and likewise do not set.arch.qd8_f16_qb4wis the only one in this family carrying a stray.archguard.Fix
Return the config unconditionally, matching the sibling getters.
Test
On Apple M4, a
QD8/F16/QB4Wlinear model that previously aborted at runtime creation withunsupported_hardwarenow runs to completion. Theqd8_f32_qb4w,qd8_f16_qc4wandqd8_f16_qc8wpaths are unchanged.