Added a dimension check in MatMulComputeHelper to ensure the inner dimension K_#28053
Added a dimension check in MatMulComputeHelper to ensure the inner dimension K_#28053yuslepukhin wants to merge 8 commits intomainfrom
MatMulComputeHelper to ensure the inner dimension K_#28053Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a defensive dimension check to prevent out-of-bounds reads in MatMulInteger for 1D-vector dot products with mismatched inner dimensions, and introduces regression tests to cover valid and invalid 1D shape combinations.
Changes:
- Add an explicit
K_vsright_shape[0]validation for the 1D-vector dot-product path inMatMulComputeHelper. - Add regression tests for successful 1D dot product and failure on mismatched 1D shapes for both
uint8_tandint8_t.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| onnxruntime/core/providers/cpu/math/matmul_helper.h | Adds a new inner-dimension check for 1D-vector dot products to prevent OOB reads. |
| onnxruntime/test/providers/cpu/math/matmul_integer_test.cc | Adds regression tests for 1D dot product success and mismatched-dimension failures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
By default, OpTester sets So I believe to ensure the tests actually prove the runtime check works, the mismatch tests should disable shape metadata so inference is bypassed: Nits:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Review generated with assistance from GitHub Copilot CLI. Looks good overall — the fix is correct and the updated tests properly bypass ONNX shape inference via 1. Consider adding a plain 2. Reverse mismatch direction — Both mismatch tests use left-longer-than-right ( 3. test.Run(OpTester::ExpectResult::kExpectFailure, "");This passes on any failure. A more specific substring would strengthen the signal. None of these are blocking — the security fix and core regression tests look solid. |
|
/azp run Windows ARM64 QNN CI Pipeline |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This pull request improves the handling and testing of 1D vector dot products in the MatMul implementation. It adds stricter validation for the K dimension in 1D vector cases and introduces new regression tests to ensure correct behavior for both valid and invalid input shapes.
Validation Enhancement:
MatMulComputeHelperto ensure that when both inputs are 1D vectors, their K dimensions match, and to provide a clear error message if they do not.Testing Improvements:
matmul_integer_test.ccto verify:uint8_tandint8_ttypes.uint8_tandint8_ttypes.