onnxruntime/js/web/lib/wasm/jsep/webgpu/ops
Jiajia Qin 891fba3b9c
[js/webgpu] Optimize Gather op (#17625)
### Description
This PR optimizes the gather op, which is improved ~6ms in segment
anything model in ADL.
The problem in original algorithm is that it includes a for loop to
calculate a block size of data. However, the block size may be very
large, like `65536`. In GPU shader, we should try to avoid large loop in
shader and try to use more threads to do it parallelly.

Before:
```
[profiling] kernel "41771992|[Gather] 41771992" input[0]: [4,65536] | float32, input[1]: [1] | int64, output[0]: [1,65536] | float32, execution time: 6886207 ns
```
After:
```
[profiling] kernel "41771992|[Gather] 41771992" input[0]: [4,65536] | float32, input[1]: [1] | int64, output[0]: [1,65536] | float32, execution time: 11719 ns
2023-09-21 21:00:36 -07:00
..
3rd-party [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
argminmax.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
binary-op.ts [js/webgpu] Allow binary ops with scalar to use the vectorize path (#17589) 2023-09-21 20:55:08 -07:00
common.ts [js/webgpu] Optimize Gather op (#17625) 2023-09-21 21:00:36 -07:00
concat.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
conv-grouped.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
conv-transpose.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
conv.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
conv2d-mm.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
einsum.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
expand.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
fuse-utils.ts
gather-elements.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
gather.ts [js/webgpu] Optimize Gather op (#17625) 2023-09-21 21:00:36 -07:00
gemm.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
instance-norm.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
layer-norm.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
matmul.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
pad.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
pool.ts [js/web] fp16 Pool & Reduce (#17512) 2023-09-21 14:52:13 -07:00
reduce.ts [js/web] fp16 Pool & Reduce (#17512) 2023-09-21 14:52:13 -07:00
resize.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
skip-layer-norm.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
slice.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
softmax.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
split.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
tile.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
transpose.ts [js/web] revise TensorView (#17473) 2023-09-14 21:14:44 -07:00
unary-op.ts [js/web] FP16 binary and unary ops (#17515) 2023-09-18 15:43:32 -07:00