r600/sfn: add read instruction for unused but required LDS op results

DS_XCHG_RET and LDS_CMP_XCHG_RET don't have a version that doesn't return
a value in the LDS red queue. so we have to read the value from the queue
and discard it.

Fixes: 79ca456b (r600/sfn: rewrite NIR backend)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23518>
(cherry picked from commit 976d6de232)
This commit is contained in:
Gert Wollny 2023-05-31 17:44:16 +02:00 committed by Eric Engestrom
parent a15c0c6cbe
commit be94874276
3 changed files with 10 additions and 1 deletions

View file

@ -3496,7 +3496,7 @@
"description": "r600/sfn: add read instruction for unused but required LDS op results",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "79ca456b4837b3bc21cf9ef3c03c505c4b4909f6"
},

View file

@ -142,6 +142,7 @@ LDSReadInstr::split(std::vector<AluInstr *>& out_block, AluInstr *last_lds_instr
AluInstr::last_write);
instr->add_required_instr(last_lds_instr);
instr->set_blockid(block_id(), index());
instr->set_always_keep();
out_block.push_back(instr);
last_lds_instr = instr;
}

View file

@ -931,6 +931,14 @@ Shader::emit_atomic_local_shared(nir_intrinsic_instr *instr)
auto op = lds_op_from_intrinsic(instr->intrinsic, uses_retval);
/* For these two instructions we don't have opcodes that don't read back
* the result, so we have to add a dummy-readback to remove the the return
* value from read queue. */
if (!uses_retval &&
(op == LDS_XCHG_RET || op == LDS_CMP_XCHG_RET)) {
dest_value = vf.dest(instr->dest, 0, pin_free);
}
auto address = vf.src(instr->src[0], 0);
AluInstr::SrcValues src;