aco: Add some validation for PSEUDO_REDUCTION instructions.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7232>
This commit is contained in:
Timur Kristóf 2020-10-15 10:23:42 +02:00
parent 260f9c503a
commit 8d6246205a
1 changed files with 13 additions and 0 deletions

View File

@ -401,6 +401,19 @@ bool validate_ir(Program* program)
}
break;
}
case Format::PSEUDO_REDUCTION: {
for (const Operand &op : instr->operands)
check(op.regClass().type() == RegType::vgpr, "All operands of PSEUDO_REDUCTION instructions must be in VGPRs.", instr.get());
unsigned cluster_size = static_cast<Pseudo_reduction_instruction *>(instr.get())->cluster_size;
if (instr->opcode == aco_opcode::p_reduce && cluster_size == program->wave_size)
check(instr->definitions[0].regClass().type() == RegType::sgpr, "The result of unclustered reductions must go into an SGPR.", instr.get());
else
check(instr->definitions[0].regClass().type() == RegType::vgpr, "The result of scans and clustered reductions must go into a VGPR.", instr.get());
break;
}
case Format::SMEM: {
if (instr->operands.size() >= 1)
check((instr->operands[0].isFixed() && !instr->operands[0].isConstant()) ||