radv: use shader_info->var_copies_lowered
Instead of passing allow_copies as a parameter for radv_optimize_nir (so manually doing that tracking). Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19338>
This commit is contained in:

committed by
Marge Bot

parent
3685528c1e
commit
a12a71e6c0
@@ -3640,7 +3640,7 @@ radv_graphics_pipeline_compile(struct radv_graphics_pipeline *pipeline,
|
||||
if (stages[i].nir) {
|
||||
int64_t stage_start = os_time_get_nano();
|
||||
|
||||
radv_optimize_nir(stages[i].nir, optimize_conservatively, false);
|
||||
radv_optimize_nir(stages[i].nir, optimize_conservatively);
|
||||
|
||||
/* Gather info again, information such as outputs_read can be out-of-date. */
|
||||
nir_shader_gather_info(stages[i].nir, nir_shader_get_entrypoint(stages[i].nir));
|
||||
@@ -5528,7 +5528,7 @@ radv_compute_pipeline_compile(struct radv_compute_pipeline *pipeline,
|
||||
/* Compile SPIR-V shader to NIR. */
|
||||
cs_stage.nir = radv_shader_spirv_to_nir(device, &cs_stage, pipeline_key, pipeline->base.is_internal);
|
||||
|
||||
radv_optimize_nir(cs_stage.nir, pipeline_key->optimisations_disabled, false);
|
||||
radv_optimize_nir(cs_stage.nir, pipeline_key->optimisations_disabled);
|
||||
|
||||
/* Gather info again, information such as outputs_read can be out-of-date. */
|
||||
nir_shader_gather_info(cs_stage.nir,
|
||||
|
@@ -170,7 +170,7 @@ radv_can_dump_shader_stats(struct radv_device *device, nir_shader *nir)
|
||||
}
|
||||
|
||||
void
|
||||
radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively, bool allow_copies)
|
||||
radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively)
|
||||
{
|
||||
bool progress;
|
||||
|
||||
@@ -180,10 +180,9 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively, bool
|
||||
NIR_PASS(progress, shader, nir_split_array_vars, nir_var_function_temp);
|
||||
NIR_PASS(progress, shader, nir_shrink_vec_array_vars, nir_var_function_temp);
|
||||
|
||||
if (allow_copies) {
|
||||
/* Only run this pass in the first call to
|
||||
* radv_optimize_nir. Later calls assume that we've
|
||||
* lowered away any copy_deref instructions and we
|
||||
if (!shader->info.var_copies_lowered) {
|
||||
/* Only run this pass if nir_lower_var_copies was not called
|
||||
* yet. That would lower away any copy_deref instructions and we
|
||||
* don't want to introduce any more.
|
||||
*/
|
||||
NIR_PASS(progress, shader, nir_opt_find_array_copies);
|
||||
@@ -1044,7 +1043,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
|
||||
NIR_PASS(_, nir, nir_opt_shrink_stores, !device->instance->disable_shrink_image_store);
|
||||
|
||||
if (!key->optimisations_disabled)
|
||||
radv_optimize_nir(nir, false, true);
|
||||
radv_optimize_nir(nir, false);
|
||||
|
||||
/* We call nir_lower_var_copies() after the first radv_optimize_nir()
|
||||
* to remove any copies introduced by nir_opt_find_array_copies().
|
||||
@@ -1124,7 +1123,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
|
||||
if (ac_nir_lower_indirect_derefs(nir, device->physical_device->rad_info.gfx_level) &&
|
||||
!key->optimisations_disabled && nir->info.stage != MESA_SHADER_COMPUTE) {
|
||||
/* Optimize the lowered code before the linking optimizations. */
|
||||
radv_optimize_nir(nir, false, false);
|
||||
radv_optimize_nir(nir, false);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -530,7 +530,7 @@ struct radv_shader_part {
|
||||
|
||||
struct radv_pipeline_layout;
|
||||
|
||||
void radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively, bool allow_copies);
|
||||
void radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively);
|
||||
void radv_optimize_nir_algebraic(nir_shader *shader, bool opt_offsets);
|
||||
|
||||
bool radv_nir_lower_ray_queries(nir_shader *shader, struct radv_device *device);
|
||||
|
Reference in New Issue
Block a user