Issue automatically imported from old repo: EmbarkStudios/rust-gpu#1077
Old labels: t: enhancement
Originally creatd by kevinboulain on 2023-07-04T20:07:53Z
As far as I can tell, the workgroup/shared memory (context) can not be declared as to be zero-initialized and one has to do it manually.
KhronosGroup/Vulkan-Docs#1457 has a bunch of interesting links: the extension VK_KHR_zero_initialize_workgroup_memory (promoted to core in Vulkan 1.3) allows to declare workgroup/shared variables with a null initializer. On the SPIR-V side, OpVariable with a Workgroup storage class is allowed to be initialized with OpConstantNull only (like so).
I don't know what the project would prefer, it could be an option to pass to the SpirvBuilder (I assume it could be desirable to always initialize these variables) or another symbol (similarly to how storage_buffer allows extra arguments):
#[spirv(compute(threads(256)))]
fn compute(
#[spirv(workgroup, null_initialized = true)] array: &mut [u32; N],
// ...
) {
// ...
}
Issue automatically imported from old repo: EmbarkStudios/rust-gpu#1077
Old labels: t: enhancement
Originally creatd by kevinboulain on 2023-07-04T20:07:53Z
As far as I can tell, the workgroup/shared memory (context) can not be declared as to be zero-initialized and one has to do it manually.
KhronosGroup/Vulkan-Docs#1457 has a bunch of interesting links: the extension
VK_KHR_zero_initialize_workgroup_memory(promoted to core in Vulkan 1.3) allows to declare workgroup/shared variables with a null initializer. On the SPIR-V side,OpVariablewith aWorkgroupstorage class is allowed to be initialized withOpConstantNullonly (like so).I don't know what the project would prefer, it could be an option to pass to the
SpirvBuilder(I assume it could be desirable to always initialize these variables) or another symbol (similarly to howstorage_bufferallows extra arguments):