aco: validate that SMEM operands can use fixed registers
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 19 Aug 2020 07:41:42 +0000 (09:41 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 24 Aug 2020 11:08:24 +0000 (11:08 +0000)
To fix a validation error when loading the scalar tma buffer
descriptor because it's not a temp but a fixed reg (tma_lo/tma_hi).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6384>

src/amd/compiler/aco_validate.cpp

index 0d74458519c488dc15fb0b4f2c0cc5b53cb4a887..fce0e1a1189e920b8f017bf77f0b569346711230 100644 (file)
@@ -378,7 +378,8 @@ bool validate_ir(Program* program)
          }
          case Format::SMEM: {
             if (instr->operands.size() >= 1)
-               check(instr->operands[0].isTemp() && instr->operands[0].regClass().type() == RegType::sgpr, "SMEM operands must be sgpr", instr.get());
+               check((instr->operands[0].isFixed() && !instr->operands[0].isConstant()) ||
+                     (instr->operands[0].isTemp() && instr->operands[0].regClass().type() == RegType::sgpr), "SMEM operands must be sgpr", instr.get());
             if (instr->operands.size() >= 2)
                check(instr->operands[1].isConstant() || (instr->operands[1].isTemp() && instr->operands[1].regClass().type() == RegType::sgpr),
                      "SMEM offset must be constant or sgpr", instr.get());