Skip to content

radv: Remove dead shared variables in radv_optimize_nir.

Not sure if this is the correct fix, but the motivation for this change is that even if LDS accesses get optimized away, the LDS space is still reserved, so we probably want to remove shared variables at some point after constant folding + dead code elimination.

Here's a fossilize db to demonstrate the issue: frog.foz

Shader looks something like this:

layout(local_size_x = 128) in;
shared uvec4 shared_data[gl_WorkGroupSize.x];
...
void main() {
    ..
    if (gl_SubgroupSize > 1u)
        subgroup_path(data); // does not use shared_data
    else
        lds_path(data);
}

This would go from using 2k of LDS -> no LDS.

Merge request reports