tqchen commented on code in PR #18871:
URL: https://github.com/apache/tvm/pull/18871#discussion_r2890619202


##########
web/src/webgpu.ts:
##########
@@ -695,9 +704,28 @@ export class WebGPUContext {
           });
         }
 
-        // push pod buffer
+        // Each dispatch in a batch needs its own uniform buffer since the
+        // encoder defers submission. We maintain a reusable pool indexed by
+        // dispatch position — buffers grow as needed but are never destroyed.
         const sizeOfI32 = 4;
-        const podArgBuffer = this.getPodArgsBuffer((podArgIndices.length + 1) 
* sizeOfI32);
+        const bufBytes = (podArgIndices.length + 1) * sizeOfI32;
+        const dispatchIdx = this.pendingDispatchCount++;
+        let podArgBuffer: GPUBuffer;
+        if (dispatchIdx < this.uniformBufferPool.length &&

Review Comment:
   seems we are misisng when dispatchIdx runs out of 
`this.uniformBufferPool.length`, at whihc pt we should flush (seems to be 
missing here)?. This part of code should be a subfunctio. getUniformFromPool. 
We need to have comment on state transition impact if we flush (e.g. if there 
were stale state that was created before this pt)



-- 
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