aco: Don't use vcmpx with DPP.

V_CMPX+DPP returns 0 with reads from disabled lanes, unlike V_CMP+DPP (RDNA3 ISA doc, 7.7)

Fixes: baab6f18c9 ("aco: Optimize branching sequence during SSA elimination.")
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20537>
(cherry picked from commit 4fbcd046ce)
This commit is contained in:
Georg Lehmann 2023-01-05 17:20:42 +01:00 committed by Dylan Baker
parent 8405d14633
commit 14c0675135
2 changed files with 7 additions and 4 deletions

View file

@ -688,7 +688,7 @@
"description": "aco: Don't use vcmpx with DPP.",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "baab6f18c91166b275c339027dcd87ce57795cd5"
},

View file

@ -363,6 +363,10 @@ try_optimize_branching_sequence(ssa_elimination_ctx& ctx, Block& block, const in
exec_val->isVOPC() ? get_vcmpx(exec_val->opcode) : aco_opcode::num_opcodes;
const bool vopc = v_cmpx_op != aco_opcode::num_opcodes;
/* V_CMPX+DPP returns 0 with reads from disabled lanes, unlike V_CMP+DPP (RDNA3 ISA doc, 7.7) */
if (vopc && exec_val->isDPP())
return;
/* If s_and_saveexec is used, we'll need to insert a new instruction to save the old exec. */
bool save_original_exec = exec_copy->opcode == and_saveexec;
@ -452,11 +456,10 @@ try_optimize_branching_sequence(ssa_elimination_ctx& ctx, Block& block, const in
if (vopc) {
/* Add one extra definition for exec and copy the VOP3-specific fields if present. */
if (!vcmpx_exec_only) {
if (exec_val->isSDWA() || exec_val->isDPP()) {
if (exec_val->isSDWA()) {
/* This might work but it needs testing and more code to copy the instruction. */
return;
}
else if (!exec_val->isVOP3()) {
} else if (!exec_val->isVOP3()) {
aco_ptr<Instruction> tmp = std::move(exec_val);
exec_val.reset(create_instruction<VOPC_instruction>(
tmp->opcode, tmp->format, tmp->operands.size(), tmp->definitions.size() + 1));