wgpu icon indicating copy to clipboard operation
wgpu copied to clipboard

64 bit support for some integer instructions

Open atlv24 opened this issue 1 year ago • 0 comments

countLeadingZeros, countOneBits, reverseBits, firstLeadingBit (FindUMsb/FindSMsb), firstTrailingBit (FindILsb), insertBits, and extractBits are all only supported for 32-bit integers in Vulkan.

This arose when implementing 64 bit integers in #5154. They can be polyfilled, but it will take some more work. Polyfills have been implemented for HLSL where needed, and they seem to be supported fine in Metal.

NOTE: my machine seems to support firstTrailingBit for 64 bit ints just fine, but the spec below says it is only supported for 32 bit. Interestingly, countTrailingZeros also works but is not explicitly unsupported for 64 bit.

see: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/StandaloneSpirv.html#VUID-StandaloneSpirv-Base-04781 and: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html#_changes_from_version_1_00_revision_5

atlv24 avatar Feb 21 '24 04:02 atlv24