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 queryset appears to not work (any use of createQuerySet fails) #26769

Open
jowens opened this issue Nov 7, 2024 · 0 comments
Open

WebGPU queryset appears to not work (any use of createQuerySet fails) #26769

jowens opened this issue Nov 7, 2024 · 0 comments
Labels
bug Something isn't working correctly webgpu WebGPU API

Comments

@jowens
Copy link

jowens commented Nov 7, 2024

I append a short JS code segment that fails when I try to print querySet with console.log. As far as I can tell, I can't use the output of createQuerySet at all.

% deno run /tmp/foo.mjs
error: Uncaught (in promise) AssertionError: Assertion failed
  console.log(querySet);
          ^
    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 GPUQuerySet.[Deno.privateCustomInspect] (ext:deno_webgpu/01_webgpu.js:5252:12)
    at formatValue (ext:deno_console/01_console.js:487:48)
    at inspectArgs (ext:deno_console/01_console.js:3071:17)
    at console.log (ext:deno_console/01_console.js:3140:7)
    at main (file:///tmp/foo.mjs:23:11)
deno 2.0.4 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2
async function main(navigator) {
  const adapter = await navigator.gpu?.requestAdapter();
  const canTimestamp = adapter.features.has("timestamp-query");
  const device = await adapter?.requestDevice({
    requiredFeatures: [...(canTimestamp ? ["timestamp-query"] : [])],
  });

  if (!device) {
    fail("Fatal error: Device does not support WebGPU.");
  }

  if (!canTimestamp) {
    fail(
      'Fatal error: Device does not support WebGPU timestamp query (`adapter.features.has("timestamp-query")` is false).'
    );
  }

  const querySet = device.createQuerySet({
    type: "timestamp",
    count: 2,
  });

  console.log(querySet);

  function fail(msg) {
    // eslint-disable-next-line no-alert
    alert(msg);
  }
}

await main(navigator);
@nathanwhit nathanwhit added bug Something isn't working correctly webgpu WebGPU API labels Nov 8, 2024
littledivy pushed a commit that referenced this issue Nov 17, 2024
Converter for `GPUComputePassTimestampWrites` uses converter for
`GPUQuerySet` before it is defined making it impossible to use. This PR
simply reorders converter creation to resolve this issue. Logging the
`GPUQuerySet` still fails (as mentioned in #26769) but it is now usable
inside pass descriptors and works when used.
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

No branches or pull requests

2 participants