mesa/src/compiler/nir/tests
Alyssa Rosenzweig 7f6491b76d nir: Combine if_uses with instruction uses
Every nir_ssa_def is part of a chain of uses, implemented with doubly linked
lists.  That means each requires 2 * 64-bit = 16 bytes per def, which is
memory intensive. Together they require 32 bytes per def. Not cool.

To cut that memory use in half, we can combine the two linked lists into a
single use list that contains both regular instruction uses and if-uses. To do
this, we augment the nir_src with a boolean "is_if", and reimplement the
abstract if-uses operations on top of that list. That boolean should fit into
the padding already in nir_src so should not actually affect memory use, and in
the future we sneak it into the bottom bit of a pointer.

However, this creates a new inefficiency: now iterating over regular uses
separate from if-uses is (nominally) more expensive. It turns out virtually
every caller of nir_foreach_if_use(_safe) also calls nir_foreach_use(_safe)
immediately before, so we rewrite most of the callers to instead call a new
single `nir_foreach_use_including_if(_safe)` which predicates the logic based on
`src->is_if`. This should mitigate the performance difference.

There's a bit of churn, but this is largely a mechanical set of changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22343>
2023-04-07 23:48:03 +00:00
..
algebraic_parser_test.py nir/algebraic: Move relocations for expression conds to a table. 2021-12-07 07:09:00 +00:00
algebraic_tests.cpp nir/tests: add tests for umod/imod/irem optimizations 2021-08-09 11:00:39 +00:00
builder_tests.cpp nir/builder: Add a name format arg to nir_builder_init_simple_shader(). 2020-11-11 08:50:29 -08:00
comparison_pre_tests.cpp nir/builder: Add a name format arg to nir_builder_init_simple_shader(). 2020-11-11 08:50:29 -08:00
control_flow_tests.cpp nir/tests: Don't unconditionally log shaders from this one CF test 2023-02-17 22:12:05 +00:00
core_tests.cpp nir/tests: do not use designated initializers in c++ code 2022-04-05 16:58:56 +00:00
dce_tests.cpp nir/tests: add DCE test for loops following a jump 2021-11-29 22:22:24 +00:00
load_store_vectorizer_tests.cpp nir: Add alignment to load_push_constant 2023-02-11 06:12:23 +00:00
loop_analyze_tests.cpp nir/tests: Port almost all loop_analyze tests to new macro-based infastructure 2023-04-06 23:50:27 +00:00
loop_unroll_tests.cpp nir/loop_analyze: Determine iteration counts for more kinds of loops 2023-04-06 23:50:27 +00:00
lower_alu_width_tests.cpp nir: add nir_lower_alu_width_test.fdot_order 2023-03-08 14:38:26 +00:00
lower_returns_tests.cpp nir: Move phi src setup to a helper. 2021-08-13 16:11:57 +00:00
mod_analysis_tests.cpp nir: add nir_mod_analysis & its tests 2023-01-31 13:50:08 +00:00
negative_equal_tests.cpp nir/tests: Fix transmuting an SSA dest to be non-SSA 2021-09-14 17:53:06 +00:00
opt_if_tests.cpp nir: add a nir_opt_if_options enum 2022-08-10 12:55:39 +00:00
opt_shrink_vectors_tests.cpp nir: shrink phi nodes in nir_opt_shrink_vectors 2023-02-10 09:06:25 +00:00
serialize_tests.cpp nir: Fixes [-Wdeprecated-declarations] in serialize_tests.cpp 2022-08-23 15:19:16 +00:00
ssa_def_bits_used_tests.cpp nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00
vars_tests.cpp nir: Fix unused-variable compile warnings 2022-06-15 19:43:27 +00:00