aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitriy Nester <[email protected]>2020-02-27 15:37:00 +0200
committerMarge Bot <[email protected]>2020-05-25 19:41:09 +0000
commit33fd35e2d30f7f31a9ce465ee79d8a874355c774 (patch)
treecf6814491984aa885b3bfe1b3a389355181c8b0b
parent387176829bcef7058ff2be8f175295e9f80008e5 (diff)
r600: replace fnv1a hash function with xxhash
xxhash is faster than fnv1a in almost all circumstances, so we're switching to it globally. Signed-off-by: Dmytro Nester <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4020>
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c b/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c
index 252fa5d5786..16e43b79c0f 100644
--- a/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c
+++ b/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c
@@ -26,6 +26,8 @@
#include "nir_deref.h"
#include "util/u_dynarray.h"
#include "util/u_math.h"
+#define XXH_INLINE_ALL
+#include "util/xxhash.h"
/** @file nir_opt_vectorize_io.c
*
@@ -221,7 +223,7 @@ r600_cmp_func(const void *data1, const void *data2)
return r600_io_access_same_var(instr1, instr2);
}
-#define HASH(hash, data) _mesa_fnv32_1a_accumulate((hash), (data))
+#define HASH(hash, data) XXH32(&(data), sizeof(data), (hash))
static uint32_t
r600_hash_instr(const nir_instr *instr)
@@ -232,7 +234,7 @@ r600_hash_instr(const nir_instr *instr)
nir_variable *var =
nir_deref_instr_get_variable(nir_src_as_deref(intr->src[0]));
- uint32_t hash = _mesa_fnv32_1a_offset_bias;
+ uint32_t hash = 0;
hash = HASH(hash, var->type);
return HASH(hash, var->data.location);