Alyssa Rosenzweig
f34bae7d8c
nir: Simplify alu_instr_is_copy
...
mov is considered vec.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:30 +00:00
Alyssa Rosenzweig
92e59b5af5
nir: Remove no-op remove_def_cb
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:30 +00:00
Alyssa Rosenzweig
42ee8a55dd
nir: Remove nir_alu_dest::write_mask
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:30 +00:00
Alyssa Rosenzweig
1c49586a1f
nir: Remove nir_{src,dest}::is_ssa
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
312c647272
nir: Collapse more SSA checks
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
d18dfe6e27
nir: Initialize source as a NULL SSA def
...
This keeps src_is_valid working without depending on registers.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
fb79497b44
nir: Do not init dests
...
There is no sensible way to do this. It is a hard requirement that the dest is
initialized with nir_ssa_dest_init immediately after creating the instruction.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
70c64b5d49
nir: Remove def_is_register
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
306182c63e
treewide: Collapse more SSA checks
...
Via Coccinelle patch:
@@
expression x;
@@
-if (x->is_ssa) {
...
-}
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
ca9e2ceeeb
nir: Drop trivial reg handling
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
579bc1e72e
treewide: Drop some is_ssa if's
...
Via Coccinelle patch:
@@
expression x;
@@
-if (!x.is_ssa) {
-...
-}
and likewise with x->is_ssa, with invalid hunks manually filtered out.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:29 +00:00
Alyssa Rosenzweig
95e3df39c0
treewide: sed out more is_ssa
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
a8013644a1
nir: Drop nir_alu_src::{negate,abs}
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
09d7f6d64b
nir: Remove stale todo
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
c512636cf0
nir: Remove reg-only dest manipulation
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
ab0d878932
treewide: Remove more is_ssa asserts
...
Stuff Coccinelle missed.
sed -i -e '/assert(.*\.is_ssa)/d' $(git grep -l is_ssa)
sed -i -e '/ASSERT.*\.is_ssa)/d' $(git grep -l is_ssa)
+ a manual fixup to restore the assert for parallel copy lowering.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
d559764e7c
nir: Remove nir_alu_dest::saturate
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
0bbf458a32
nir: Remove impl->{registers,reg_alloc}
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
97a3302bf8
nir/print: Assume SSA
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:28 +00:00
Alyssa Rosenzweig
c11c75d1a1
nir: Remove nir_index_local_regs and callers
...
With no registers seen, it is now a no-op.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:27 +00:00
Alyssa Rosenzweig
1bc05bb847
nir: Drop NIR reg create/destroy
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:27 +00:00
Alyssa Rosenzweig
03b2c34793
nir: Remove register arrays
...
Nothing produces them any more, so remove them from NIR. This massively reduces
the size of nir_src, which should improve performance all over.
nir_src size reduced from 56 bytes -> 40 bytes (pahole results on arm64, x86_64
should be similar.)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24253 >
2023-07-21 11:25:49 +00:00
Christian Gmeiner
019e5cbd39
nir/print: print instr pass_flags
...
From time to time it can be helpful to "see" the pass_flags.
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24234 >
2023-07-20 18:03:47 +00:00
Alyssa Rosenzweig
9109830bb0
nir: Promote tess_coord_r600 to tess_coord_xy
...
This intrinsic (vec2 tess_coord) is generally useful for non-r600 backends.
Promote it.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24159 >
2023-07-17 17:31:52 +00:00
Erik Faye-Lund
1f9a3ee011
nir: use nir_intrinsic_get_var
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24004 >
2023-07-10 16:06:40 +02:00
Yonggang Luo
c4d3bc03c4
nir: Add nir_foreach_function_safe and use it
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23902 >
2023-07-03 21:45:35 +00:00
Christian Gmeiner
fada46cf99
nir: add helper to clear all pass_flags
...
Will be used in different places so lets move it to a common place.
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com >
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23931 >
2023-06-29 19:13:19 +00:00
Georg Lehmann
481a34e82e
nir: add single bit test opcodes
...
These directly map to amd's SALU s_bitcmp0/1.
For VALU we can use v_cmp_class_f32 if the second source is constant.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23298 >
2023-06-29 13:39:30 +00:00
Caio Oliveira
5d15f4ef28
nir: Extract logic to get dest and srcs types from intrinsic
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23562 >
2023-06-28 20:17:18 +00:00
Caio Oliveira
8f64415af7
nir/print: Make NIR_DEBUG=print_consts behavior the default
...
Now there's a NIR_DEBUG=print_no_inline_consts to omit them.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23562 >
2023-06-28 20:17:18 +00:00
Alyssa Rosenzweig
190b1fdc64
nir: Convert to nir_foreach_function_impl
...
Done by hand at each call site but going very quickly with funny Vim motions and
common regexes. This is a very common idiom in NIR.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23807 >
2023-06-27 22:44:04 +00:00
Alyssa Rosenzweig
815efcdf7e
nir: Use nir_builder_create
...
perl -p0e 's/nir_builder ([^;]*);\s*nir_builder_init\(&\1, /nir_builder \1 = nir_builder_create(/g' -i $(git grep -l nir_builder_init)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23860 >
2023-06-27 18:13:02 +00:00
Yonggang Luo
5b29463746
nir: Add function nir_function_set_impl
...
This function is added for create strong relationship between
nir_function_impl and nir_function.
So that nir_function->impl->function == nir_function is always true when
(nir_function->impl != NULL && nir_function->impl != NIR_SERIALIZE_FUNC_HAS_IMPL)
And indeed this invariant is already done in functions validate_function and validate_function_impl
of nir_validate
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23820 >
2023-06-24 14:48:47 +00:00
Emma Anholt
b26a9efc5a
nir,mesa: Add helpers for creating uniform state variables.
...
It's one of the weirder parts of our shader interface's interactions with
the GL API, so let's try to make it a little cleaner.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111 >
2023-06-01 23:57:32 +00:00
Lionel Landwerlin
8a8382a78a
nir: teach nir_chase_binding about resource_intel
...
It's needed to have opt_gcm work properly.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21645 >
2023-05-30 06:36:37 +00:00
Alyssa Rosenzweig
feeeb45639
nir: Drop stale comments
...
Follow-on clean up after 01e9ee79f7 ("nir: Drop unused name from
nir_ssa_dest_init"). The referenced argument no longer exists.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Rob Clark <robclark@freedesktop.org >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23181 >
2023-05-24 17:30:03 +00:00
Erik Faye-Lund
a37051304a
compiler/nir: move find_state_var to common code
...
We're about to need this in another place, so let's move it to common
nir code, and clean up the name a bit.
Acked-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22755 >
2023-05-19 13:51:19 +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
Alyssa Rosenzweig
59e73674c3
nir: Drop legacy atomics in simple cases
...
This commit drops legacy atomic support from core passes where we can simply
delete switch cases with no other changes. As such it's separated from the
more complex pass-specific commits for ease of review.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Emma Anholt <emma@anholt.net >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23036 >
2023-05-16 22:36:21 +00:00
Emma Anholt
0f25bb8283
nir: Add helpers for lazy var creation.
...
This should make writing some lowering/meta code easier. It also keeps
the num_inputs/outputs updated, when sometimes passes forgot to do so (for
example, nir_lower_input_attachments updated for one of the two vars it
creates). The names of the variables change in many cases, but it's
probably nicer to see "VERT_ATTRIB_POS" than "in_0" or whatever.
I've only converted mesa core (compiler and GL), not all the driver meta
code.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22809 >
2023-05-16 18:57:28 +00:00
Jesse Natalie
ca5c869b6d
nir: Load/store atomic op indices when lowering image intrinsics
...
They might not be stored in the same const index after lowering
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22914 >
2023-05-12 20:39:46 +00:00
Alyssa Rosenzweig
d51bc95837
nir: Add unified atomics
...
Currently, we have an atomic intrinsic for each combination of memory type
(global, shared, image, etc) and atomic operation (add, sub, etc). So for m
types of memory supported by the driver and n atomic opcodes, the driver has to
handle O(mn) intrinsics. This makes a total mess in every single backend I've
looked at, without fail.
It would be a lot nicer to unify the intrinsics. There are two obvious ways:
1. Make the memory type a constant index, keep different intrinsics for
different operations. The problem with this is that different memory types
imply different intrinsic signatures (number of sources, etc). As an
example, it doesn't make sense to unify global_atomic_amd with
global_atomic_2x32, as an example. The first takes 3 scalar sources, the
second takes 1 vector and 1 scalar. Also, in any single backend, there are a
lot more operations than there are memory types.
2. Make the opcode a constant index, keep different intrinsics for different
operations. This works well, with one exception: compswap and fcompswap
take an extra argument that other atomics don't, so there's an extra axis of
variation for the intrinsic signatures.
So, the solution is to have 2 intrinsics for each memory type -- for atomics
taking 1 argument and atomics taking 2 respectively. Both of these intrinsics
take an nir_atomic_op enum to describe its operation. We don't use a nir_op for
this purpose, as there are some atomics (cmpxchg, inc_wrap, etc) that don't
cleanly map to any ALU op and it would be weird to force it.
The plan is to transition to these new opcodes gradually. This series adds a
lowering pass producing these opcodes from the existing opcodes, so that
backends can opt-in to the new forms one-by-one. Then we can convert backends
separately without any cross-tree flag day. Once everything is converted, we can
convert the producers and core NIR as a flag day, but we have far fewer
producers than backends so this should be fine. Finally we can drop the old
stuff.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Rob Clark <robclark@freedesktop.org >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22914 >
2023-05-12 20:39:46 +00:00
Alyssa Rosenzweig
aa6bdbd54a
nir: Use nir_foreach_phi(_safe)
...
The pattern shows up all the time open-coded. Use the macro instead.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22967 >
2023-05-12 14:02:23 +00:00
Lionel Landwerlin
1e0e4657f9
spirv/nir: wire ray interection triangle position fetch
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Part-of: <f{merge_request.web_url}>
2023-05-04 11:25:41 +00:00
Marek Olšák
e6e406b483
nir: add next_stage parameter to nir_remove_varying
...
so that e.g. the POS output is removed if the next stage is not FS.
Reviewed-by: Qiang Yu <yuq825@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21861 >
2023-04-19 21:42:11 +00:00
Marek Olšák
42822413cf
nir: add next_stage parameter to nir_slot_is_sysval_output to return better info
...
If we know the next stage, we can tell whether an output is a sysval,
such as POS.
For example, POS is not a sysval output if the next stage is not FS.
Reviewed-by: Qiang Yu <yuq825@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21861 >
2023-04-19 21:42:11 +00:00
Marek Olšák
ea9156edc3
nir: return a status from nir_remove_varying whether it removed the instruction
...
Reviewed-by: Qiang Yu <yuq825@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21861 >
2023-04-19 21:42:11 +00:00
Alyssa Rosenzweig
e25c182993
nir: Use nir_src_rewrite_ssa
...
Where sensible.
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
Alyssa Rosenzweig
2285b5daae
nir: Reduce indirection
...
A source used by an if is necessarily the condition of that if.
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
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