From 9538d523b6fef82dad5265a458cfba72e93a02f7 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 17 Dec 2022 12:39:25 +0100 Subject: [PATCH] aco: Validate GFX11 NSA correctly. Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_validate.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index a668dd8..0494f4c 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -653,13 +653,20 @@ validate_ir(Program* program) check(instr->operands.size() == 4 || program->gfx_level >= GFX10, "NSA is only supported on GFX10+", instr.get()); for (unsigned i = 3; i < instr->operands.size(); i++) { - if (instr->operands.size() == 4) { - check(instr->operands[i].hasRegClass() && - instr->operands[i].regClass().type() == RegType::vgpr, - "MIMG operands[3] (VADDR) must be VGPR", instr.get()); - } else { - check(instr->operands[i].regClass() == v1, "MIMG VADDR must be v1 if NSA is used", - instr.get()); + check(instr->operands[i].hasRegClass() && + instr->operands[i].regClass().type() == RegType::vgpr, + "MIMG operands[3+] (VADDR) must be VGPR", instr.get()); + if (instr->operands.size() > 4) { + if (program->gfx_level < GFX11) { + check(instr->operands[i].regClass() == v1, + "GFX10 MIMG VADDR must be v1 if NSA is used", instr.get()); + } else { + if (instr->opcode != aco_opcode::image_bvh_intersect_ray && + instr->opcode != aco_opcode::image_bvh64_intersect_ray && i < 7) { + check(instr->operands[i].regClass() == v1, + "first 4 GFX11 MIMG VADDR must be v1 if NSA is used", instr.get()); + } + } } } -- 2.7.4