radv: use fix_derivs_in_divergent_cf

fossil-db (navi21):
Totals from 3256 (2.40% of 135636) affected shaders:
MaxWaves: 65430 -> 64366 (-1.63%)
Instrs: 3517336 -> 3517724 (+0.01%); split: -0.12%, +0.13%
CodeSize: 18963788 -> 18946904 (-0.09%); split: -0.14%, +0.05%
VGPRs: 172464 -> 175872 (+1.98%); split: -0.02%, +2.00%
Latency: 33643792 -> 33643179 (-0.00%); split: -0.12%, +0.12%
InvThroughput: 5912965 -> 5934404 (+0.36%); split: -0.09%, +0.46%
VClause: 60268 -> 60275 (+0.01%); split: -0.12%, +0.13%
SClause: 125227 -> 125241 (+0.01%); split: -0.09%, +0.10%
Copies: 253452 -> 254638 (+0.47%); split: -1.29%, +1.76%
Branches: 100951 -> 100953 (+0.00%); split: -0.00%, +0.00%
PreSGPRs: 186403 -> 185641 (-0.41%)
PreVGPRs: 153751 -> 156915 (+2.06%); split: -0.06%, +2.12%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22636>
This commit is contained in:
Rhys Perry
2023-04-14 17:50:04 +01:00
committed by Marge Bot
parent 364ad2815b
commit 859e059aa9

View File

@@ -530,12 +530,21 @@ radv_postprocess_nir(struct radv_device *device, const struct radv_pipeline_layo
if (progress)
nir_shader_gather_info(stage->nir, nir_shader_get_entrypoint(stage->nir));
NIR_PASS(
_, stage->nir, ac_nir_lower_tex,
&(ac_nir_lower_tex_options){
.gfx_level = gfx_level,
.lower_array_layer_round_even = !device->physical_device->rad_info.conformant_trunc_coord,
});
bool fix_derivs_in_divergent_cf =
stage->stage == MESA_SHADER_FRAGMENT && !radv_use_llvm_for_stage(device, stage->stage);
if (fix_derivs_in_divergent_cf) {
NIR_PASS(_, stage->nir, nir_convert_to_lcssa, true, true);
nir_divergence_analysis(stage->nir);
}
NIR_PASS(_, stage->nir, ac_nir_lower_tex,
&(ac_nir_lower_tex_options){
.gfx_level = gfx_level,
.lower_array_layer_round_even = !device->physical_device->rad_info.conformant_trunc_coord,
.fix_derivs_in_divergent_cf = fix_derivs_in_divergent_cf,
.max_wqm_vgprs = 64, // TODO: improve spiller and RA support for linear VGPRs
});
if (fix_derivs_in_divergent_cf)
NIR_PASS(_, stage->nir, nir_opt_remove_phis); /* cleanup LCSSA phis */
if (stage->nir->info.uses_resource_info_query)
NIR_PASS(_, stage->nir, ac_nir_lower_resinfo, gfx_level);