aco: fix validation of sub-dword parallel-copies
Only the operands with a sub-dword definition need to be checked. 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/6662>
This commit is contained in:
@@ -323,23 +323,34 @@ bool validate_ir(Program* program)
|
|||||||
|
|
||||||
switch (instr->format) {
|
switch (instr->format) {
|
||||||
case Format::PSEUDO: {
|
case Format::PSEUDO: {
|
||||||
bool is_subdword = false;
|
if (instr->opcode == aco_opcode::p_parallelcopy) {
|
||||||
bool has_const_sgpr = false;
|
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
||||||
bool has_literal = false;
|
if (!instr->definitions[i].regClass().is_subdword())
|
||||||
for (Definition def : instr->definitions)
|
continue;
|
||||||
is_subdword |= def.regClass().is_subdword();
|
Operand op = instr->operands[i];
|
||||||
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
check(!op.isLiteral(), "Sub-dword copies cannot take literals", instr.get());
|
||||||
if (instr->opcode == aco_opcode::p_extract_vector && i == 1)
|
if (op.isConstant() || (op.hasRegClass() && op.regClass().type() == RegType::sgpr))
|
||||||
continue;
|
check(program->chip_class >= GFX9, "Sub-dword pseudo instructions can only take constants or SGPRs on GFX9+", instr.get());
|
||||||
Operand op = instr->operands[i];
|
}
|
||||||
is_subdword |= op.hasRegClass() && op.regClass().is_subdword();
|
} else {
|
||||||
has_const_sgpr |= op.isConstant() || (op.hasRegClass() && op.regClass().type() == RegType::sgpr);
|
bool is_subdword = false;
|
||||||
has_literal |= op.isLiteral();
|
bool has_const_sgpr = false;
|
||||||
}
|
bool has_literal = false;
|
||||||
|
for (Definition def : instr->definitions)
|
||||||
|
is_subdword |= def.regClass().is_subdword();
|
||||||
|
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
||||||
|
if (instr->opcode == aco_opcode::p_extract_vector && i == 1)
|
||||||
|
continue;
|
||||||
|
Operand op = instr->operands[i];
|
||||||
|
is_subdword |= op.hasRegClass() && op.regClass().is_subdword();
|
||||||
|
has_const_sgpr |= op.isConstant() || (op.hasRegClass() && op.regClass().type() == RegType::sgpr);
|
||||||
|
has_literal |= op.isLiteral();
|
||||||
|
}
|
||||||
|
|
||||||
check(!is_subdword || !has_const_sgpr || program->chip_class >= GFX9,
|
check(!is_subdword || !has_const_sgpr || program->chip_class >= GFX9,
|
||||||
"Sub-dword pseudo instructions can only take constants or SGPRs on GFX9+", instr.get());
|
"Sub-dword pseudo instructions can only take constants or SGPRs on GFX9+", instr.get());
|
||||||
check(!is_subdword || !has_literal, "Sub-dword pseudo instructions cannot take literals", instr.get());
|
check(!is_subdword || !has_literal, "Sub-dword pseudo instructions cannot take literals", instr.get());
|
||||||
|
}
|
||||||
|
|
||||||
if (instr->opcode == aco_opcode::p_create_vector) {
|
if (instr->opcode == aco_opcode::p_create_vector) {
|
||||||
unsigned size = 0;
|
unsigned size = 0;
|
||||||
|
Reference in New Issue
Block a user