mesa/src/panfrost/midgard
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
..
compiler.h panfrost: Lower sysvals in GL 2023-03-23 23:53:46 +00:00
disassemble.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
disassemble.h panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
helpers.h pan/mdg: Remove reference to removed macro 2023-03-11 06:30:02 +00:00
meson.build pan/mdg: Use nir_lower_helper_writes 2023-03-04 13:31:05 -05:00
midgard.h pan/mdg: Remove MSGS debug 2023-01-16 22:20:43 +00:00
midgard_address.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_compile.c pan/{mdg,bi}: Always use sampler 0 for txf 2023-04-07 01:15:41 +00:00
midgard_compile.h glsl: Retire ldexp lowering in favor of the nir lowering flag. 2023-04-06 02:32:00 +00:00
midgard_derivatives.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_emit.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_errata_lod.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_helper_invocations.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_liveness.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_nir.h pan/mdg: Use nir_lower_helper_writes 2023-03-04 13:31:05 -05:00
midgard_nir_algebraic.py pan/mdg: Use special NIR ops for trig scaling 2023-01-16 22:20:43 +00:00
midgard_nir_lower_image_bitsize.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_ops.c
midgard_ops.h panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_opt_copy_prop.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_opt_dce.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_opt_perspective.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_print.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_print_constant.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_quirks.h panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_ra.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_ra_pipeline.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
midgard_schedule.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
mir.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
mir_promote_uniforms.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
mir_squeeze.c panfrost: clang-format the tree 2022-12-24 02:22:57 +00:00
nir_fuse_io_16.c nir: Combine if_uses with instruction uses 2023-04-07 23:48:03 +00:00