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
algebraic_tests.cpp
builder_tests.cpp
comparison_pre_tests.cpp
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
dce_tests.cpp
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
mod_analysis_tests.cpp nir: add nir_mod_analysis & its tests 2023-01-31 13:50:08 +00:00
negative_equal_tests.cpp
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