nir/search: Use range analysis for is_finite
There are only a couple patterns that use is_finite, so the changes aren't huge. Mostly shaders from Batman Arkham City and a few shaders from Shadow of the Tomb Raider were affected. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Tiger Lake Instructions in all programs: 160902591 -> 160902489 (-0.0%) SENDs in all programs: 6812270 -> 6812270 (+0.0%) Loops in all programs: 38225 -> 38225 (+0.0%) Cycles in all programs: 7429003266 -> 7428992369 (-0.0%) Spills in all programs: 192582 -> 192582 (+0.0%) Fills in all programs: 304539 -> 304539 (+0.0%) Ice Lake Instructions in all programs: 145301634 -> 145301460 (-0.0%) SENDs in all programs: 6863890 -> 6863890 (+0.0%) Loops in all programs: 38219 -> 38219 (+0.0%) Cycles in all programs: 8798589772 -> 8798575869 (-0.0%) Spills in all programs: 216880 -> 216880 (+0.0%) Fills in all programs: 334250 -> 334250 (+0.0%) Skylake Instructions in all programs: 135892010 -> 135891836 (-0.0%) SENDs in all programs: 6802916 -> 6802916 (+0.0%) Loops in all programs: 38216 -> 38216 (+0.0%) Cycles in all programs: 8442597324 -> 8442583202 (-0.0%) Spills in all programs: 194839 -> 194839 (+0.0%) Fills in all programs: 301116 -> 301116 (+0.0%) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9108>
This commit is contained in:
parent
f4a7dbc58f
commit
7019cd84c0
|
@ -422,35 +422,15 @@ is_integral(struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
|||
|
||||
/**
|
||||
* Is the value finite?
|
||||
*
|
||||
* Doesn't actually use range tracking. Just checks that the value is a
|
||||
* constant that is finite.
|
||||
*/
|
||||
static inline bool
|
||||
is_finite(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src,
|
||||
unsigned num_components, const uint8_t *swizzle)
|
||||
is_finite(UNUSED struct hash_table *ht, const nir_alu_instr *instr,
|
||||
unsigned src, UNUSED unsigned num_components,
|
||||
UNUSED const uint8_t *swizzle)
|
||||
{
|
||||
if (nir_src_as_const_value(instr->src[src].src) == NULL)
|
||||
return false;
|
||||
const struct ssa_result_range v = nir_analyze_range(ht, instr, src);
|
||||
|
||||
for (unsigned i = 0; i < num_components; i++) {
|
||||
nir_alu_type type = nir_op_infos[instr->op].input_types[src];
|
||||
switch (nir_alu_type_get_base_type(type)) {
|
||||
case nir_type_float:
|
||||
if (!isfinite(nir_src_comp_as_float(instr->src[src].src, swizzle[i])))
|
||||
return false;
|
||||
break;
|
||||
case nir_type_bool:
|
||||
case nir_type_int:
|
||||
case nir_type_uint:
|
||||
/* Non-float types are always finite. */
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return v.is_finite;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue