aco: ensure readfirstlane subdword operands are always dword aligned
authorDaniel Schürmann <daniel@schuermann.dev>
Thu, 23 Jul 2020 07:58:11 +0000 (09:58 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jul 2020 18:18:36 +0000 (18:18 +0000)
Cc: 20.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6024>

src/amd/compiler/aco_register_allocation.cpp
src/amd/compiler/aco_validate.cpp

index 2fd8d3d66d509fa3807d1274504bec01922d63c1..862b00d859b6d97f4553057aa9673f5391f4ec86 100644 (file)
@@ -318,6 +318,9 @@ void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& reg_file)
 
 unsigned get_subdword_operand_stride(chip_class chip, const aco_ptr<Instruction>& instr, unsigned idx, RegClass rc)
 {
+   /* v_readfirstlane_b32 cannot use SDWA */
+   if (instr->opcode == aco_opcode::p_as_uniform)
+      return 4;
    if (instr->format == Format::PSEUDO && chip >= GFX8)
       return rc.bytes() % 2 == 0 ? 2 : 1;
 
index e532cdf241f3b8db541cab78c0aa82a75700cdcc..97967aac9c190a1b8cdd2c09b2d0f3ef7d38c143 100644 (file)
@@ -483,6 +483,8 @@ bool validate_subdword_operand(chip_class chip, const aco_ptr<Instruction>& inst
    Operand op = instr->operands[index];
    unsigned byte = op.physReg().byte();
 
+   if (instr->opcode == aco_opcode::p_as_uniform)
+      return byte == 0;
    if (instr->format == Format::PSEUDO && chip >= GFX8)
       return true;
    if (instr->isSDWA() && (static_cast<SDWA_instruction *>(instr.get())->sel[index] & sdwa_asuint) == (sdwa_isra | op.bytes()))