This is an automated email from the ASF dual-hosted git repository.

ruihangl pushed a commit to branch unity
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/unity by this push:
     new a66e1cd1f5 [WEB] Fix WebGPU runtime build (#15575)
a66e1cd1f5 is described below

commit a66e1cd1f58c8744f1718b7535f5fcce53f75557
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed Aug 16 14:40:42 2023 -0400

    [WEB] Fix WebGPU runtime build (#15575)
    
    This PR fixes webgpu runtime build by removing the lib preset that
    can conflict with the webgpu types
---
 web/src/webgpu.ts | 11 ++++++-----
 web/tsconfig.json |  1 -
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/web/src/webgpu.ts b/web/src/webgpu.ts
index 5a6e10034c..5ffed62cf9 100644
--- a/web/src/webgpu.ts
+++ b/web/src/webgpu.ts
@@ -44,11 +44,11 @@ export async function detectGPUDevice(): 
Promise<GPUDeviceDetectOutput | undefin
     }
 
     // more detailed error message
-    const requitedMaxBufferSize = 1 << 30;
-    if (requitedMaxBufferSize > adapter.limits.maxBufferSize) {
+    const requiredMaxBufferSize = 1 << 30;
+    if (requiredMaxBufferSize > adapter.limits.maxBufferSize) {
       throw Error(
         `Cannot initialize runtime because of requested maxBufferSize ` +
-        `exceeds limit. requested=${computeMB(requitedMaxBufferSize)}, ` +
+        `exceeds limit. requested=${computeMB(requiredMaxBufferSize)}, ` +
         `limit=${computeMB(adapter.limits.maxBufferSize)}. ` +
         `This error may be caused by an older version of the browser (e.g. 
Chrome 112). ` +
         `You can try to upgrade your browser to Chrome 113 or later.`
@@ -82,7 +82,7 @@ export async function detectGPUDevice(): 
Promise<GPUDeviceDetectOutput | undefin
     const adapterInfo = await adapter.requestAdapterInfo();
     const device = await adapter.requestDevice({
       requiredLimits: {
-        maxBufferSize: requitedMaxBufferSize,
+        maxBufferSize: requiredMaxBufferSize,
         maxStorageBufferBindingSize: requiredMaxStorageBufferBindingSize,
         maxComputeWorkgroupStorageSize: requiredMaxComputeWorkgroupStorageSize,
       },
@@ -158,7 +158,8 @@ class CanvasRenderManager implements Disposable {
     if (ctx == null) {
       throw Error("Cannot bind WebGPU context");
     }
-    this.canvasContext = ctx;
+    // avoid possible ts complain
+    this.canvasContext = ctx as any;
     this.canvasTextureFormat = navigator.gpu.getPreferredCanvasFormat();
     this.canvasContext.configure({
       device: this.device,
diff --git a/web/tsconfig.json b/web/tsconfig.json
index 3f9a23521f..e80943e5b4 100644
--- a/web/tsconfig.json
+++ b/web/tsconfig.json
@@ -2,7 +2,6 @@
     "compilerOptions": {
                "target": "es6",
                "outDir": "lib",
-               "lib": ["ESNext", "DOM"],
                "types": ["node", "@webgpu/types"],
                "rootDir": "src",
                "declaration": true,

Reply via email to