Introduced Packers/Matmul for QC2W weights and QP8 activations - #10877
Introduced Packers/Matmul for QC2W weights and QP8 activations#10877damdoo001-arm wants to merge 2 commits into
Conversation
Signed-off-by: Damien Dooley <damien.dooley@arm.com>
| ExternalProject_Add(kleidiai | ||
| URL https://gitlab.arm.com/kleidi/kleidiai/-/archive/b87ef9c94f45f11c81a6b1fdaed1b2b45ea58c0c/kleidiai-b87ef9c94f45f11c81a6b1fdaed1b2b45ea58c0c.zip | ||
| URL_HASH SHA256=b147799b94c51f5e57492930bfd9e5294fb7ffe44fee1dbcd3f8048adeedd5e3 | ||
| URL https://github.com/ARM-software/kleidiai/archive/13cd35993d8439143aff1e756a862d366acded0d.zip |
| "//:operator_h", | ||
| "//src/configs:config_hdrs", |
There was a problem hiding this comment.
Can you explain why this change is needed? What do you add that requires this?
There was a problem hiding this comment.
The new QP8/QC2W selection tests directly use XNN_FLAG_INLINE_LHS_PACKING from operator.h and xnn_init_qp8_f32_qc2w_gemm_config() from config.h. The latter checks whether the configuration is available before running. I’ve narrowed config_hdrs to the specific config_h target.
| std::fill(channelwise_zero_point.begin(), channelwise_zero_point.end(), | ||
| 0.0f); |
There was a problem hiding this comment.
The constructor of channelwise_zero_point just above already fills the vector with zeros.
There was a problem hiding this comment.
Agree. I've removed this. Thanks.
| void TestStaticB(xnn_datatype convert_to = xnn_datatype_invalid, | ||
| size_t block_size = no_blockwise) { | ||
| size_t block_size = no_blockwise, | ||
| bool require_qp8_qc2w = false) { |
There was a problem hiding this comment.
Change this bool to an enum. If other configs need a special setup it won't scale well to have to add new booleans everytime.
| }, | ||
| 'third_party/kleidiai/src': { | ||
| 'url': 'https://gitlab.arm.com/kleidi/kleidiai@v1.25.0', | ||
| 'url': 'https://github.com/ARM-software/kleidiai.git@v1.29.0', |
| strip_prefix = "kleidiai-13cd35993d8439143aff1e756a862d366acded0d", | ||
| urls = [ | ||
| "https://gitlab.arm.com/kleidi/kleidiai/-/archive/b87ef9c94f45f11c81a6b1fdaed1b2b45ea58c0c/kleidiai-b87ef9c94f45f11c81a6b1fdaed1b2b45ea58c0c.zip", | ||
| "https://github.com/ARM-software/kleidiai/archive/13cd35993d8439143aff1e756a862d366acded0d.zip", |
Signed-off-by: Damien Dooley <damien.dooley@arm.com>
Summary
Add an SME2-optimized
QP8/F32/QC2Wfully connected path using KleidiAI 1.29.The integration adds wrappers for two signed INT2 weight kernels:
1x64c4, targeting single-row/decode workloads.16x64c4, targeting multi-row/prefill workloads.The path dynamically quantizes FP32 activations to INT8, uses per-channel signed INT2 weights, and produces FP32 output. It also adds:
Testing
Validated locally:
//test:packing_test//test:qp8_f32_qc2w_gemm_minmax_test//test/operators:fully_connected_nc_test//test/subgraph:fully_connected_testValidated on the Android board:
Dependency
Requires KleidiAI 1.29, which provides the SME2 DOT and MOPA INT2 kernels and the corresponding NxK weight packer.