mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-22 19:23:30 +00:00
[js/webgpu] fix buffer size when download (#15990)
### Description fix buffer size when download. buffer size should always be padded to multiple of 4. resolved issue described in #15796 > 
This commit is contained in:
parent
85cacf315b
commit
18f17c555d
1 changed files with 3 additions and 2 deletions
|
|
@ -195,12 +195,13 @@ class GpuDataManagerImpl implements GpuDataManager {
|
|||
|
||||
const commandEncoder = this.backend.getCommandEncoder();
|
||||
this.backend.endComputePass();
|
||||
const bufferSize = calcNormalizedBufferSize(cachedData.originalSize);
|
||||
const gpuReadBuffer = this.backend.device.createBuffer(
|
||||
// eslint-disable-next-line no-bitwise
|
||||
{size: cachedData.originalSize, usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ});
|
||||
{size: bufferSize, usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ});
|
||||
commandEncoder.copyBufferToBuffer(
|
||||
cachedData.gpuData.buffer /* source buffer */, 0 /* source offset */, gpuReadBuffer /* destination buffer */,
|
||||
0 /* destination offset */, cachedData.originalSize /* size */
|
||||
0 /* destination offset */, bufferSize /* size */
|
||||
);
|
||||
this.backend.flush();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue