Expand description
Synchronization primitives (barriers, atomics).
CPU- and CUDA-compatible wrappers for spirv_std::arch functions.
On target_arch = "spirv", these delegate to the real SPIR-V intrinsics.
On target_arch = "nvptx64", these use LLVM NVVM intrinsics for CUDA.
On the CPU, they provide functional equivalents using std::sync primitives.
Shader code should import from this module instead of spirv_std::arch directly
to enable CPU and CUDA execution.
Functionsยง
- atomic_
add_ f32 - Atomically adds a float
valueto the f32 stored (as u32 bits) atptr. - atomic_
add_ i32 - Atomically adds
valueto*ptrand returns the old value. - atomic_
add_ u32 - Atomically adds
valueto*ptr(u32) and returns the old value. - atomic_
add_ u32_ workgroup - Atomically adds
valueto*ptr(workgroup scope) and returns the old value. - atomic_
and_ u32 - Atomically ANDs
*ptrwithvalueand returns the old value. - atomic_
compare_ exchange_ u32 - Atomically compares
*ptrwithcomparatorand, if equal, replaces withvalue. Returns the old value at*ptr. - atomic_
exchange_ u32 - Atomically exchanges
*ptrwithvalueand returns the old value. - atomic_
load_ u32 - Atomically loads the value at
*ptr. - atomic_
load_ u32_ shared - Atomically loads the value at
*ptrfrom a shared reference. - atomic_
load_ u32_ workgroup - Atomically loads
*ptr(workgroup scope). - atomic_
max_ u32 - Atomically computes max(
*ptr,value) and returns the old value. - atomic_
max_ u32_ workgroup - Atomically computes max(
*ptr,value) (workgroup scope) and returns the old value. - atomic_
min_ u32 - Atomically computes min(
*ptr,value) and returns the old value. - atomic_
or_ u32 - Atomically ORs
*ptrwithvalueand returns the old value. - atomic_
store_ u32_ workgroup - Atomically stores
valueto*ptr(workgroup scope). - control_
barrier - Control barrier with explicit execution scope, memory scope, and semantics.
- subgroup_
f_ add - Subgroup (wave/warp) floating-point add reduction.
- subgroup_
f_ max - Subgroup (wave/warp) floating-point max reduction.
- workgroup_
memory_ barrier_ with_ group_ sync - Workgroup memory barrier with group synchronization.