aco: allow p_start_linear_vgpr to use multiple operands
Merging the p_create_vector into the p_start_linear_vgpr is useful since we stopped attempting to place the p_start_linear_vgpr definition in the same registers as the operand. fossil-db (navi31): Totals from 927 (1.17% of 79242) affected shaders: MaxWaves: 26412 -> 26442 (+0.11%) Instrs: 938328 -> 938181 (-0.02%); split: -0.14%, +0.13% CodeSize: 4891448 -> 4890820 (-0.01%); split: -0.11%, +0.10% VGPRs: 47016 -> 47004 (-0.03%); split: -0.13%, +0.10% SpillSGPRs: 222 -> 226 (+1.80%) Latency: 5076065 -> 5075191 (-0.02%); split: -0.12%, +0.10% InvThroughput: 712316 -> 712421 (+0.01%); split: -0.09%, +0.10% SClause: 27992 -> 27972 (-0.07%); split: -0.09%, +0.02% Copies: 38042 -> 38104 (+0.16%); split: -1.95%, +2.12% PreVGPRs: 39448 -> 39369 (-0.20%) VALU: 570157 -> 570224 (+0.01%); split: -0.13%, +0.14% SALU: 51672 -> 51678 (+0.01%); split: -0.01%, +0.02% Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27697>
This commit is contained in:
@@ -366,6 +366,7 @@ validate_ir(Program* program)
|
||||
bool flat = instr->isFlatLike();
|
||||
bool can_be_undef = is_phi(instr) || instr->isEXP() || instr->isReduction() ||
|
||||
instr->opcode == aco_opcode::p_create_vector ||
|
||||
instr->opcode == aco_opcode::p_start_linear_vgpr ||
|
||||
instr->opcode == aco_opcode::p_jump_to_epilog ||
|
||||
instr->opcode == aco_opcode::p_dual_src_export_gfx11 ||
|
||||
instr->opcode == aco_opcode::p_end_with_regs ||
|
||||
@@ -527,20 +528,26 @@ validate_ir(Program* program)
|
||||
|
||||
switch (instr->format) {
|
||||
case Format::PSEUDO: {
|
||||
if (instr->opcode == aco_opcode::p_create_vector) {
|
||||
if (instr->opcode == aco_opcode::p_create_vector ||
|
||||
instr->opcode == aco_opcode::p_start_linear_vgpr) {
|
||||
unsigned size = 0;
|
||||
for (const Operand& op : instr->operands) {
|
||||
check(op.bytes() < 4 || size % 4 == 0, "Operand is not aligned", instr.get());
|
||||
size += op.bytes();
|
||||
}
|
||||
check(size == instr->definitions[0].bytes(),
|
||||
"Definition size does not match operand sizes", instr.get());
|
||||
if (!instr->operands.empty() || instr->opcode == aco_opcode::p_create_vector) {
|
||||
check(size == instr->definitions[0].bytes(),
|
||||
"Definition size does not match operand sizes", instr.get());
|
||||
}
|
||||
if (instr->definitions[0].regClass().type() == RegType::sgpr) {
|
||||
for (const Operand& op : instr->operands) {
|
||||
check(op.isConstant() || op.regClass().type() == RegType::sgpr,
|
||||
"Wrong Operand type for scalar vector", instr.get());
|
||||
}
|
||||
}
|
||||
if (instr->opcode == aco_opcode::p_start_linear_vgpr)
|
||||
check(instr->definitions[0].regClass().is_linear_vgpr(),
|
||||
"Definition must be linear VGPR", instr.get());
|
||||
} else if (instr->opcode == aco_opcode::p_extract_vector) {
|
||||
check(!instr->operands[0].isConstant() && instr->operands[1].isConstant(),
|
||||
"Wrong Operand types", instr.get());
|
||||
@@ -680,15 +687,6 @@ validate_ir(Program* program)
|
||||
instr->operands[i].isOfType(RegType::vgpr) || instr->operands[i].isUndefined(),
|
||||
"Operands of p_dual_src_export_gfx11 must be VGPRs or undef", instr.get());
|
||||
}
|
||||
} else if (instr->opcode == aco_opcode::p_start_linear_vgpr) {
|
||||
check(instr->definitions.size() == 1, "Must have one definition", instr.get());
|
||||
check(instr->operands.size() <= 1, "Must have one or zero operands", instr.get());
|
||||
if (!instr->definitions.empty())
|
||||
check(instr->definitions[0].regClass().is_linear_vgpr(),
|
||||
"Definition must be linear VGPR", instr.get());
|
||||
if (!instr->definitions.empty() && !instr->operands.empty())
|
||||
check(instr->definitions[0].bytes() == instr->operands[0].bytes(),
|
||||
"Operand size must match definition", instr.get());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user