Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPU adapter.info call fails after device creation #25874

Closed
matthew-wong1 opened this issue Sep 25, 2024 · 1 comment · Fixed by #27665
Closed

WebGPU adapter.info call fails after device creation #25874

matthew-wong1 opened this issue Sep 25, 2024 · 1 comment · Fixed by #27665
Labels
needs investigation requires further investigation before determining if it is an issue or not webgpu WebGPU API

Comments

@matthew-wong1
Copy link

Hi! I wasn't too sure if this was a bug, but I got an unexpected error for this WebGPU program:

async function main() {
  const adapter = await navigator.gpu.requestAdapter();
  const device = adapter.requestDevice();
  console.log(adapter.info);
}
main()
  .then(() => {})
  .catch((error) => {
    console.log(error);
  });

When you run the program with:

DENO_WEBGPU_BACKEND=metal deno run --allow-read --unstable-webgpu --allow-write webgpu.js

It outputs this on both versions 1.46.3 and 2.0.0-rc.5:

TypeError: The adapter cannot be reused, as it has been invalidated by a device creation
    at GPUAdapter.get info (ext:deno_webgpu/01_webgpu.js:520:13)
    at main (file:///Users/test_case.js:14:22)

But this error doesn't show up if you replace the adapter.info call with any of other other adapter attributes such as:

adapter.limits
adapter.features
adapter.isFallbackAdapter

I was wondering if there was a specific reason only adapter.info would be disabled after requestDevice is called or if this might be some sort of bug. Thanks!

@crowlKats crowlKats added webgpu WebGPU API needs investigation requires further investigation before determining if it is an issue or not labels Sep 25, 2024
@crowlKats
Copy link
Member

This was intended behaviour at one point, but it is not anymore from quickly looking at the spec, which is quite annoying, since there is no way to destroy a GPUAdapter manually, this allowed to get the info and then the device (wher ethe latter would destroy it under the hood), but since this changed now there wont be a way to destroy the adapter, which is not good since that will make tests difficult and have leaking resources. I will bring this up in next week's wgpu meeting to figure out whats up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation requires further investigation before determining if it is an issue or not webgpu WebGPU API
Projects
None yet
2 participants