diff --git a/src/intel/compiler/brw/brw_from_nir.cpp b/src/intel/compiler/brw/brw_from_nir.cpp index 11aa0df5624..7a2cd2b4c57 100644 --- a/src/intel/compiler/brw/brw_from_nir.cpp +++ b/src/intel/compiler/brw/brw_from_nir.cpp @@ -250,6 +250,8 @@ brw_from_nir_emit_impl(nir_to_brw_state &ntb, nir_function_impl *impl) ntb.ssa_values = rzalloc_array(ntb.mem_ctx, brw_reg, impl->ssa_alloc); ntb.ssa_bind_infos = rzalloc_array(ntb.mem_ctx, struct brw_bind_info, impl->ssa_alloc); + assert(impl->valid_metadata & nir_metadata_divergence); + brw_from_nir_emit_cf_list(ntb, &impl->body); } diff --git a/src/intel/compiler/brw/brw_nir.c b/src/intel/compiler/brw/brw_nir.c index e2e7cab6811..0ee43cab65e 100644 --- a/src/intel/compiler/brw/brw_nir.c +++ b/src/intel/compiler/brw/brw_nir.c @@ -689,7 +689,17 @@ brw_nir_lower_deferred_urb_writes(nir_shader *nir, free(outputs); - return nir_progress(true, impl, nir_metadata_control_flow); + bool progress = nir_progress(true, impl, nir_metadata_control_flow); + + if (progress) { + /* This is important! brw_from_nir really, really needs divergence + * information. Call this explicitly here becuase this function just + * dirtied divergence metadata. + */ + nir_divergence_analysis(nir); + } + + return progress; } @@ -3262,6 +3272,12 @@ brw_postprocess_nir_out_of_ssa(brw_pass_tracker *pt, nir_sweep(nir); + /* This is important! brw_from_nir really, really needs divergence + * information. Calculate it here so that it will be logged with + * INTEL_DEBUG=shaders or INTEL_DEBUG=mda. + */ + nir_divergence_analysis(nir); + if (unlikely(debug_enabled)) { fprintf(stderr, "NIR (final form) for %s shader:\n", _mesa_shader_stage_to_string(nir->info.stage));