util/hash_table: added hash functions for integer types
authorAnthony Pesch <inolen@gmail.com>
Sat, 18 Jan 2020 06:38:31 +0000 (01:38 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jan 2020 17:06:57 +0000 (17:06 +0000)
commit1496cc92f6f743f10e1f3c9c63787d79febfda40
tree939b50bbe89f30dd8834380a74f78bc814206d47
parent931388ceca323750682604c7b70d355fa00d9900
util/hash_table: added hash functions for integer types

A few hash_table users roll their own integer hash functions which
call _mesa_hash_data to perform the hashing which ultimately calls
into XXH32 with a dynamic key length. When using small keys with a
constant size the hash rate can be greatly improved by inlining
XXH32 and providing it a constant key length, see:
https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html

Additionally, this patch removes calls to _mesa_key_hash_string and
makes them instead call _mesa_has_string directly, matching the new
integer hash functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3475>
20 files changed:
src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
src/compiler/glsl/glcpp/glcpp-parse.y
src/compiler/glsl/link_interface_blocks.cpp
src/compiler/glsl/link_uniform_blocks.cpp
src/compiler/glsl/link_varyings.cpp
src/compiler/glsl/lower_int64.cpp
src/compiler/glsl/lower_named_interface_blocks.cpp
src/compiler/glsl/lower_output_reads.cpp
src/compiler/glsl/string_to_uint_map.h
src/compiler/glsl/tests/varyings_test.cpp
src/compiler/glsl_types.cpp
src/compiler/nir/nir_print.c
src/intel/perf/gen_perf.c
src/mesa/program/symbol_table.c
src/util/hash_table.c
src/util/hash_table.h
src/util/tests/hash_table/destroy_callback.c
src/util/tests/hash_table/insert_and_lookup.c
src/util/tests/hash_table/remove_key.c
src/util/tests/hash_table/replacement.c