nir/opt_move_discards_to_top: use nir_intrinsic_can_reorder

fossil-db (navi21):
Totals from 2306 (2.90% of 79395) affected shaders:
MaxWaves: 65920 -> 65952 (+0.05%); split: +0.22%, -0.17%
Instrs: 1056765 -> 1058517 (+0.17%); split: -0.09%, +0.26%
CodeSize: 5802396 -> 5808076 (+0.10%); split: -0.13%, +0.23%
VGPRs: 79976 -> 79248 (-0.91%); split: -1.46%, +0.55%
Latency: 17215154 -> 17527774 (+1.82%); split: -0.11%, +1.92%
InvThroughput: 4911203 -> 4918838 (+0.16%); split: -0.06%, +0.22%
VClause: 16214 -> 16268 (+0.33%); split: -0.44%, +0.78%
SClause: 33208 -> 34167 (+2.89%); split: -1.02%, +3.91%
Copies: 58352 -> 58343 (-0.02%); split: -1.20%, +1.18%
Branches: 21857 -> 21863 (+0.03%); split: -0.02%, +0.05%
PreSGPRs: 73666 -> 74298 (+0.86%); split: -0.82%, +1.67%
PreVGPRs: 55234 -> 55720 (+0.88%); split: -0.41%, +1.29%
VALU: 756386 -> 756329 (-0.01%); split: -0.06%, +0.05%
SALU: 123838 -> 124320 (+0.39%); split: -0.35%, +0.74%
VMEM: 25002 -> 25009 (+0.03%)
SMEM: 60765 -> 60580 (-0.30%); split: -0.41%, +0.11%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32145>
This commit is contained in:
Rhys Perry 2024-11-07 16:51:03 +00:00 committed by Marge Bot
parent fff3eb7848
commit 08e355a287

View file

@ -49,14 +49,8 @@ add_src_to_worklist(nir_src *src, void *worklist)
if (instr->type == nir_instr_type_intrinsic) {
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
if (intrin->intrinsic == nir_intrinsic_load_deref) {
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
if (!nir_deref_mode_is_one_of(deref, nir_var_read_only_modes))
return false;
} else if (!(nir_intrinsic_infos[intrin->intrinsic].flags &
NIR_INTRINSIC_CAN_REORDER)) {
if (!nir_intrinsic_can_reorder(intrin))
return false;
}
}
/* Set pass_flags and remember the instruction to add it's own sources and for potential