aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* ra: Disable round-robin strategy for optimistically colorable nodes.Francisco Jerez2015-02-231-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The round-robin allocation strategy is expected to decrease the amount of false dependencies created by the register allocator and give the post-RA scheduling pass more freedom to move instructions around. On the other hand it has the disadvantage of increasing fragmentation and decreasing the number of equally-colored nearby nodes, what increases the likelihood of failure in presence of optimistically colorable nodes. This patch disables the round-robin strategy for optimistically colorable nodes. These typically arise in situations of high register pressure or for registers with large live intervals, in both cases the task of the instruction scheduler shouldn't be constrained excessively by the dense packing of those nodes, and a spill (or on Intel hardware a fall-back to SIMD8 mode) is invariably worse than a slightly less optimal scheduling. Shader-db results on the i965 driver: total instructions in shared programs: 5488539 -> 5488489 (-0.00%) instructions in affected programs: 1121 -> 1071 (-4.46%) helped: 1 HURT: 0 GAINED: 49 LOST: 5 v2: Re-enable round-robin already for the lowest one of the nodes pushed optimistically onto the sack (Connor). v3: Use UINT_MAX instead of ~0, open-code MIN2 (Jason, Connor). Reviewed-by: Connor Abbott <[email protected]>
* util: Move Mesa's bitset.h to util/.Eric Anholt2015-02-203-1/+101
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* mesa: Add gallium include dirs to more parts of the tree.Eric Anholt2015-02-202-0/+4
| | | | | | v2: Try to patch up the scons bits. Reviewed-by: Jose Fonseca <[email protected]>
* Use __typeof instead of typeof with Solaris Studio compilersAlan Coopersmith2015-02-171-3/+3
| | | | | | | | | | While the C compiler accepts typeof, C++ requires __typeof. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86944 Signed-off-by: Alan Coopersmith <[email protected]> Cc: "10.5" <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* util/hash: Silence comparison between signed and unsigned integer warnings ↵Ian Romanick2015-02-173-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in tests delete_management.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ delete_management.c:69:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = size - 100; i < size; i++) { ^ delete_management.c:79:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] assert(key_value(entry->key) >= size - 100 && ^ delete_management.c:79:70: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] assert(key_value(entry->key) >= size - 100 && ^ insert_many.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ insert_many.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ insert_many.c:67:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] assert(ht->entries == size); ^ random_entry.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util/hash: Silence unused parameter warnings in testsIan Romanick2015-02-179-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | delete_and_lookup.c:37:21: warning: unused parameter ‘key’ [-Wunused-parameter] badhash(const void *key) ^ delete_and_lookup.c:43:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ delete_and_lookup.c:43:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ collision.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ collision.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ destroy_callback.c:50:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ destroy_callback.c:50:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_many.c:46:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_many.c:46:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_and_lookup.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_and_lookup.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ null_destroy.c:32:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ null_destroy.c:32:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ random_entry.c:52:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ random_entry.c:52:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ remove_null.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ remove_null.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ replacement.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ replacement.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* uti/u_atomic: Don't test p_atomic_add with booleans.Jose Fonseca2015-02-131-6/+19
| | | | | | | | | | | Add another class of tests. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=89112 I failed to spot this in my previous change, because bool was a typedef for char on the system I tested. Reviewed-by: Roland Scheidegger <[email protected]>
* util/u_atomic: Use lower-case variables in _Interlocked* helpers.Jose Fonseca2015-02-121-33/+33
|
* util/u_atomic: Add _InterlockedExchangeAdd8/16 for older MSVC.Jose Fonseca2015-02-121-4/+33
| | | | | | | | We need to build certain parts of Mesa (namely gallium, llvmpipe, and therefore util) with Windows SDK 7.0.7600, which includes MSVC 2008. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* util/u_atomic: Test p_atomic_add() for 8bit integers.Jose Fonseca2015-02-121-15/+17
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* util/u_atomic: Add new macro p_atomic_addCarl Worth2015-02-092-0/+21
| | | | | | | | | | | | | This provides for atomic addition, which will be used by an upcoming shader-cache patch. A simple test is added to "make check" as well. Note: The various O/S functions differ on whether they return the original value or the value after the addition, so I did not provide an add_return() macro which would be sensitive to that difference. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Aaron Watry <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* util/hash_table: Try to hit a double-insertion bug in the collision testJason Ekstrand2015-02-071-1/+13
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/set: Do a full search when adding new itemsJason Ekstrand2015-02-071-6/+15
| | | | | | | | | | | | Previously, the set_insert function would bail early if it found a deleted slot that it could re-use. However, this is a problem if the key being inserted is already in the set but further down the list. If this happens, the element ends up getting inserted in the set twice. This commit makes it so that we walk over all of the possible entries for the given key and then, if we don't find the key, place it in the available free entry we found. Reviewed-by: Eric Anholt <[email protected]>
* util/hash_table: Do a full search when adding new itemsJason Ekstrand2015-02-071-7/+16
| | | | | | | | | | | | Previously, the hash_table_insert function would bail early if it found a deleted slot that it could re-use. However, this is a problem if the key being inserted is already in the hash table but further down the list. If this happens, the element ends up getting inserted in the hash table twice. This commit makes it so that we walk over all of the possible entries for the given key and then, if we don't find the key, place it in the available free entry we found. Reviewed-by: Eric Anholt <[email protected]>
* util/u_atomic: Provide a _InterlockedCompareExchange8 for older MSVC.José Fonseca2015-01-301-1/+29
| | | | | | | | Fixes build with Windows SDK 7.0.7600. Tested with u_atomic_test, both on x86 and x86_64. Reviewed-by: Roland Scheidegger <[email protected]>
* util/u_atomic: Use _Interlocked* intrinsics for non 64bits.José Fonseca2015-01-301-12/+12
| | | | | | | The intrinsics are universally available, whereas older Windows SDKs (e.g. 7.0.7600) don't have the non-intrisic entrypoint. Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: Port a variant of 68afbe89c72d085dcbbf2b264f0201ab73fe339e to util/Eric Anholt2015-01-281-0/+1
| | | | | | | | The idea is that after a remove_from_list(), you might want to be able to do a remove_from_list() on it again or an is_empty_list(). This is apparently relied on by r300g. Reviewed-by: Marek Olšák <[email protected]>
* mesa: Move simple_list.h to src/util.Eric Anholt2015-01-282-0/+211
| | | | | | We have two copies of it in the tree, I'm going to delete one. Reviewed-by: Marek Olšák <[email protected]>
* Revert "util: Move the alternate fpclassify implementation to util"Jason Ekstrand2015-01-281-62/+0
| | | | | | | | | | | | | This reverts commits d6eb572905e39c36168b8f5da240af961f9dde0a and 58e8468d113c7d3d4a59ea4a8d70fd45b78e85e6. This is no longer necessary as we aren't using it in NIR anymore. Also, it broke the build on some strange systems so let's put it back in querymatrix where it came from. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88852 Acked-by: Matt Turner <[email protected]>
* util: Predicate the fpclassify fallback on !defined(__cplusplus)Jason Ekstrand2015-01-281-2/+12
| | | | | | | | | | | The problem is that the fallbacks we have at the moment don't work in C++. While we could theoretically fix the fallbacks it would also raise the issue of correctly detecting the fpclassify function. So, for now, we'll just disable it until we actually have a C++ user. Reported-by: Tom Stellard <[email protected]> Tested-by: Tom Stellard <[email protected]> Tested-by: EdB <[email protected]>
* util: Move the alternate fpclassify implementation to utilJason Ekstrand2015-01-281-0/+52
| | | | Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix some signed-unsigned comparison warningsJan Vesely2015-01-212-2/+2
| | | | | | | | v2: s/unsigned int/unsigned/ in prog_optimize.c Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* Rename sha1.c and sha1.h to mesa-sha1.c and mesa-sha1.hCarl Worth2015-01-193-3/+3
| | | | | | | | The filename of sha1.h was conflicting with the system-provided sha1.h, (and in some confiurations, our sha1.c was unsuccessfully attemping to include "sha1.h" and <sha1.h> as two different files). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88523
* sha1: Fix gcry_md_hd_t typo.Vinson Lee2015-01-161-1/+1
| | | | | | | | | | | | | Fix build error. CC libmesautil_la-sha1.lo sha1.c: In function '_mesa_sha1_final': sha1.c:210:22: error: 'grcy_md_hd_t' undeclared (first use in this function) gcry_md_hd_t h = (grcy_md_hd_t) ctx; ^ Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88519 Signed-off-by: Vinson Lee <[email protected]>
* configure: Add machinery for --enable-shader-cache (and --disable-shader-cache)Carl Worth2015-01-163-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't actually have the code for the shader cache just yet, but this configure machinery puts everything in place so that the shader cache can be optionally compiled in. Specifically, if the user passes no option (neither --disable-shader-cache, nor --enable-shader-cache), then this feature will be automatically detected based on the presence of a usable SHA-1 library. If no suitable library can be found, then the shader cache will be automatically disabled, (and reported in the final output from configure). The user can force the shader-cache feature to not be compiled, (even if a SHA-1 library is detected), by passing --disable-shader-cache. This will prevent the compiled Mesa libraries from depending on any library for SHA-1 implementation. Finally, the user can also force the shader cache on with --enable-shader-cache. This will cause configure to trigger a fatal error if no sutiable SHA-1 implementation can be found for the shader-cache feature. Bug fix by José Fonseca <[email protected]>: Fix to put conditional assignment in Makefile.am, not Makefile.sources to avoid breaking scons build. Note: As recommended by José, with this commit the scons build will not compile any of the SHA-1-using code. This is waiting for someone to write SConstruct detection of the available SHA-1 libraries, (and set the appropriate HAVE_SHA1_* variables). Reviewed-by: Matt Turner <[email protected]>
* mesa: Add mesa SHA-1 functionsCarl Worth2015-01-164-0/+380
| | | | | | | | | | | | | | | | | The upcoming shader cache uses the SHA-1 algorithm for cryptographic naming. These new mesa_sha1 functions are implemented with any one of several differeny cryptographics libraries. This code was copied from the xserver repository, (where it has apparently been functioning well on a variety of operating systems), and comes licensed with a license identical to that of Mesa. Bug fixes by José Fonseca <[email protected]>: Fix to put conditional assignment in Makefile.am, not Makefile.sources to avoid breaking scons build. Fix include file for CryptoAPI section. Fix missing cast in openssl section. Reviewed-by: Matt Turner <[email protected]>
* util: Make unreachable at least be an assertCarl Worth2015-01-161-1/+1
| | | | | | | | Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. Reviewed-by: Ian Romanick <[email protected]>
* util/hash_set: Rework the API to know about hashingJason Ekstrand2015-01-152-8/+51
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the set API required the user to do all of the hashing of keys as it passed them in. Since the hashing function is intrinsically tied to the comparison function, it makes sense for the hash set to know about it. Also, it makes for a somewhat clumsy API as the user is constantly calling hashing functions many of which have long names. This is especially bad when the standard call looks something like _mesa_set_add(ht, _mesa_pointer_hash(key), key); In the above case, there is no reason why the hash set shouldn't do the hashing for you. We leave the option for you to do your own hashing if it's more efficient, but it's no longer needed. Also, if you do do your own hashing, the hash set will assert that your hash matches what it expects out of the hashing function. This should make it harder to mess up your hashing. This is analygous to 94303a0750 where we did this for hash_table Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: Move main/set to util/hash_setJason Ekstrand2015-01-153-0/+441
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* hash_table: Rename insert_with_hash to insert_pre_hashedJason Ekstrand2015-01-153-8/+8
| | | | | | | We already have search_pre_hashed. This makes the APIs match better. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/hash_table: Pull the details of the FNV-1a into helpersJason Ekstrand2015-01-152-13/+23
| | | | | | | This way the basics of the FNV-1a hash can be reused to easily create other hashing functions. Reviewed-by: Eric Anholt <[email protected]>
* util: Silence signed-unsigned comparison warningsJan Vesely2014-12-171-6/+6
| | | | | Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* util: remove support for GCC older than 4.1.0Timothy Arceri2014-12-171-1/+1
| | | | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-By: Jose Fonseca <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util: add u_atomic_test to .gitignoreJuha-Pekka Heikkila2014-12-161-0/+1
| | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* hash_table: Fix compiler warnings from the renaming.Eric Anholt2014-12-141-2/+2
| | | | | Not sure how we both missed this. None of the callers were using the return value, though.
* util/hash_table: Rework the API to know about hashingJason Ekstrand2014-12-1411-74/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the hash_table API required the user to do all of the hashing of keys as it passed them in. Since the hashing function is intrinsically tied to the comparison function, it makes sense for the hash table to know about it. Also, it makes for a somewhat clumsy API as the user is constantly calling hashing functions many of which have long names. This is especially bad when the standard call looks something like _mesa_hash_table_insert(ht, _mesa_pointer_hash(key), key, data); In the above case, there is no reason why the hash table shouldn't do the hashing for you. We leave the option for you to do your own hashing if it's more efficient, but it's no longer needed. Also, if you do do your own hashing, the hash table will assert that your hash matches what it expects out of the hashing function. This should make it harder to mess up your hashing. v2: change to call the old entrypoint "pre_hashed" rather than "with_hash", like cworth's equivalent change upstream (change by anholt, acked-in-general by Jason). Signed-off-by: Jason Ekstrand <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: Wire up u_atomic_test.Matt Turner2014-12-121-0/+3
|
* mesa: Add scons files to distribution.Matt Turner2014-12-121-1/+1
|
* util: List hash_table tests as check_PROGRAMS.Matt Turner2014-12-121-1/+1
| | | | EXTRA_PROGRAMS is not what you want for binaries listed in TEST.
* util: Add headers and python scripts for distribution.Matt Turner2014-12-122-1/+10
|
* ra: Don't use regs as the ralloc context.Matt Turner2014-12-011-1/+1
| | | | | | | | | | The i965 backends pass something out of 'screen', which is allocated per-process, making using this as a ralloc context not thread-safe. All callers ra_alloc_interference_graph() already ralloc_free() its return value. Reviewed-by: Jason Ekstrand <[email protected]>
* util/u_atomic: Fix the unlocked implementation.José Fonseca2014-12-011-6/+6
| | | | | | | | | | | | | | | | | | It was totally broken: - p_atomic_dec_zero() was returning the negation of the expected value - p_atomic_inc_return()/p_atomic_dec_return() was post-incrementing/decrementing, hence returning the old value instead of the new - p_atomic_cmpxchg() was returning the new value on success, instead of the old It is clear this never used in the past. I wonder if it wouldn't be better to yank it altogether. Reviewed-by: Matt Turner <[email protected]>
* util/u_atomic: Add a simple test.José Fonseca2014-12-012-0/+146
| | | | | | | | | | | | | It was much easier for me to verify things build and run as expected with this simple test, than building and testing whole Mesa. With scons the test can be build and run merely by doing: scons u_atomic_test Building the test with autotools is left as a future exercise. Reviewed-by: Matt Turner <[email protected]>
* util: Make u_atomic.h typeless.Matt Turner2014-12-011-113/+93
| | | | | | | | | | | | like how C11's stdatomic.h provides generic functions. GCC's __sync_* builtins already take a variety of types, so that's simple. MSVC and Sun Studio don't, but we can implement it with something that looks a little crazy but is actually quite readable. Thanks to Jose for some MSVC fixes! Reviewed-by: Jose Fonseca <[email protected]>
* util: Use stdbool.h's bool rather than "boolean".Matt Turner2014-12-011-3/+5
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* util: Remove u_atomic.h's GCC inline assembly.Matt Turner2014-12-011-122/+0
| | | | | | | GCC >= 4.1 support the __sync_* intrinsics. That seems like a sufficiently old baseline. Reviewed-by: Jose Fonseca <[email protected]>
* util: Remove u_atomic.h's MSVC inline assembly.Matt Turner2014-12-011-70/+0
| | | | | | | There was already an intrinsics path that implemented all of the same functions, plus more. Reviewed-by: Jose Fonseca <[email protected]>
* util: Remove u_atomic.h's Gallium dependence.Matt Turner2014-12-011-9/+6
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* util: s/INLINE/inline/ in u_atomic.h.Matt Turner2014-12-011-29/+29
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* util: Move u_atomic.h to src/util.Matt Turner2014-12-011-0/+401
| | | | | | To be shared outside of Gallium. Reviewed-by: Jose Fonseca <[email protected]>