onnxruntime/js/web/lib/wasm
Jiajia Qin 8fbbf2fd4f
[js/webgpu] Optimize MatMul with M = 1 (#22577)
### Description
<!-- Describe your changes. -->
BUG #22031

In the demucs model, there are lots of MatMul ops with shapes like
below:
`input[0]: [3448,1,512] | float32, input[1]: [512,1536] | float32,
output[0]: [3448,1,1536] | float32`

We can see that for this kind of shape, the batch size is a big value,
but M = 1. Our current algorithm is based on [M, N] to partition tiles,
which is not efficient for such kind of shapes. This PR reshapes the
inputs to improve the matmul performance.
Before:  [3448,1,512] x [512,1536] =  [3448,1,1536]
After: [1, 3448, 512] x [512, 1536] = [1, 3448, 1536] , then the output
can be reshaped to [3448, 1, 1536]

The overall MatMul time in demucs model becomes 1778.45 ms from 4418.17
ms on my iGPUs.

---------

Co-authored-by: Yulong Wang <7679871+fs-eire@users.noreply.github.com>
2024-11-01 08:04:42 -07:00
..
jsep [js/webgpu] Optimize MatMul with M = 1 (#22577) 2024-11-01 08:04:42 -07:00
proxy-worker [js] change default formatter for JavaScript/TypeScript from clang-format to Prettier (#21728) 2024-08-14 16:51:22 -07:00
proxy-messages.ts [WebNN EP] Enable IO Bindings with MLTensor (#21301) 2024-09-27 17:24:21 -07:00
proxy-wrapper.ts [js] change default formatter for JavaScript/TypeScript from clang-format to Prettier (#21728) 2024-08-14 16:51:22 -07:00
run-options.ts [js] change default formatter for JavaScript/TypeScript from clang-format to Prettier (#21728) 2024-08-14 16:51:22 -07:00
session-handler-inference.ts [WebNN EP] Enable IO Bindings with MLTensor (#21301) 2024-09-27 17:24:21 -07:00
session-options.ts [JS/WebGPU] Support WASM64 (#21836) 2024-10-24 20:21:51 -07:00
wasm-common.ts [WebNN] Support int4 and uint4 data types (#22575) 2024-10-25 17:44:46 -07:00
wasm-core-impl.ts [WebNN EP] Add cache for MLContexts in the WebNNBackend (#22510) 2024-10-30 10:26:33 -07:00
wasm-factory.ts [js] change default formatter for JavaScript/TypeScript from clang-format to Prettier (#21728) 2024-08-14 16:51:22 -07:00
wasm-types.ts [WebNN EP] Add cache for MLContexts in the WebNNBackend (#22510) 2024-10-30 10:26:33 -07:00
wasm-utils-env.ts [js/web] optimize module export and deployment (#20165) 2024-05-20 09:51:16 -07:00
wasm-utils-import.ts [js/web] remove training release (#22103) 2024-09-16 10:56:22 -07:00
wasm-utils-load-file.ts [js] change default formatter for JavaScript/TypeScript from clang-format to Prettier (#21728) 2024-08-14 16:51:22 -07:00
wasm-utils.ts [JS/WebGPU] Support WASM64 (#21836) 2024-10-24 20:21:51 -07:00