onnxruntime/onnxruntime/core
Vincent Wang 34d70f5fae
[QNN] MatMul Op Builder to Handle All Cases of ONNX's MatMul (#22639)
ONNX's MatMul is same as numpy.matmul, which supports input tensors with
rank >= 1. But QNN's MatMul can only support input tensors with rank >=
2. This PR is to add MatMulOpBuilder for QNN EP to build QNN graph to
support all possible cases of ONNX's MatMul, by adding Reshape nodes if
necessary, e.g., if Reshape 1D input to 2D if exists, and Reshape output
to expected shape at the end.
 
This PR also tries to use FullyConnected Op for MatMul if 2nd input is
2D initializer or 1D tensor because FullyConnected is faster than MatMul
on QNN EP. If 2nd input is 2D tensor, we require it an initializer
because FullyConnected requires 2nd input in [n, k] shape, we can
transpose it when graph building if it's an initializer (we don't want
to add extra Transpose node).

Use swin_base model as example, which contains several MatMul nodes with
2nd input is 2D initializer (not followed by Add), running on Gen3
mobile device, before the change, it takes 34.8876 ms, after this
change, it's 27.0639 ms.
2025-01-08 10:15:55 +08:00
..
common Remove nsync (#20413) 2024-10-21 15:32:14 -07:00
dll fix webgpu delay load test (#23157) 2024-12-20 13:37:12 -08:00
dlpack
eager
flatbuffers
framework Address CodeQL security issues on comparison of different types (#23276) 2025-01-07 17:30:44 -08:00
graph Address CodeQL security issues on comparison of different types (#23276) 2025-01-07 17:30:44 -08:00
mickey
mlas [ARM CPU] Add rotary embedding fp16 kernel (#23013) 2024-12-06 13:25:48 -08:00
optimizer Quantize Weight for Gemm/Conv on Quantized Model (#22969) 2025-01-08 10:00:24 +08:00
platform [CoreML] support coreml model cache (#23065) 2024-12-31 09:29:41 +08:00
providers [QNN] MatMul Op Builder to Handle All Cases of ONNX's MatMul (#22639) 2025-01-08 10:15:55 +08:00
quantization
session [VitisAI] change all support tensor type from ir 9 to ir 10 (#23204) 2025-01-02 06:45:21 -08:00
util Address CodeQL security issues on comparison of different types (#23276) 2025-01-07 17:30:44 -08:00