TECHNOLOGY

ONNX Runtime MatMulNBits above 256: logical blocks can execute as smaller sub-blocks

In this article
THE QUICK TAKE

Large CPU MatMulNBits blocks in 1.32 retain their logical layout while using execution sub-blocks; verify parameter expansion and supported format limits.

ONNX Runtime 1.32.0 enables supported CPU MatMulNBits block sizes above 256. The linked implementation keeps the authored logical weight format while representing execution through 256-element sub-blocks. Scale and zero-point handling must bridge those representations correctly; accepting a larger block attribute is only one part of the support contract.

Authored layout remains the artifact contract

The kernel does not simply reinterpret the model as if it had been authored with a smaller block size. It validates the original logical parameters and constructs an execution representation. A proposed reference decodes the original large blocks, then compares the optimized multiplication. Keep weight bytes and authored attributes fixed across the comparison. Re-exporting with another block size would change quantization and answer a different question.

Scale and zero-point expansion need coverage

Execution sub-blocks share the logical block’s parameters through expansion. Packed and floating zero points require different handling, and runtime parameters differ from constant preprocessed ones. A proposed suite uses nonuniform scales and zero points and covers both constant and runtime inputs. Uniform parameters can hide an incorrect repeat stride. Check output over multiple logical blocks so boundary errors cannot remain outside the tested prefix.

Activation-boundary fusion is a separate route

The PR also enables a CPU conversion from constant-weight DQ plus MatMul or Gemm inside 16-bit activation boundaries. That selector must preserve surrounding activation and bias nodes. A direct MatMulNBits test does not validate the rewrite. Include an optimized source graph and compare with the unfused version, inspecting which nodes remain. Do not infer that all quantized activation types or shared weight consumers are eligible.

Large-block support remains conditional

The linked work explicitly excludes some weight widths and indexing modes above 256. Preserve these rejection cases rather than presenting the feature as arbitrary-block support. This article reports the logical-versus-execution distinction and proposed checks without new benchmarks. A local result should name weight width, block size, parameter representation and actual CPU route before claiming that the previously rejected authored model now executes correctly.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles