Repository navigation
Enable 16-bit storage together with shader_float16 - #406
Merged
Merged
Conversation
Naga declares StorageBuffer16BitAccess and UniformAndStorageBuffer16BitAccess for any f16 type, but the Vulkan backend enabled the matching device features only when cooperative matrix reported f16 shapes. Devices with shaderFloat16 and no f16 cooperative matrix (MI300X on RADV, lavapipe) got f16 shaders declaring features that were never enabled. Report shader_float16 only when both 16-bit storage features are present, and enable them whenever shader_float16 is. The cooperative matrix f16 shapes now key off the same flag, so the old auto-enable is redundant. Taken from the MI300 experiments in #405. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W9jSvpnbXEXmoHFuUVFdUN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #405: the f16 part, which is the functional change MI300X needs.
Problem
Naga's SPIR-V backend declares
StorageBuffer16BitAccessandUniformAndStorageBuffer16BitAccessfor everyf16type. The Vulkan backend enabledshaderFloat16whenever the device had it, but enabled the 16-bit storage features only when cooperative matrix reported f16 shapes. A device withshaderFloat16and no f16 cooperative matrix (MI300X on RADV, lavapipe) therefore got shaders that declare features that were never enabled.Change
shader_float16is reported only whenstorageBuffer16BitAccessanduniformAndStorageBuffer16BitAccessare also supported.shader_float16is on.f16_f32_shapeskeys off the same flag, so the "auto-enableshader_float16from cooperative matrix" line is redundant and removed.The crash-marker barrier and the MI300 examples and scripts in #405 are left out.
Testing
I ran a scratch compute test on lavapipe with validation on: it reads
array<f16>from a storage buffer and writesf32. Lavapipe reportsshader_float16=trueand no f16 cooperative matrix shapes, which is the MI300X case.main, pipeline creation reportsVUID-VkShaderModuleCreateInfo-pCode-08740, once each forStorageBuffer16BitAccessandUniformAndStorageBuffer16BitAccess, plusVUID-RuntimeSpirv-storageBuffer16BitAccess-06331. Lavapipe still produces the right output.I haven't run it on MI300X hardware.
🤖 Generated with Claude Code
https://claude.ai/code/session_01W9jSvpnbXEXmoHFuUVFdUN
Generated by Claude Code