From 1b3be07b5faf867f698668080b060a270c5f795e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 23 Jul 2020 09:58:11 +0200 Subject: [PATCH] aco: ensure readfirstlane subdword operands are always dword aligned Cc: 20.1 Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 3 +++ src/amd/compiler/aco_validate.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 2fd8d3d66d5..862b00d859b 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -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& 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; diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index e532cdf241f..97967aac9c1 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -483,6 +483,8 @@ bool validate_subdword_operand(chip_class chip, const aco_ptr& 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(instr.get())->sel[index] & sdwa_asuint) == (sdwa_isra | op.bytes())) -- 2.30.2