Skip to content

Accept 2D MatMulNBits zero points - #5266

Open
ghedo wants to merge 1 commit into
ROCm:developfrom
ghedo:matmulnbit-2d-zero-points
Open

ghedo wants to merge 1 commit into
ROCm:developfrom
ghedo:matmulnbit-2d-zero-points

Conversation

@ghedo

@ghedo ghedo commented Sep 15, 2026

Copy link
Copy Markdown

Motivation

MIGraphX's ONNX importer rejects valid MatMulNBits graphs because the packed zero point tensor is validated by exact shape rather than by element count.

Technical Details

The earlier scale-shape fix in commit 7eaafc3 (PR #3698) accepted multidimensional inputs but left zero point validation requiring a flattened layout.

The official com.microsoft MatMulNBits specification defines packed zero points as a 2D tensor with shape [N, ceil(k_blocks * bits / 8)].

Validate packed zero points by element count so both the schema's 2D layout and legacy flattened tensors are accepted. Update the parser and verification fixtures to cover the 2D layout.

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

Follow the LLVM AI Tool Use Policy for contributions using AI.

@ghedo
ghedo requested a review from causten as a code owner September 15, 2026 19:13
@ghedo
ghedo force-pushed the matmulnbit-2d-zero-points branch from e6b9e48 to a5c9992 Compare September 15, 2026 19:14
@ghedo
ghedo requested a review from a team as a code owner September 15, 2026 19:14
@ghedo
ghedo force-pushed the matmulnbit-2d-zero-points branch from a5c9992 to 393ff14 Compare September 15, 2026 19:17
The earlier scale-shape fix in commit
7eaafc3 (PR ROCm#3698) accepted
multidimensional inputs but left zero point validation requiring a
flattened layout.

The official com.microsoft MatMulNBits specification defines packed zero
points as a 2D tensor with shape [N, ceil(k_blocks * bits / 8)].

Validate packed zero points by element count so both the schema's 2D
layout and legacy flattened tensors are accepted. Update the parser and
verification fixtures to cover the 2D layout.
@ghedo
ghedo force-pushed the matmulnbit-2d-zero-points branch from 393ff14 to e758bad Compare September 17, 2026 17:44
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