Skip to content

Commit

Permalink
webgpu: fix: conditionally call deprecated GPUAdapter.requestAdapterI…
Browse files Browse the repository at this point in the history
…nfo (#8392)

* fix: conditionally call deprecated GPUAdapter.requestAdapterInfo

* Update tfjs-backend-webgpu/src/base.ts

Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>

* fix: update webgpu types

---------

Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
  • Loading branch information
mattvr and petamoriken authored Oct 11, 2024
1 parent 8d594e3 commit 33d939a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@types/semver": "^7.3.9",
"@types/shelljs": "^0.8.7",
"@types/dom-webcodecs": "0.1.4",
"@webgpu/types": "0.1.38",
"@webgpu/types": "0.1.48",
"ajv": "~6.12.3",
"argparse": "^1.0.10",
"chalk": "~2.4.2",
Expand Down
8 changes: 7 additions & 1 deletion tfjs-backend-webgpu/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ if (isWebGPUSupported()) {
};

const device: GPUDevice = await adapter.requestDevice(deviceDescriptor);
const adapterInfo = await adapter.requestAdapterInfo();
const adapterInfo =
'info' in adapter
? adapter.info
: 'requestAdapterInfo' in adapter
// tslint:disable-next-line:no-any
? await (adapter as any).requestAdapterInfo()
: undefined;
return new WebGPUBackend(device, adapterInfo);
}, 3 /*priority*/);
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,10 @@
resolved "https://registry.yarnpkg.com/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.23.tgz#268da5091e1e9264fe87b8b94c0ac596e9e54879"
integrity sha512-GXpEPdZJm6o+2VAxzUsKaiDriS+5enqr7Gjrb2Bttcd+IkOuC8lDsoFHxIv0ib4JudZJ/aKsRYL3TN2AetPFjw==

"@webgpu/types@0.1.38":
version "0.1.38"
resolved "https://registry.npmjs.org/@webgpu/types/-/types-0.1.38.tgz#6fda4b410edc753d3213c648320ebcf319669020"
integrity sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==
"@webgpu/types@0.1.48":
version "0.1.48"
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.48.tgz#8ab741852283118bd633345c20e218faa7211e9c"
integrity sha512-e3zmDEPih4Rle+JrP5cT8nCCtDizoUpEaN72OuD1clbhXGERtn0wwuMdxOrBymu3kMLWKDd8hd+ERhSheLuLTg==

"@xmldom/xmldom@^0.7.3":
version "0.7.5"
Expand Down

0 comments on commit 33d939a

Please sign in to comment.