SPIR-V already supports control flow attributes (see SpvLoopControlMask and SpvSelectionControlMask).
There is the GL_EXT_control_flow_attributes extension that exposes those in GLSL and glslang already implements it. glslang's also implements them in its HLSL backend.
When I use those attributes in a project of mine I observe some nice reduction in VGPR usage on AMDVLK. In RADV though I see no difference.
I greped in mesa for those parameters and I didn't find any code using them.
Is it possible to add support?
Apart from my selfish reasons for asking this, I'd like to mention that DX11 games running through wine/proton/DXVK layers would probably make use of them since HLSL supported those for quite some time already.
I'd also like to see these implemented. AMDVLK supports them and we've had several cases where we've been able to get significant performance improvements on complex shaders with that driver by manually forcing some loops to be unrolled or not unrolled.
I'll take a look at this it should hopefully not be too difficult.
(In reply to Alex Smith from comment #1)
> I'd also like to see these implemented. AMDVLK supports them and we've had
> several cases where we've been able to get significant performance
> improvements on complex shaders with that driver by manually forcing some
> loops to be unrolled or not unrolled.
Are you able to provide examples of the games you uses these masks in? I'd like to be able to confirm if the same setting provide a boost/regression in RADV vs not supporting them.
I've created a merge request  that implements the spirv control masks.
Thanks for doing this. I'm out of the office this week so I can't get an example right now, will get one and test the MR once I'm back.
I've pushed some patches that enable loop and selection control support for spriv. I you want the GL_EXT_control_flow_attributes extension supported also then I would suggest opening a separate bug against the glsl-compiler. Closing.