Skip to content

Add Qd8 bf16 qb4w subgraph for fully connected#10818

Open
JakeStevens wants to merge 3 commits into
google:masterfrom
JakeStevens:qd8-bf16-qb4w-subgraph-fc
Open

Add Qd8 bf16 qb4w subgraph for fully connected#10818
JakeStevens wants to merge 3 commits into
google:masterfrom
JakeStevens:qd8-bf16-qb4w-subgraph-fc

Conversation

@JakeStevens

Copy link
Copy Markdown
Contributor

Summary

Previous PR added support for some microkernels and a f32->bf16 rewrite, but did not add the subgraph, this PR completes an initial FC bring up

Test Plan

cmake -B build-test -DCMAKE_BUILD_TYPE=Release \
        -DXNNPACK_BUILD_TESTS=ON -DXNNPACK_BUILD_BENCHMARKS=OFF
cmake --build build-test --target fully-connected-test -j"$(nproc)"
./build-test/test/subgraph/fully-connected-test --gtest_filter='*QD8BF16QB4W*'
  Expected:
  [ RUN      ] FullyConnectedQD8BF16QB4W_BF16.static_b
  [       OK ] FullyConnectedQD8BF16QB4W_BF16.static_b (501 ms)
  [  PASSED  ] 1 test.

Covers the new fc_type_qd8_bf16_qb4w path (f32 activation -> qdint8 convert
-> blockwise int4 weight -> bf16 output, bf16 scales). Only a _BF16 (bf16
scale) variant since there is no qd8_bf16_qb4w_f16_scales create function.
@JakeStevens
JakeStevens force-pushed the qd8-bf16-qb4w-subgraph-fc branch from bf8a7c1 to c019fab Compare July 23, 2026 13:27
… failure

TestStaticB and the dynamic-quant test only skipped on
xnn_status_unsupported_hardware; any other CreateRuntime failure fell
through and called xnn_reshape_external_value() on a null runtime,
segfaulting. This happens for bf16 dynamic-quant fully-connected under
XNN_FLAG_NO_INLINED_LHS_PACKING, where CreateRuntime returns
xnn_status_unsupported_parameter (the standalone bf16->qdint8 convert
has no microkernel).

Assert xnn_status_success after the unsupported_hardware skip so an
unsupported config fails cleanly instead of dereferencing a null
runtime, mirroring the existing guard in the static-weights test below.

Repro: build the subgraph fully-connected test and run
FullyConnectedQD8BF16QB4W with a bf16 input (bf16 activation ->
qdint8 convert); crashes before this change, clean failure after.
@JakeStevens
JakeStevens force-pushed the qd8-bf16-qb4w-subgraph-fc branch from c019fab to 9e6365e Compare July 23, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant