nir/search_helpers: check tex source type in is_only_used_as_float

Foz-DB Navi21:
Totals from 164 (0.21% of 79377) affected shaders:
Instrs: 197477 -> 197035 (-0.22%); split: -0.23%, +0.01%
CodeSize: 1052944 -> 1051140 (-0.17%); split: -0.18%, +0.01%
VGPRs: 8104 -> 8080 (-0.30%)
Latency: 1115663 -> 1115567 (-0.01%); split: -0.06%, +0.05%
InvThroughput: 265822 -> 265158 (-0.25%); split: -0.26%, +0.01%
VClause: 3792 -> 3789 (-0.08%); split: -0.11%, +0.03%
SClause: 5738 -> 5744 (+0.10%); split: -0.02%, +0.12%
Copies: 12223 -> 12200 (-0.19%); split: -0.53%, +0.34%
PreVGPRs: 6807 -> 6801 (-0.09%); split: -0.15%, +0.06%
VALU: 139206 -> 138785 (-0.30%); split: -0.31%, +0.01%
SALU: 27852 -> 27853 (+0.00%)

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33674>
This commit is contained in:
Georg Lehmann
2025-02-21 17:39:43 +01:00
committed by Marge Bot
parent 3d8585e4fc
commit 5da76df4cd
+12
View File
@@ -578,6 +578,18 @@ is_only_used_as_float_impl(const nir_alu_instr *instr, unsigned depth)
default:
break;
}
} else if (user_instr->type == nir_instr_type_tex) {
const nir_tex_instr *tex = nir_instr_as_tex(user_instr);
const nir_tex_src *tex_src = container_of(src, nir_tex_src, src);
/* These have unknown type. */
if (tex_src->src_type == nir_tex_src_backend1 ||
tex_src->src_type == nir_tex_src_backend2)
return false;
unsigned idx = tex_src - tex->src;
if (nir_tex_instr_src_type(tex, idx) == nir_type_float)
continue;
}
return false;
}