Mesa (main): aco: refactor SDWA opcode validation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 12 12:25:50 UTC 2021
Module: Mesa
Branch: main
Commit: 036be42d6fe86721e11de935de4c04254c6ce228
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=036be42d6fe86721e11de935de4c04254c6ce228
Author: Daniel Schürmann <daniel at schuermann.dev>
Date: Fri Jun 11 14:55:09 2021 +0200
aco: refactor SDWA opcode validation
Reviewed-by: Tony Wasserka <tony.wasserka at gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>
---
src/amd/compiler/aco_validate.cpp | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp
index 2a89dac6807..400d58e5765 100644
--- a/src/amd/compiler/aco_validate.cpp
+++ b/src/amd/compiler/aco_validate.cpp
@@ -170,21 +170,26 @@ bool validate_ir(Program* program)
"2nd definition must be fixed to vcc with SDWA", instr.get());
}
- check(instr->opcode != aco_opcode::v_madmk_f32 &&
- instr->opcode != aco_opcode::v_madak_f32 &&
- instr->opcode != aco_opcode::v_madmk_f16 &&
- instr->opcode != aco_opcode::v_madak_f16 &&
- instr->opcode != aco_opcode::v_readfirstlane_b32 &&
- instr->opcode != aco_opcode::v_clrexcp &&
- instr->opcode != aco_opcode::v_swap_b32,
- "SDWA can't be used with this opcode", instr.get());
- if (program->chip_class != GFX8) {
- check(instr->opcode != aco_opcode::v_mac_f32 &&
- instr->opcode != aco_opcode::v_mac_f16 &&
- instr->opcode != aco_opcode::v_fmac_f32 &&
- instr->opcode != aco_opcode::v_fmac_f16,
- "SDWA can't be used with this opcode", instr.get());
- }
+ const bool sdwa_opcodes =
+ instr->opcode != aco_opcode::v_fmac_f32 &&
+ instr->opcode != aco_opcode::v_fmac_f16 &&
+ instr->opcode != aco_opcode::v_fmamk_f32 &&
+ instr->opcode != aco_opcode::v_fmaak_f32 &&
+ instr->opcode != aco_opcode::v_fmamk_f16 &&
+ instr->opcode != aco_opcode::v_fmaak_f16 &&
+ instr->opcode != aco_opcode::v_madmk_f32 &&
+ instr->opcode != aco_opcode::v_madak_f32 &&
+ instr->opcode != aco_opcode::v_madmk_f16 &&
+ instr->opcode != aco_opcode::v_madak_f16 &&
+ instr->opcode != aco_opcode::v_readfirstlane_b32 &&
+ instr->opcode != aco_opcode::v_clrexcp && instr->opcode != aco_opcode::v_swap_b32;
+
+ const bool feature_mac =
+ program->chip_class == GFX8 &&
+ (instr->opcode == aco_opcode::v_mac_f32 &&
+ instr->opcode == aco_opcode::v_mac_f16);
+
+ check(sdwa_opcodes || feature_mac, "SDWA can't be used with this opcode", instr.get());
if (instr->definitions[0].regClass().is_subdword())
check((sdwa.dst_sel & sdwa_asuint) == (sdwa_isra | instr->definitions[0].bytes()), "Unexpected SDWA sel for sub-dword definition", instr.get());
More information about the mesa-commit
mailing list