Skip to content

Conversation

andyleiserson
Copy link
Contributor

@andyleiserson andyleiserson commented Aug 23, 2025

Although the operation of these functions is defined in terms of f16 semantics, the input/output types are not f16, and they are generally available even when native f16 support is not. But in at least one case, they are only available with f16 support, so add a new capability that decides whether these functions are available.

Add some infrastructure to simplify testing of missing capabilities/extensions, and add tests for a few more kinds of f16 usage.

Testing
Adds tests in the wgsl_errors suite. Updates some snapshot tests to declare the new capability. Rename one glsl snapshot test that already had "glsl" in the name before the change was made to always rename snapshot outputs to include the source format.

Squash or Rebase? Rebase

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@andyleiserson
Copy link
Contributor Author

I guess maybe this should be a downlevel flag?

@teoxoy
Copy link
Member

teoxoy commented Aug 25, 2025

I guess maybe this should be a downlevel flag?

Yes, it sounds more appropriate.

@ErichDonGubler ErichDonGubler force-pushed the f16 branch 2 times, most recently from 6d83ae5 to b644274 Compare August 25, 2025 22:04
Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I had a couple of things that should be easy to resolve.


I used Conventional Comments in this review! I hope they help with clarity and tone. 🙂

@@ -1,3 +1,5 @@
god_mode = true # requires F16_IN_F32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: It's very unfortunate that we haven't split god_mode into different bits of configuration yet. Not something to handle here, but *sigh in idealist*.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this is unfortunate, and isn't really that much effort to fix, but I was trying to avoid scope creep on this change. (Also, I think there are other pending changes to tests to reuse some of the "toml test attributes" infrastructure in more places, which seems like a reason to put this off until it can be done with less risk of conflicts.)

Filed #8154 for this.

@ErichDonGubler ErichDonGubler self-assigned this Aug 25, 2025
@ErichDonGubler ErichDonGubler changed the title Require new F16_IN_F32 capability for pack/unpack/quantize f16 Require new F16_IN_F32 downlevel flag for quantizeToF16, pack2x16float, and unpack2x16float Aug 25, 2025
@ErichDonGubler ErichDonGubler changed the title Require new F16_IN_F32 downlevel flag for quantizeToF16, pack2x16float, and unpack2x16float Require new F16_IN_F32 downlevel flag for quantizeToF16, pack2x16float, and unpack2x16float in WGSL input Aug 25, 2025
@ErichDonGubler ErichDonGubler added naga Shader Translator lang: WGSL WebGPU Shading Language type: bug Something isn't working area: api Issues related to API surface labels Aug 25, 2025
andyleiserson and others added 3 commits August 26, 2025 14:59
…8130)

Although the operation of these functions is defined in terms of f16
semantics, the input/output types are not f16, and they are generally
available even when native `f16` support is not. But in at least one
case, they are only available with `f16` support, so add a new downlevel
flag that is cleared when these functions are not available.

Add some infrastructure to simplify testing of missing
capabilities/extensions, and add tests for a few more kinds of f16
usage.

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
@@ -1696,6 +1696,15 @@ impl super::Instance {
);
};

if info.driver_info.contains("Mesa ") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From meeting: decide if we should narrow this condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I narrowed it to look for driver == "llvmpipe".

I also noticed that the gles and vulkan backends aren't written to set newly-defined downlevel flags by default, maybe they should be? And regardless of that, should the gles backend enable F16_IN_F32?

@andyleiserson andyleiserson merged commit 0aacfea into gfx-rs:trunk Aug 28, 2025
40 checks passed
andyleiserson added a commit that referenced this pull request Aug 28, 2025
Although the operation of these functions is defined in terms of f16
semantics, the input/output types are not f16, and they are generally
available even when native `f16` support is not. But in at least one
case, they are only available with `f16` support, so add a new downlevel
flag that is cleared when these functions are not available.

Add some infrastructure to simplify testing of missing
capabilities/extensions, and add tests for a few more kinds of f16
usage.

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
@andyleiserson andyleiserson deleted the f16 branch August 28, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface lang: WGSL WebGPU Shading Language naga Shader Translator type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants