Alyssa Rosenzweig
da752ed7c1
treewide: use nir_def_replace sometimes
...
Two Coccinelle patches here. Didn't catch nearly as much as I would've liked but
it's a start.
Coccinelle patch:
@@
expression intr, repl;
@@
-nir_def_rewrite_uses(&intr->def, repl);
-nir_instr_remove(&intr->instr);
+nir_def_replace(&intr->def, repl);
Coccinelle patch:
@@
identifier intr;
expression instr, repl;
@@
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
...
-nir_def_rewrite_uses(&intr->def, repl);
-nir_instr_remove(instr);
+nir_def_replace(&intr->def, repl);
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com > [broadcom]
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com > [lima]
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com > [etna]
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com > [r300]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29817 >
2024-06-21 15:36:56 +00:00
Alyssa Rosenzweig
15257b65c6
treewide: use nir_metadata_control_flow
...
Via Coccinelle patch:
@@
@@
-nir_metadata_block_index | nir_metadata_dominance
+nir_metadata_control_flow
...plus some manual fixups for call sites missed by coccinelle.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Acked-by: Karol Herbst <kherbst@redhat.com >
Acked-by: Juan A. Suarez Romero <jasuarez@igalia.com > [broadcom]
Acked-by: Vasily Khoruzhick <anarsoul@gmail.com > [lima]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29745 >
2024-06-17 16:28:14 -04:00
Marek Olšák
d802aca523
nir/lower_image: support FMASK loads with a 16-bit sample index
...
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28845 >
2024-05-01 19:41:35 +00:00
Faith Ekstrand
1198816f50
nir: Use nir_shader_intrinsic_pass() a few places
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24760 >
2023-08-18 17:39:53 +00:00
Faith Ekstrand
de063a1481
nir: Drop most uses of nir_instr_rewrite_src_ssa()
...
Generated with the following semantic patch:
@@
expression I, S, D;
@@
-nir_instr_rewrite_src_ssa(I, S, D);
+nir_src_rewrite(S, D);
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24729 >
2023-08-18 01:00:15 +00:00
Faith Ekstrand
b64da56b1a
nir: s/nir_instr_ssa_def/nir_instr_def/
...
Generated by sed:
sed -i -e 's/nir_instr_ssa_def/nir_instr_def/g' src/**/*.h src/**/*.c src/**/*.cpp
Suggested-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24703 >
2023-08-15 17:44:27 +00:00
Faith Ekstrand
b781dd6200
nir s/nir_get_ssa_scalar/nir_get_scalar/
...
Generated with sed:
sed -i -e 's/nir_get_ssa_scalar/nir_get_scalar/g' src/**/*.h src/**/*.c src/**/*.cpp
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24703 >
2023-08-15 17:44:27 +00:00
Faith Ekstrand
4695bebc79
nir: Drop nir_dest
...
Instead, we replace every use of it with nir_def. Most of this commit
was generated by sed:
sed -i -e 's/dest.ssa/def/g' src/**/*.h src/**/*.c src/**/*.cpp
A few manual fixups were required in lima and the nir_legacy code.
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674 >
2023-08-14 21:22:53 +00:00
Faith Ekstrand
80a1836d8b
nir: Get rid of nir_dest_bit_size()
...
We could add a nir_def_bit_size() helper but we use ->bit_size about 3x
as often as nir_dest_bit_size() today so that's a major Coccinelle
refactor anyway and this doesn't make it much worse. Most of this
commit was generated byt the following semantic patch:
@@
expression D;
@@
<...
-nir_dest_bit_size(D)
+D.ssa.bit_size
...
Some manual fixup was needed, especially in cpp files where Coccinelle
tends to give up the moment it sees any interesting C++.
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674 >
2023-08-14 21:22:53 +00:00
Faith Ekstrand
ed9affa02f
nir: Drop most instances of nir_ssa_dest_init()
...
Generated using the following two semantic patches:
@@
expression I, J, NC, BS;
@@
-nir_ssa_dest_init(I, &J->dest, NC, BS);
+nir_def_init(I, &J->dest.ssa, NC, BS);
@@
expression I, J, NC, BS;
@@
-nir_ssa_dest_init(I, &J->dest.dest, NC, BS);
+nir_def_init(I, &J->dest.dest.ssa, NC, BS);
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Alyssa Rosenzweig
09d31922de
nir: Drop "SSA" from NIR language
...
Everything is SSA now.
sed -e 's/nir_ssa_def/nir_def/g' \
-e 's/nir_ssa_undef/nir_undef/g' \
-e 's/nir_ssa_scalar/nir_scalar/g' \
-e 's/nir_src_rewrite_ssa/nir_src_rewrite/g' \
-e 's/nir_gather_ssa_types/nir_gather_types/g' \
-i $(git grep -l nir | grep -v relnotes)
git mv src/compiler/nir/nir_gather_ssa_types.c \
src/compiler/nir/nir_gather_types.c
ninja -C build/ clang-format
cd src/compiler/nir && find *.c *.h -type f -exec clang-format -i \{} \;
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24585 >
2023-08-12 16:44:41 -04:00
Faith Ekstrand
777d336b1f
nir: clang-format src/compiler/nir/*.[ch]
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Alyssa Rosenzweig
01e9ee79f7
nir: Drop unused name from nir_ssa_dest_init
...
Since 624e799cc3 ("nir: Drop nir_ssa_def::name and nir_register::name"), SSA
defs don't have names, making the name argument unused. Drop it from the
signature and fix the call sites. This was done with the help of the following
Coccinelle semantic patch:
@@
expression A, B, C, D, E;
@@
-nir_ssa_dest_init(A, B, C, D, E);
+nir_ssa_dest_init(A, B, C, D);
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23078 >
2023-05-17 23:46:16 +00:00
Marek Olšák
0c8e7ad47e
nir: lower to fragment_mask_fetch/load_amd with EQAA correctly
...
Fixes: 194add2c23 ("nir: lower image add lower_to_fragment_mask_load_amd option")
Reviewed-by: Qiang Yu <yuq825@gmail.com >
Signed-off-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21436 >
2023-02-27 09:39:41 +08:00
Sagar Ghuge
0ec3522163
nir: Handle other variants of image_samples properly while lowering
...
while lowering image_samples to one, we need to take
nir_intrinsic_image_deref_samples and
nir_intrinsic_bindless_image_samples intrinsic into account.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8211
Fixes: ab4c2990ed ("intel/compiler: use lower_image_samples_to_one")
Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21053 >
2023-02-02 21:40:45 +00:00
Amber
c384690ab7
nir: support lowering nir_intrinsic_image_samples to a constant load
...
This can be used by multiple drivers that do not support ms images
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Rob Clark <robclark@freedesktop.org >
Reviewer-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Signed-off-by: Amber Amber <amber@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20813 >
2023-02-01 19:52:49 +00:00
Qiang Yu
194add2c23
nir: lower image add lower_to_fragment_mask_load_amd option
...
Like lower_to_fragment_fetch_amd option in lower tex,
this is for radeonsi to lower MS image ops.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18666 >
2022-12-19 09:22:16 +08:00
Emma Anholt
d506d910e4
nir: Switch to using nir_vec_scalars() for things that used nir_channel().
...
This should reduce follow-on optimization work to copy-propagate and
dead-code away the movs generated in construction of vectors.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14865 >
2022-03-02 22:28:58 +00:00
Emma Anholt
879a569884
nir: Switch from ralloc to malloc for NIR instructions.
...
By replacing the 48-byte ralloc header with our exec_node gc_node (16
bytes), runtime of shader-db on my system across this series drops
-4.21738% +/- 1.47757% (n=5).
Inspired by discussion on #5034 .
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11776 >
2021-09-14 17:53:06 +00:00
Jason Ekstrand
c6102dda0a
nir/lower_image: Handle index and bindless image_size
...
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12005 >
2021-07-22 14:22:35 -05:00
Jordan Justen
6898549d56
nir: Add nir_lower_image() to lower cube image sizes
...
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9466 >
2021-07-21 11:02:15 -07:00