nir/instr_set: hash tex sources commutatively
I'm not sure if two otherwise equal texture instructions ever have sources in different orders, but they should be considered equal. ministat of nir_opt_cse: N Min Max Median Avg Stddev x 9 6.586801 6.718673 6.682875 6.6621411 0.047817119 + 9 6.519098 6.609235 6.552997 6.5605604 0.028879587 Difference at 95.0% confidence -0.101581 +/- 0.0394755 -1.52475% +/- 0.585928% (Student's t, pooled s = 0.0395) Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30145>
This commit is contained in:
@@ -240,10 +240,8 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr)
|
||||
memcpy(v + 20, &backend_flags, 4);
|
||||
hash = XXH32(v, sizeof(v), hash);
|
||||
|
||||
for (unsigned i = 0; i < instr->num_srcs; i++) {
|
||||
hash = HASH(hash, instr->src[i].src_type);
|
||||
hash = hash_src(hash, &instr->src[i].src);
|
||||
}
|
||||
for (unsigned i = 0; i < instr->num_srcs; i++)
|
||||
hash *= hash_src(0, &instr->src[i].src);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
Reference in New Issue
Block a user