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

Logging out webgpu adapater causes an assertion error #26760

Open
okikio opened this issue Nov 6, 2024 · 5 comments · May be fixed by #26844
Open

Logging out webgpu adapater causes an assertion error #26760

okikio opened this issue Nov 6, 2024 · 5 comments · May be fixed by #26844
Labels
bug Something isn't working correctly webgpu WebGPU API

Comments

@okikio
Copy link

okikio commented Nov 6, 2024

Version: Deno 2.0.5

On Windows, Linux, and Mac OS trying to log out the WebGPU adapter causes an assertion error which is unexpected and was rather difficult to debug, interestingly enough logging out the actual adapter device works as expected it prints out an object.

I'm not sure if the assertion error is expected behaviour or not but I've not found any documentation that specifies this behaviour, so I'm thinking it's a bug.

Note: when running the script on Windows it doesn't always print the assertion error, sometimes it just causes the script to crash with no errors, making it basically impossible to debug.

const adapter = await navigator.gpu.requestAdapter();
const device = await adapter?.requestDevice();

console.log({
  adapter,
})

Assertion Error:

❯ deno run --unstable-webgpu -A main.ts
[Internal Formatting Error] AssertionError: Assertion failed
    at assert (ext:deno_console/01_console.js:199:11)
    at getKeys (ext:deno_console/01_console.js:1294:7)
    at formatRaw (ext:deno_console/01_console.js:761:14)
    at formatValue (ext:deno_console/01_console.js:545:10)
    at inspect (ext:deno_console/01_console.js:3469:10)
    at GPUAdapter.[Deno.privateCustomInspect] (ext:deno_webgpu/01_webgpu.js:542:12)
    at formatValue (ext:deno_console/01_console.js:487:48)
    at formatProperty (ext:deno_console/01_console.js:1647:11)
    at formatRaw (ext:deno_console/01_console.js:957:9)
    at formatValue (ext:deno_console/01_console.js:545:10)
@okikio okikio changed the title Logging out webgpu adapater causes an assertion error on Linux, Mac OS and Windows hindering debugging when using WebGPU Logging out webgpu adapater causes an assertion error, hindering debugging when using WebGPU Nov 6, 2024
@okikio okikio changed the title Logging out webgpu adapater causes an assertion error, hindering debugging when using WebGPU Logging out webgpu adapater causes an assertion error Nov 6, 2024
@petamoriken
Copy link
Contributor

Probably related to #25874

@petamoriken
Copy link
Contributor

petamoriken commented Nov 6, 2024

Currently, first access to the adapter.info getter property after getting the device throws an exception.

It is a strange code, but I think it may be possible to execute the following code as a workaround:

const adapter = await navigator.gpu.requestAdapter();

// first access to adapter.info *before* getting the device
adapter?.info;

const device = await adapter?.requestDevice();

console.log({
  adapter,
})

@okikio
Copy link
Author

okikio commented Nov 6, 2024

Interesting @petamoriken you're right so this is probs a bug in Deno

@bartlomieju bartlomieju added bug Something isn't working correctly webgpu WebGPU API labels Nov 6, 2024
@petamoriken
Copy link
Contributor

I try to fix this issue.

@petamoriken
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly webgpu WebGPU API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants