mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 20:08:06 +02:00
aco: simplify Phi RegClass selection
Also adds moves validation rules to aco_validate. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11181>
This commit is contained in:
parent
dc807dff3e
commit
d4662e38c4
2 changed files with 11 additions and 22 deletions
|
|
@ -520,8 +520,6 @@ setup_nir(isel_context *ctx, nir_shader *nir)
|
|||
void init_context(isel_context *ctx, nir_shader *shader)
|
||||
{
|
||||
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
|
||||
unsigned lane_mask_size = ctx->program->lane_mask.size();
|
||||
|
||||
ctx->shader = shader;
|
||||
|
||||
/* Init NIR range analysis. */
|
||||
|
|
@ -936,36 +934,23 @@ void init_context(isel_context *ctx, nir_shader *shader)
|
|||
}
|
||||
case nir_instr_type_phi: {
|
||||
nir_phi_instr* phi = nir_instr_as_phi(instr);
|
||||
RegType type;
|
||||
unsigned size = phi->dest.ssa.num_components;
|
||||
|
||||
if (phi->dest.ssa.bit_size == 1) {
|
||||
assert(size == 1 && "multiple components not yet supported on boolean phis.");
|
||||
type = RegType::sgpr;
|
||||
size *= lane_mask_size;
|
||||
regclasses[phi->dest.ssa.index] = RegClass(type, size);
|
||||
break;
|
||||
}
|
||||
RegType type = RegType::sgpr;
|
||||
unsigned num_components = phi->dest.ssa.num_components;
|
||||
assert((phi->dest.ssa.bit_size != 1 || num_components == 1) &&
|
||||
"Multiple components not supported on boolean phis.");
|
||||
|
||||
if (nir_dest_is_divergent(phi->dest)) {
|
||||
type = RegType::vgpr;
|
||||
} else {
|
||||
type = RegType::sgpr;
|
||||
nir_foreach_phi_src (src, phi) {
|
||||
if (regclasses[src->src.ssa->index].type() == RegType::vgpr)
|
||||
type = RegType::vgpr;
|
||||
if (regclasses[src->src.ssa->index].type() == RegType::none)
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
|
||||
RegClass rc = get_reg_class(ctx, type, phi->dest.ssa.num_components, phi->dest.ssa.bit_size);
|
||||
if (rc != regclasses[phi->dest.ssa.index]) {
|
||||
RegClass rc = get_reg_class(ctx, type, num_components, phi->dest.ssa.bit_size);
|
||||
if (rc != regclasses[phi->dest.ssa.index])
|
||||
done = false;
|
||||
} else {
|
||||
nir_foreach_phi_src(src, phi)
|
||||
assert(regclasses[src->src.ssa->index].size() == rc.size());
|
||||
}
|
||||
regclasses[phi->dest.ssa.index] = rc;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,9 +368,13 @@ bool validate_ir(Program* program)
|
|||
} else if (instr->opcode == aco_opcode::p_phi) {
|
||||
check(instr->operands.size() == block.logical_preds.size(), "Number of Operands does not match number of predecessors", instr.get());
|
||||
check(instr->definitions[0].getTemp().type() == RegType::vgpr, "Logical Phi Definition must be vgpr", instr.get());
|
||||
} else if (instr->opcode == aco_opcode::p_linear_phi) {
|
||||
for (const Operand& op : instr->operands)
|
||||
check(instr->definitions[0].size() == op.size(), "Operand sizes must match Definition size", instr.get());
|
||||
} else if (instr->opcode == aco_opcode::p_linear_phi) {
|
||||
for (const Operand& op : instr->operands) {
|
||||
check(!op.isTemp() || op.getTemp().is_linear(), "Wrong Operand type", instr.get());
|
||||
check(instr->definitions[0].size() == op.size(), "Operand sizes must match Definition size", instr.get());
|
||||
}
|
||||
check(instr->operands.size() == block.linear_preds.size(), "Number of Operands does not match number of predecessors", instr.get());
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue