gnguralnick commented on code in PR #18961:
URL: https://github.com/apache/tvm/pull/18961#discussion_r3024084532


##########
web/src/webgpu.ts:
##########
@@ -697,6 +697,13 @@ export class WebGPUContext {
       bindGroupLayouts: [bindGroupLayout]
     });
 
+    // Pre-allocate typed array views for pod args (reused across dispatches)
+    const maxPodArgs = podArgIndices.length + 1; // +1 for packGridDimX
+    const podArgsArrayBuffer = new ArrayBuffer(maxPodArgs * 4);
+    const i32ViewCached = new Int32Array(podArgsArrayBuffer);
+    const u32ViewCached = new Uint32Array(podArgsArrayBuffer);
+    const f32ViewCached = new Float32Array(podArgsArrayBuffer);

Review Comment:
   Applied this and also hoisted `podArgBytes` so the dispatch path reuses it 
directly instead of recomputing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to