4 ms·
Nice post! Is there a way to directly use uniform variables in e.g. OpenCL, or is it up to the kernel compiler to determine that some variable is wavefront- or
by Athas 8y ago
Nice post! Is there a way to directly use uniform variables in e.g. OpenCL, or is it up to the kernel compiler to determine that some variable is wavefront- or group-invariant?
- MaxBarraclough 8y agoI'm only skim-reading but it tastes like OpenCL's '__local' address-space qualifier https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/local.html https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xht...
- Athas 8y agoOh yes, I suppose that might work. I've been using lots of local memory for facilitating communication and caching, but never made the connection that the compiler might map non-addressed local variables to uniforms.
- tomtomlapomme 8y ago__local is meant to describe memory shared across the whole workgroup meaning each operation is visible to all SIMD lanes. Uniform are variables that have are only visible to one lane but can be proven to have the same value for all SIMD lanes. In general it is up to the compiler to decide what variables are uniform as it is pretty easy for user to get it wrong. Metal shader language as a uniform marker: uniform<int> i = …; Metal spec: https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf https://developer.apple.com/metal/Metal-Shading-Language-Spe...