brw/copy: Don't copy propagate through smaller entry dest size

Copy propagation would incorrectly occur in this code

    mov(16) v4+2.0:UW, u0<0>:UW NoMask
    ...
    mov(8) v6+2.0:UD, v4+2.0:UD NoMask group0

to create

    mov(16) v4+2.0:UW, u0<0>:UW NoMask
    ...
    mov(8) v6+2.0:UD, u0<0>:UD NoMask group0

This has different behavior. I think I just made a mistake when I
changed this condition in e3f502e007.

It seems like this condition could be relaxed to cover cases like (note
the change of destination stride)

    mov(16) v4+2.0<2>:UW, u0<0>:UW NoMask
    ...
    mov(8) v6+2.0:UD, v4+2.0:UD NoMask group0

I'm not sure it's worth it.

No shader-db or fossil-db changes on any Intel platform. Even the code
for the test case mentioned in the original commit did not change.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Fixes: e3f502e007 ("intel/fs: Allow copy propagation between MOVs of mixed sizes")
Closes: #12116
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32041>
This commit is contained in:
Ian Romanick
2024-11-05 14:37:55 -08:00
committed by Marge Bot
parent ced2404cb4
commit 80a5d158ae

View File

@@ -825,9 +825,8 @@ try_copy_propagate(const brw_compiler *compiler, fs_inst *inst,
* destination of the copy, and simply replacing the sources would give a
* program with different semantics.
*/
if ((brw_type_size_bits(entry->dst.type) < brw_type_size_bits(inst->src[arg].type) ||
entry->is_partial_write) &&
inst->opcode != BRW_OPCODE_MOV) {
if (brw_type_size_bits(entry->dst.type) < brw_type_size_bits(inst->src[arg].type) ||
(entry->is_partial_write && inst->opcode != BRW_OPCODE_MOV)) {
return false;
}
@@ -1506,8 +1505,7 @@ try_copy_propagate_def(const brw_compiler *compiler,
* destination of the copy, and simply replacing the sources would give a
* program with different semantics.
*/
if (inst->opcode != BRW_OPCODE_MOV &&
brw_type_size_bits(def->dst.type) <
if (brw_type_size_bits(def->dst.type) <
brw_type_size_bits(inst->src[arg].type))
return false;