Alyssa Rosenzweig
31b5f5a51f
nir/opt_if: Simplify if's with general conditions
...
Dolphin ubershaders have a pattern:
if (x && y) {
} else {
discard;
}
The current code to simplify if's will bail on this pattern, since the condition
is not a comparison. However, if that check is dropped and we allow NIR to
invert this, we get:
if (!(x && y)) {
discard;
} else {
}
which is now in a form for nir_opt_conditional_discard to turn into it
discard_if(!(x && y))
which may be substantially cheaper than the original code.
In general, I see no reason to restrict to conditionals. Assuming the backend is
clever enough to delete empty else blocks (I think most are), then this patch is
a strict win as long as inot instructions are cheaper than empty else blocks.
This matches my intuition for typical GPUs, where simple ALU instructions are
cheaper than control flow. Furthermore, it may be possible in practice for
backends to fold the inot into a richer set of instructions. For example, most
GPUs have a NAND instructions which would fold in the inot in the above code.
So just drop the check, simplify the pass, get the win.
---
Also, to avoid inflating register pressure, make sure we put the inot right
before the if. Android shader-db on is uninspiring due to terrible
coalescing decisions in the current RA. But it does fix the Dolphin smell.
total instructions in shared programs: 1756571 -> 1756568 (<.01%)
instructions in affected programs: 1600 -> 1597 (-0.19%)
helped: 1
HURT: 4
Inconclusive result (value mean confidence interval includes 0).
total bytes in shared programs: 11521172 -> 11521156 (<.01%)
bytes in affected programs: 10080 -> 10064 (-0.16%)
helped: 1
HURT: 4
Inconclusive result (value mean confidence interval includes 0).
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24965 >
2023-09-05 02:36:41 +00:00
Dave Airlie
07ef39ddc6
nir/gather: add support for fbfetch and bindless image loads.
...
If a driver calls gather after lowering the uses_fbfetch_output
needs to be set properly if we have bindless image loads.
Fixes a regression seen calling gather info later in some llvmpipe
work.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24987 >
2023-09-04 08:06:08 +10:00
Georg Lehmann
3a715cc9d2
nir: add nir_scalar_equal
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24656 >
2023-09-02 00:26:31 +00:00
Georg Lehmann
bce9bba90d
nir: add nir_scalar intrinsic helpers
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24656 >
2023-09-02 00:26:31 +00:00
Alyssa Rosenzweig
f80c57c38f
treewide: Use nir_before/after_impl for more elaborate cases
...
Via Coccinelle patch:
@@
expression func_impl;
@@
-nir_before_block(nir_start_block(func_impl))
+nir_before_impl(func_impl)
@@
expression func_impl;
@@
-nir_after_block(nir_impl_last_block(func_impl))
+nir_after_impl(func_impl)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24910 >
2023-08-30 19:30:58 +00:00
Alyssa Rosenzweig
25cc04c59b
treewide: Use nir_before/after_impl in easy cases
...
These open-code the same idiom as the helper.
Via Coccinelle patch:
@@
expression func_impl;
@@
-nir_before_cf_list(&func_impl->body)
+nir_before_impl(func_impl)
@@
expression func_impl;
@@
-nir_after_cf_list(&func_impl->body)
+nir_after_impl(func_impl)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24910 >
2023-08-30 19:30:58 +00:00
Alyssa Rosenzweig
4c45503aae
nir: Add nir_before/after_impl cursors
...
These are common enough to merit their own helpers.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24910 >
2023-08-30 19:30:58 +00:00
Karol Herbst
513cd29eda
nir: make num_workgroups 32 bit only
...
Signed-off-by: Karol Herbst <git@karolherbst.de >
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24905 >
2023-08-30 07:04:33 +00:00
Karol Herbst
1b22b67199
nir: make workgroup_id 32 bit only
...
No backend supports 64 bit values natively anyway.
Signed-off-by: Karol Herbst <git@karolherbst.de >
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24905 >
2023-08-30 07:04:33 +00:00
Alyssa Rosenzweig
011f0b0d7d
nir/lower_shader_calls: Fix warning with clang
...
Implicit conversion warning.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24864 >
2023-08-29 14:06:14 +00:00
Konstantin Seurer
a209d76722
nir/lower_shader_calls: Limit the remat chain length
...
There is no way we will rematerialize a 40k instruction long chain and
it also won't be beneficial. This improves the replay time if our CP2077
fossil by 350% when compiling only ray tracing pipelines.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24864 >
2023-08-29 14:06:14 +00:00
Ian Romanick
5ce6e09ffc
nir/algebraic: Remove redundant pack / unpack lowering patterns
...
No shader-db or fossil-db changes on any Intel platform.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24900 >
2023-08-25 14:54:11 -07:00
Ian Romanick
69d086c6c4
nir/builder: Add nir_extract_i8_imm and nir_extract_u8_imm helpers
...
v2: Fix problems with 16-bit src0.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24899 >
2023-08-25 20:15:37 +00:00
twisted89
d3e796da6b
util/driconf: add workarounds for the Chronicles of Riddick
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24567 >
2023-08-24 22:38:56 +00:00
Alyssa Rosenzweig
cda1961835
treewide: Also handle struct nir_builder form
...
Via Coccinelle patch:
@def@
typedef bool;
typedef nir_builder;
typedef nir_instr;
typedef nir_def;
identifier fn, instr, intr, x, builder, data;
@@
static fn(struct nir_builder* builder,
-nir_instr *instr,
+nir_intrinsic_instr *intr,
...)
{
(
- if (instr->type != nir_instr_type_intrinsic)
- return false;
- nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
- nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
- if (instr->type != nir_instr_type_intrinsic)
- return false;
)
<...
(
-instr->x
+intr->instr.x
|
-instr
+&intr->instr
)
...>
}
@pass depends on def@
identifier def.fn;
expression shader, progress;
@@
(
-nir_shader_instructions_pass(shader, fn,
+nir_shader_intrinsics_pass(shader, fn,
...)
|
-NIR_PASS_V(shader, nir_shader_instructions_pass, fn,
+NIR_PASS_V(shader, nir_shader_intrinsics_pass, fn,
...)
|
-NIR_PASS(progress, shader, nir_shader_instructions_pass, fn,
+NIR_PASS(progress, shader, nir_shader_intrinsics_pass, fn,
...)
)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24852 >
2023-08-24 15:48:02 +00:00
Alyssa Rosenzweig
465b138f01
treewide: Use nir_shader_intrinsic_pass sometimes
...
This converts a lot of trivial passes. Nice boilerplate deletion. Via Coccinelle
patch (with a small manual fix-up for panfrost where coccinelle got confused by
genxml + ninja clang-format squashed in, and for Zink because my semantic patch
was slightly buggy).
@def@
typedef bool;
typedef nir_builder;
typedef nir_instr;
typedef nir_def;
identifier fn, instr, intr, x, builder, data;
@@
static fn(nir_builder* builder,
-nir_instr *instr,
+nir_intrinsic_instr *intr,
...)
{
(
- if (instr->type != nir_instr_type_intrinsic)
- return false;
- nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
- nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
- if (instr->type != nir_instr_type_intrinsic)
- return false;
)
<...
(
-instr->x
+intr->instr.x
|
-instr
+&intr->instr
)
...>
}
@pass depends on def@
identifier def.fn;
expression shader, progress;
@@
(
-nir_shader_instructions_pass(shader, fn,
+nir_shader_intrinsics_pass(shader, fn,
...)
|
-NIR_PASS_V(shader, nir_shader_instructions_pass, fn,
+NIR_PASS_V(shader, nir_shader_intrinsics_pass, fn,
...)
|
-NIR_PASS(progress, shader, nir_shader_instructions_pass, fn,
+NIR_PASS(progress, shader, nir_shader_intrinsics_pass, fn,
...)
)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24852 >
2023-08-24 15:48:02 +00:00
Yonggang Luo
26c5200acf
compiler/glsl: Move glsl_print_type from glsl_types.* to ir_print_visitor.cpp
...
glsl_print_type only referenced in ir_print_visitor.cpp
there is no need expose 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/24824 >
2023-08-24 02:54:09 +00:00
Yonggang Luo
01ddb18427
compiler: use 4 instead ATOMIC_COUNTER_SIZE in glsl_types.h to avoid #include "mesa/main/config.h"
...
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/24824 >
2023-08-24 02:54:09 +00:00
Piotr Kocia
27eafbcd4e
nir: Remove dead nir_const_value variables
...
nir_const_value variables in nir_const_value_for_int and
nor_const_value_for_uint are unused resulting in unnecessary dead code.
The unused-variable warning has been suppressed by the memset following
their declarations.
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24851 >
2023-08-23 19:29:19 +00:00
Alyssa Rosenzweig
5189bae50c
asahi: Move UBO lowering into GL driver
...
In Vulkan, UBOs are lowered by nir_lower_explicit_io, and the ubo_base_agx
sysval is unused (since it doesn't handle descriptor sets). That makes the UBO
lowering GL-only and hence belongs with the GL driver rather than the compiler.
This lets us delete the ubo_base_agx sysval.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847 >
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
1d77fb967d
nir,asahi: Remove texture_base_agx
...
Doing a descriptor crawl with binding tables requires a real binding table in
the shader, which won't work for VK or merged shader stages in GL. Instead,
let's lower anything that needs a crawl to bindless in the driver, so the
compiler code doesn't need to know anything about descriptor binding models.
That gets rid of the texture_base_agx sysval, which is problematic when there
are multiple descriptor sets worth of textures.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847 >
2023-08-23 15:06:55 +00:00
Alyssa Rosenzweig
ec2ab7d771
nir: Add load_sysval_agx intrinsic
...
For merging shader stages, it will be useful to express a load from an explicit
GL "descriptor set", so we can represent things like UBO loads with merged
shaders where UBOs can come from either stage. To do so, we add an intrinsic
representing a load from the driver's uniform tables, indexed like "descriptor
sets" with "bindings".
In principle, a layered GL-on-Vulkan implementation would use literal descriptor
sets for each stage, so I feel comfortable with the analogy here.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847 >
2023-08-23 15:06:54 +00:00
Daniel Schürmann
7e246f7f2b
nir/opt_move: fix handling of if-condition
...
By accident, this used the parent of the nir_src which is a nir_if
instead of the parent of the SSA value.
Totals from 10814 (8.10% of 133461) affected shaders: (GFX11)
Instrs: 21759185 -> 21757190 (-0.01%); split: -0.02%, +0.01%
CodeSize: 112320272 -> 112316008 (-0.00%); split: -0.02%, +0.01%
SpillSGPRs: 11220 -> 11212 (-0.07%)
SpillVGPRs: 911 -> 903 (-0.88%); split: -1.54%, +0.66%
Latency: 258334759 -> 258316073 (-0.01%); split: -0.02%, +0.01%
InvThroughput: 31428650 -> 31426394 (-0.01%); split: -0.02%, +0.01%
VClause: 309119 -> 309090 (-0.01%); split: -0.01%, +0.01%
SClause: 657028 -> 657150 (+0.02%); split: -0.03%, +0.04%
Copies: 1434209 -> 1432420 (-0.12%); split: -0.28%, +0.15%
Branches: 481804 -> 481801 (-0.00%)
PreSGPRs: 829995 -> 829966 (-0.00%)
PreVGPRs: 758249 -> 758253 (+0.00%)
Fixes: 8a78706643 ('nir: refactor nir_opt_move')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24695 >
2023-08-22 21:05:18 +00:00
Alyssa Rosenzweig
f9e5534182
nir/lower_gs_intrinsics: Remove end primitive for points
...
EndPrimitive() for points is entirely pointless, so just remove it when lowering
EndPrimitive to simplify the IR. This is (maybe) an optimization everywhere, and
will be relied on for correctness on Asahi.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24798 >
2023-08-22 20:24:40 +00:00
Alyssa Rosenzweig
8c7629524e
nir/print: Print access qualifiers for intrinsics
...
Instead of printing an opaque integer that needs to be manually decoded.
Example output:
32x4 %7 = @image_load (%4 (0x0), %6, %5 (0x0), %4 (0x0)) (image_dim=2D, image_array=false, format=r8g8b8a8_snorm, access=readonly|reorderable, range_base=0, dest_type=float32)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24798 >
2023-08-22 20:24:40 +00:00
Caio Oliveira
48b86a877f
compiler/types: Use smaller keys for explicit_matrix_types table
...
Instead of using the name as key, use a shorter struct type.
Only build a name string if we are adding a new entry to the table.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23281 >
2023-08-22 18:52:15 +00:00
Caio Oliveira
fd1da0f7f5
compiler/types: Extract get_explicit_matrix_instance() function
...
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23281 >
2023-08-22 18:52:15 +00:00
Caio Oliveira
b248740e30
compiler/types: Use smaller keys for array_types table
...
Instead of building a string, build a short struct type and use
that as key. The only caveat here is ensure there either there's
no internal padding or the internal padding is always the same.
Use a static assert to ensure we are in the former case.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23281 >
2023-08-22 18:52:15 +00:00
Caio Oliveira
d4fcc97a3f
compiler/types: Use ralloc for the key in array_types
...
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23281 >
2023-08-22 18:52:15 +00:00
norablackcat
f744c114d1
rusticl: add cl_khr_expect_assume
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Tested-by: Andrey Alekseenko <al42and@gmail.com >
Tested-by: Yifeng Li <tomli@tomli.me >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23115 >
2023-08-22 17:28:05 +00:00
norablackcat
25bc3d2824
spirv/nir_to_spirv: add expect assume op codes
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23115 >
2023-08-22 17:28:05 +00:00
Friedrich Vock
a28ff7f240
nir/load_store_vectorize: Handle intrinsics with constant base
...
This includes nir_load_stack and nir_store_stack, which are vectorized
in nir_lower_shader_calls. If not adjusted, we end up loading from
the wrong base.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9596
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9587
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24789 >
2023-08-22 13:26:12 +00:00
Georg Lehmann
9cf6984200
nir: unify lower_find_msb with has_{find_msb_rev,uclz}
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24662 >
2023-08-22 12:08:37 +00:00
Georg Lehmann
2ac7e6614a
nir: unify lower_bitfield_extract with has_bfe
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24662 >
2023-08-22 12:08:37 +00:00
Georg Lehmann
34c3f81614
nir: unify lower_bitfield_insert with has_{bfm,bfi,bitfield_select}
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24662 >
2023-08-22 12:08:37 +00:00
Marek Olšák
1ac379c4a0
nir/algebraic: collapse ALU opcodes sourcing NaN
...
Undef will be replaced by NaN whenever it leads to elimination of FP
instructions. This implements the elimination part.
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24792 >
2023-08-19 14:18:52 -04:00
Marek Olšák
ee225e31c1
nir: fix constant evaluation of fddx/fddy sourcing Inf & NaN constant
...
A derivative of NaN is NaN.
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24792 >
2023-08-19 14:18:52 -04:00
Timur Kristóf
8780f66c3a
nir/opt_dead_cf: Remove if branches with undef condition.
...
Treat them as if the undef were false.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24792 >
2023-08-19 14:18:52 -04:00
Alyssa Rosenzweig
558e36f641
nir/passthrough_gs: Fix array size
...
Triangle strips with adjacency have 6 vertices input, so we need an array big
enough for all 6 vertices to avoid overflow. Fixes passthrough GS generated for
KHR-GLES31.core.draw_indirect.basic-mode-*-triangle*adj*.
Fixes: ea14579f3d ("nir: handle primitives with adjacency")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24780 >
2023-08-19 17:13:49 +00:00
Alyssa Rosenzweig
fe4208ed4c
nir/passthrough_gs: Correctly set vertices_in
...
If the input primitive has adjacency, the output primitive will have fewer
vertices than the input. For example, if we input TRIANGLE_STRIPS_ADJACENCY, we
need to set vertices_in = 6 even though we'll output TRIANGLE_STRIPS with
vertices_out = 3. Respect that, in order to correctly handle adjacency inputs.
Fixes: ea14579f3d ("nir: handle primitives with adjacency")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24780 >
2023-08-19 17:13:49 +00:00
Alyssa Rosenzweig
04ba4059b7
nir/lower_helper_writes: Consider bindless images
...
These need to be handled like other image ops.
Fixes KHR-GLES31.core.shader_image_load_store.basic-allTargets-atomicFS on Asahi
with bindless image access forced.
Fixes: 586da7b329 ("nir: Add nir_lower_helper_writes pass")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Italo Nicola <italonicola@collabora.com >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24778 >
2023-08-19 12:27:34 -04:00
Alyssa Rosenzweig
a257e2daad
nir: Lower fquantize2f16
...
Passes dEQP-VK.spirv_assembly.*opquantize*.
Unlike the DXIL lowering, this should correctly handle NaNs. (I belive Dozen has
a bug here that is masked by running constant folding early and poor CTS
coverage.) It is also faster than the DXIL lowering for hardware that supports
f2f16 conversions natively. It is not as good as a backend implementation that
could flush-to-zero in hardware... but for a debug instruction it should be more
than good enough.
It might be slightly better to multiply with 0.0 to get the appropriate zero,
but NIR really likes optimizing that out ...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24616 >
2023-08-18 22:20:02 +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
831085afa3
nir: Fix metadata in nir_lower_is_helper_invocation
...
It does not preserve everything. It adds and removes instructions and
even adds a variable.
Fixes: f17b41ab4f ("nir: add lowering pass for helperInvocationEXT()")
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
Alyssa Rosenzweig
d620d8d74f
nir: Add nir_shader_intrinsics_pass
...
Like instructions_pass but specialized to intrinsics. More ergnomic for this
extremely common case, and possibly a bit faster by avoiding the extra function
call on non-intrinsics.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
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
Konstantin Seurer
2489f7d84f
spirv: Implement SPV_AMDX_shader_enqueue
...
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24512 >
2023-08-18 16:57:22 +00:00
Konstantin Seurer
289df72d10
spirv: Update headers and grammer JSON
...
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24512 >
2023-08-18 16:57:22 +00:00
Konstantin Seurer
ccc52ae887
nir: Add shader enqueue data structures and handling
...
There are two new variable modes:
- nir_var_mem_node_payload
- nir_var_mem_node_payload_in
Also add a few more intrinsics and some shader info.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24512 >
2023-08-18 16:57:22 +00:00
Faith Ekstrand
20381eb522
nir: Drop nir_push_if_src()
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24765 >
2023-08-17 23:26:40 -05:00
Faith Ekstrand
96c0f8c580
nir: Drop nir_instr_rewrite_src()
...
Replace all its remaining users with nir_src_rewrite().
Reviewed-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