Re:More compute shaders
by Athas on Tuesday July 17, 2018 @08:11AM
(#17549100)
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?
[ Parent
| on HN ]
Re:More compute shaders
by MaxBarraclough on Tuesday July 17, 2018 @09:21AM
(#17549516)
I'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/xht...
Re:More compute shaders
by tomtomlapomme on Tuesday July 17, 2018 @11:03AM
(#17550140)
__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-Spe...
Oh 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.