onnxruntime/js/web/lib/wasm/jsep/webgpu
Yang Gu 811231e418
[js/webgpu] Destroy staging buffers aggressively during weights uploading (#22726)
In current implementation, all the staging buffers for weights uploading
are destroyed after first batch of kernel execution. It requires a lot
of memory as all the staging buffers couldn't be reused. It also hurts
the startup time (weights uploading only happens in session creation),
as weights uploading is delayed to a very late time.
This PR uses a very aggressive way to submit queue and destroy staging
buffers, so that the related GPU memory could be reused as much as
possible, though the real situation depends on the WebGPU and driver
implementation. The aggressive queue submission also moves GPU
operations to a very early time, which helps the startup time.
Some buffer uploading benchmarks are composed to compare multiple
solutions, regarding to the memory and time consumption. Benchmarks can
be found at
https://github.com/webatintel/webbench/blob/master/webgpu/buffer-upload.html,
while detailed test data can be found at

https://docs.google.com/document/d/1KgygOkb9ZNzkgzQ_tWOGlEI9ScmMBHDjDojjPFLmVXU/edit.
I also tested phi3.5 on 2 machines, first inference time improved from
5141ms to 3579ms and from 4327ms to 2947ms separately.
2024-11-06 08:55:15 -08:00
..
ops [js/webgpu] Increase workgroupSize if only one workgroup is dispached (#22709) 2024-11-05 13:13:52 -08:00
attribute-with-cache-key.ts [js] change default formatter for JavaScript/TypeScript from clang-format to Prettier (#21728) 2024-08-14 16:51:22 -07:00
gpu-data-manager.ts [js/webgpu] Destroy staging buffers aggressively during weights uploading (#22726) 2024-11-06 08:55:15 -08:00
op-resolve-rules.ts [JS/WebGPU] GroupQueryAttention rewrite (#20946) 2024-10-23 10:14:09 -07:00
program-manager.ts [js] change default formatter for JavaScript/TypeScript from clang-format to Prettier (#21728) 2024-08-14 16:51:22 -07:00
types.ts [js/webgpu] Optimize matmulnbits (#22360) 2024-10-14 15:49:29 -07:00