Skip to content

Commit

Permalink
[Web] Allow deprecated API requestAdapterInfo with any cast (#17420)
Browse files Browse the repository at this point in the history
* [Web] Allow deprectaed API with any cast

* Fix lint

* Fix by adding await
  • Loading branch information
CharlieFRuan authored Sep 28, 2024
1 parent 7c28c86 commit 7ff4d0d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "TVM WASM/WebGPU runtime for JS/TS",
"license": "Apache-2.0",
"homepage": "https://github.com/apache/tvm/tree/main/web",
"version": "0.18.0-dev0",
"version": "0.18.0-dev2",
"files": [
"lib"
],
Expand Down
4 changes: 3 additions & 1 deletion web/src/webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ export async function detectGPUDevice(): Promise<GPUDeviceDetectOutput | undefin
requiredFeatures.push("shader-f16");
}

const adapterInfo = adapter.info;
// requestAdapterInfo() is deprecated, causing requestAdapterInfo to raise
// issue when building. However, it is still needed for older browsers, hence `as any`.
const adapterInfo = adapter.info || await (adapter as any).requestAdapterInfo();
const device = await adapter.requestDevice({
requiredLimits: {
maxBufferSize: requiredMaxBufferSize,
Expand Down

0 comments on commit 7ff4d0d

Please sign in to comment.