Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are atomic float operations in shaders supported with Vulkan?

For OpenGL, the Nvidia extension NV_shader_atomic_float [1] exists which enables atomic read-modify-write operations to buffer or texture memory with floating-point components in GLSL shaders.

Does this functionality also exist with Vulkan? I couldn't find information about any extension which would enable that. Is that functionality not provided via a Vulkan extension?

[1] https://www.khronos.org/registry/OpenGL/extensions/NV/NV_shader_atomic_float.txt

like image 848
j00hi Avatar asked Dec 05 '18 16:12

j00hi


2 Answers

No, there is no Vulkan extension that provides atomic floating-point operations (yet?). Presumably Nvidia could create such an extension if they saw enough developer demand for it.

SPIR-V supports atomic instructions with floating-point types, but SPIR-V modules that contain those are currently forbidden by Vulkan's SPIR-V environment spec:

Atomic instructions must declare a scalar 32-bit integer type, or a scalar 64-bit integer type if the Int64Atomics capability is enabled, for the value pointed to by Pointer.

like image 161
Jesse Hall Avatar answered Nov 20 '22 05:11

Jesse Hall


Here it is: VK_EXT_shader_atomic_float
The extension has been added in July 2020 by NVIDIA and is compatible with all Vulkan versions.

Citing the spec. description:

This extension allows a shader to contain floating-point atomic operations on buffer, workgroup, and image memory. It also advertises the SPIR-V AtomicFloat32AddEXT and AtomicFloat64AddEXT capabilities that allows atomic addition on floating-points numbers. The supported operations include OpAtomicFAddEXT, OpAtomicExchange, OpAtomicLoad and OpAtomicStore.

There are already some entries on gpuinfo.org indicating support for the extension. Applears like NVIDIA drivers 451.79.0.0 or later are required.

like image 3
j00hi Avatar answered Nov 20 '22 04:11

j00hi