Bug 108841 - [RADV] SPIRV's control flow attributes do not propagate to LLVM
Summary: [RADV] SPIRV's control flow attributes do not propagate to LLVM
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-22 21:08 UTC by Panagiotis Christopoulos Charitos
Modified: 2019-03-27 03:23 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Panagiotis Christopoulos Charitos 2018-11-22 21:08:02 UTC
Hi,

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.

Thanks.
Comment 1 Alex Smith 2019-03-06 14:28:11 UTC
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.
Comment 2 Timothy Arceri 2019-03-20 00:41:53 UTC
I'll take a look at this it should hopefully not be too difficult.
Comment 3 Timothy Arceri 2019-03-20 01:27:27 UTC
(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.
Comment 4 Timothy Arceri 2019-03-20 05:47:59 UTC
I've created a merge request [1] that implements the spirv control masks.

[1] https://gitlab.freedesktop.org/mesa/mesa/merge_requests/490/
Comment 5 Alex Smith 2019-03-20 17:31:43 UTC
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.
Comment 6 Timothy Arceri 2019-03-27 03:23:23 UTC
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.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.