ir3: Run divergence analysis at the end
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
This commit is contained in:
@@ -124,6 +124,8 @@ static const nir_shader_compiler_options ir3_base_options = {
|
||||
|
||||
.lower_int64_options = (nir_lower_int64_options)~0,
|
||||
.lower_doubles_options = (nir_lower_doubles_options)~0,
|
||||
|
||||
.divergence_analysis_options = nir_divergence_uniform_load_tears,
|
||||
};
|
||||
|
||||
struct ir3_compiler *
|
||||
|
||||
@@ -3569,6 +3569,16 @@ emit_phi(struct ir3_context *ctx, nir_phi_instr *nphi)
|
||||
|
||||
dst = ir3_get_def(ctx, &nphi->def, 1);
|
||||
|
||||
if (exec_list_is_singular(&nphi->srcs)) {
|
||||
nir_phi_src *src = list_entry(exec_list_get_head(&nphi->srcs),
|
||||
nir_phi_src, node);
|
||||
if (nphi->def.divergent == src->src.ssa->divergent) {
|
||||
dst[0] = ir3_get_src(ctx, &src->src)[0];
|
||||
ir3_put_def(ctx, &nphi->def);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
phi = ir3_instr_create(ctx->block, OPC_META_PHI, 1,
|
||||
exec_list_length(&nphi->srcs));
|
||||
__ssa_dst(phi);
|
||||
|
||||
@@ -120,8 +120,15 @@ ir3_context_init(struct ir3_compiler *compiler, struct ir3_shader *shader,
|
||||
if ((so->type == MESA_SHADER_FRAGMENT) && compiler->has_fs_tex_prefetch)
|
||||
NIR_PASS_V(ctx->s, ir3_nir_lower_tex_prefetch);
|
||||
|
||||
NIR_PASS(progress, ctx->s, nir_convert_to_lcssa, true, true);
|
||||
|
||||
NIR_PASS(progress, ctx->s, nir_lower_phis_to_scalar, true);
|
||||
|
||||
/* This has to go at the absolute end to make sure that all SSA defs are
|
||||
* correctly marked.
|
||||
*/
|
||||
NIR_PASS_V(ctx->s, nir_divergence_analysis);
|
||||
|
||||
/* Super crude heuristic to limit # of tex prefetch in small
|
||||
* shaders. This completely ignores loops.. but that's really
|
||||
* not the worst of it's problems. (A frag shader that has
|
||||
|
||||
Reference in New Issue
Block a user