onnxruntime
238905a4 - Validate DQ scale/zero_point shapes before QGemm fusion (#28714)

Commit
29 days ago
Validate DQ scale/zero_point shapes before QGemm fusion (#28714) ### Description: This PR adds shape validation in `GemmNodeGroupSelector::Check` to prevent incorrect DQ-Gemm-Q to QGemm fusion when DequantizeLinear nodes have incompatible scale/zero_point shapes. ### Problem The QGemm op requires a_zero_point and b_zero_point as mandatory inputs, and only supports scalar or 1D scale/zero_point. Previously, the selector did not validate these constraints, which could lead to runtime crashes when incorrect fusion occurs. ### Changes - Added `IsScalarOr1DWithSizeOneOrN()` helper to validate that a NodeArg's shape is scalar or 1D with size 1 or N. Rejects unknown shapes to avoid incorrect fusion. - Added checks in `GemmNodeGroupSelector::Check` to maintain consistency with QGemm checks. - Added test `Gemm_NoQGemmFusionWithHighRankScaleZp` to verify that DQ nodes with rank-2 scale/zero_point are not fused into QGemm.
Author
Parents
Loading