Module: Mesa Branch: main Commit: f6b281a1c2b3dbbb04397641cd18fd0415a08405 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6b281a1c2b3dbbb04397641cd18fd0415a08405
Author: Daniel Schürmann <[email protected]> Date: Fri Aug 13 14:38:40 2021 +0200 aco/validate: simplify get_subdword_bytes_written() Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12364> --- src/amd/compiler/aco_validate.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index 500266f58cf..602c4367348 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -763,8 +763,17 @@ get_subdword_bytes_written(Program* program, const aco_ptr<Instruction>& instr, if (instr->isPseudo()) return chip >= GFX8 ? def.bytes() : def.size() * 4u; - if (instr->isSDWA() && instr->sdwa().dst_sel == (sdwa_isra | def.bytes())) - return def.bytes(); + if (instr->isVALU()) { + assert(def.bytes() <= 2); + + if (instr->isSDWA() && instr->sdwa().dst_sel == (sdwa_isra | def.bytes())) + return def.bytes(); + + if (instr_is_16bit(chip, instr->opcode)) + return 2; + + return 4; + } switch (instr->opcode) { case aco_opcode::buffer_load_ubyte_d16: @@ -787,20 +796,8 @@ get_subdword_bytes_written(Program* program, const aco_ptr<Instruction>& instr, case aco_opcode::global_load_short_d16_hi: case aco_opcode::ds_read_u8_d16_hi: case aco_opcode::ds_read_u16_d16_hi: return program->dev.sram_ecc_enabled ? 4 : 2; - case aco_opcode::v_mad_f16: - case aco_opcode::v_mad_u16: - case aco_opcode::v_mad_i16: - case aco_opcode::v_fma_f16: - case aco_opcode::v_div_fixup_f16: - case aco_opcode::v_interp_p2_f16: - if (chip >= GFX9) - return 2; - break; - default: break; + default: return def.size() * 4; } - - return MAX2(chip >= GFX10 ? def.bytes() : 4, - instr_info.definition_size[(int)instr->opcode] / 8u); } } /* end namespace */
