diff --git a/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts b/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts index 076ec8ca7b5ec..fed7e8412a678 100644 --- a/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts +++ b/js/web/lib/wasm/jsep/webgpu/gpu-data-manager.ts @@ -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();