Skip to content

Fix shaderf16 support on vulkan/nvidia #7656

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

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

cryvosh
Copy link

@cryvosh cryvosh commented May 1, 2025

Connections
N/A

Description
On my Laptop 4090, vulkaninfo reports:

VkPhysicalDeviceVulkan11Features:
---------------------------------
storageBuffer16BitAccess = true
uniformAndStorageBuffer16BitAccess = true
storagePushConstant16 = true
storageInputOutput16 = false

However the wgpu vulkan backend requires all four to be true for the SHADER_F16 feature to be supported.
This doesn't seem necessary, and as far as I can tell, storage_input_output16 isn't even read anywhere in wgpu.

This is also how dawn handles f16 support checking here.

Testing
My personal project using f16s (developed in wasm which doesn't have this issue) was tested and works fine on Windows 11, Vulkan Backend.

Squash or Rebase?
Squash

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.

@cryvosh cryvosh requested a review from a team as a code owner May 1, 2025 21:09
@cryvosh cryvosh marked this pull request as draft May 2, 2025 04:45
@cryvosh cryvosh marked this pull request as ready for review May 2, 2025 04:46
@sagudev
Copy link
Collaborator

sagudev commented May 2, 2025

storage_input_output16 is somehow implicitly used here:

.insert(spirv::Capability::StorageInputOutput16);

As for Dawn https://issues.chromium.org/issues/42251212:

Tint can now polyfill f16 shader IO by using f32 types, so we can
enable the F16 feature on Vulkan without this capability.

I think naga also does pollyfill somewhere.

@cryvosh cryvosh marked this pull request as draft May 3, 2025 10:15
@cryvosh
Copy link
Author

cryvosh commented May 3, 2025

Any idea where would be the best place to add the polyfill?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants