Commit graph

9350 commits

Author SHA1 Message Date
Daniel Schürmann
27734c52eb nir/lower_subgroups: optimize reductions with cluster_size == 1
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/218>
2023-11-17 09:45:40 +00:00
Rhys Perry
288e9db053 nir/lower_fp16_casts: add option to split fp64 casts
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25566>
2023-11-16 11:02:30 +00:00
Rhys Perry
fce434818a nir/lower_fp16_casts: correctly round RTNE f64->f16 casts
Based on brw_nir_lower_conversions.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25566>
2023-11-16 11:02:30 +00:00
Karol Herbst
924c8e7bcd vtn: add hack for system values placed in CrossWorkgroup memory
Upstream bug: https://github.com/intel/llvm/issues/6703

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25701>
2023-11-15 08:34:57 +00:00
Karol Herbst
41f814df6f nir: allow vec derefs on system values
There is no real reason to prevent this as far as I know. And some of the
SPIR-V generated by DPCPP is running into this.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25701>
2023-11-15 08:34:57 +00:00
Jesse Natalie
cd0cff951a nir_lower_mem_access_bit_sizes: Fix write-mask-constrained 3-byte stores as atomics
The code here handled stores of actual 3-byte values (8-bit, 3-component), but didn't
correctly handle stores of larger 8-bit vectors that were constrained by write mask to
just 3 bytes. In that case, the pad-to-vec4 step was unnecessary and problematic.

Seen in CL CTS test_basic vector_swizzle test group for char3 with CLOn12.

Fixes: c70d94a8 ("nir_lower_mem_access_bit_sizes: Support unaligned stores via a pair of atomics")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26034>
2023-11-14 21:10:30 +00:00
Faith Ekstrand
618bdb8571 nak: Rework FS input interpolation
This gives FS I/O the same treatment as we did for vertex attributes in
that we now have a NIR intrinsic which pretty closely matches the
hardware and we lower to that before going into NAK.  This gives us a
bit more control in the NIR.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26181>
2023-11-14 16:38:03 +00:00
Faith Ekstrand
eb0d9a1b88 nir: Add nvidia barrier intrinsics
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:14 +00:00
Faith Ekstrand
dfbc03fa88 spirv: Fix locations for per-patch varyings
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
4c81f87670 HACK: spirv: Add a MESA_SPIRV_DUMP_PATH environment variable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
80376146ed nak: Encode program headers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:06 +00:00
antonino
0976dfeca2 nir/zink: drop NIH helper in favor of mesa_vertices_per_prim
`lower_pv_mode_vertices_for_prim` and `decomposed_primitive_size` return
the same values as `mesa_vertices_per_prim` for the primitives that can
be used as output in geometry shaders.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26117>
2023-11-11 10:27:21 +00:00
Faith Ekstrand
3af5af429e nir: Optimize boolean ieq/ine with an immediate
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26120>
2023-11-10 21:46:55 +00:00
Sviatoslav Peleshko
aa33ca0a52 nir/loop_analyze: Fix inverted condition handling in iterations calculation
In the tagged commit, we stopped actually inverting the condition, and
instead relied on the "invert_cond" flag. But we missed a few places
where this flag should've been handled too.

Also, add a few more tests to make sure this won't regress in the future.

Fixes: 99a7a664 ("nir/loop_analyze: Change invert_cond instead of changing the condition")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10012
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26024>
2023-11-07 11:44:45 +00:00
Vitaliy Triang3l Kuzmin
fd08d90d2a nir: Don't skip lower_alu if only bit_count needs lowering
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Signed-off-by: Vitaliy Triang3l Kuzmin <triang3l@yandex.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26048>
2023-11-07 08:52:52 +00:00
Mary Guillemard
0aa4148978 nir: Add AGX-specific doorbell and stack mapping opcodes
Signed-off-by: Mary Guillemard <mary@mary.zone>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26056>
2023-11-07 00:05:55 +00:00
Alyssa Rosenzweig
8d9d9d0207 nir/print: handle 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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
d0a4a8cda0 nir: Add intrinsics for lowering bindless textures/samplers
Needed for merged stages to work properly.

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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
33e80918de nir: Add intrinsics for lowering GS
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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
cc3f20ca6c nir: Also gather decomposed primitive count
Simple extension.

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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
b65636ca40 nir/lower_gs_intrinsics: Count decomposed primitives too
We need both: decomposed primitives for transform feedback and regular
primitives for the sizing the index buffer.

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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
0a35aa3a2b nir/lower_gs_intrinsics: Append EndPrimitive
This is simpler for generic GS lowering.

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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
f157a3de4e nir/lower_gs_intrinsics: Include primitive counts
Generic GS lowering needs this, we already calculate it.

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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
a147801f9b compiler: Make u_decomposed_prims_for_vertices available to CL
For indirect geometry shader setup.

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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
64f7b70763 compiler: Inline mesa_vertices_per_prim
Makes it more easily consumable from the gpu.

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/26056>
2023-11-07 00:05:54 +00:00
Alyssa Rosenzweig
7cfe2ecb33 compiler: Make shader_enums.h CL-safe
macros.h is not safe for CL for a bunch of reasons but shader_enums.h barely
uses its functionality. Stub out the minimum for CL.

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/26056>
2023-11-07 00:05:54 +00:00
Samuel Pitoiset
abfd208cb0 nir: fix inserting the break instruction for partial loop unrolling
If the break in the original loop isn't in the first top-level if,
this would have re-inserted it in the wrong block.

Fixes this by re-inserting the break block to the corresponding break
block in the new loop by using the remap hashtable.

fossils-db (NAVI21):
Totals from 88 (0.11% of 79330) affected shaders:
Instrs: 109602 -> 109929 (+0.30%); split: -0.10%, +0.40%
CodeSize: 570968 -> 573332 (+0.41%); split: -0.08%, +0.49%
Latency: 1682510 -> 1682505 (-0.00%); split: -0.01%, +0.01%
Copies: 12832 -> 12746 (-0.67%); split: -1.54%, +0.87%
Branches: 2879 -> 2930 (+1.77%)

Deathloop and F1 2023 are affected but I'm not aware of any issues
for these two games.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10001
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26009>
2023-11-06 09:18:09 +00:00
antonino
4a627af0e3 nir: don't take the derivative of the array index in nir_lower_tex
Previosuly when lowering to txd for sampler array the index would be
derived as well, therefore the resulting derivative would have been a
vec with one more component than what the txd instruction expects.

This patch truncates the coordinate vector in this case to make sure the
index is not derived.

Fixes: b154a4154b ("nir/lower_tex: rewrite tex/txb -> txd/txl before saturating srcs")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26012>
2023-11-03 12:53:11 +00:00
Faith Ekstrand
1793adbd3a nir/validate: Allow array derefs on vectors on function/shader_temp
This is required by OpenCL.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Faith Ekstrand
0b3b4da82a nir: Handle array-deref-of-vec in var split passes
The changes are pretty straightforward.  For vector splitting, we just
ignore those vectors for now.  We could potentially handle array derefs
with a constant index (and probably should) but that's left for later.
For now, I'm mostly concerned with correctness of the pass.

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Faith Ekstrand
6bc8567bb9 nir: Handle array-deref-of-vec in vars_to_ssa
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7746
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Faith Ekstrand
68c54c994a nir/types: Support vectors in glsl_get_length()
This makes it consistent with glsl_get_array_element() which returns the
scalar type for vectors, column type for matrices, and array element
type for arrays.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Faith Ekstrand
1e1c450659 nir/lower_io_to_vector: Only call glsl_get_length() on arrays
We assumed that calling it on vectors would return 0 and then did a
MAX2(length, 1) to get 1 for vectors.  Instead, use a ternary so we
don't make assumptions about non-sensical values.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Karol Herbst
d17dc3e9cd nir: Stop assuming glsl_get_length() returns 0 for vectors
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Faith Ekstrand
a1f3c5eea7 nir: Add asserts to nir_phi_builder_value_set_block_def
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Faith Ekstrand
5adb335507 nir: Use nir_builder to insert movs
Also, leave a big comment about why we're inserting movs and not just
propagating SSA values directly.  Hopefully this will prevent idiots
like me from getting clever and thinking they can delete that mov. 😅

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Faith Ekstrand
15ab4d397f nir: Handle wildcards with casts in copy_prop_vars
If we're propagating a copy from a cast where the copy copies an entire
array, we end up with something like &((S *)ssa_N)->f[*] in the source
where a wildcard has a cast in its parent chain.  If we then try to
propagate the read into a non-wildcard array load, we have to specialize
the wildcard.  This breaks because nir_build_deref_follower() doesn't
handle casts.  Since we know a priori that, because wildcards are only
generated by copy_deref on arrays, we cannot have a cast with a wildcard
parent so simply chasing the source deref to the first wildcard will
ensure that any casts in the deref are handled properly.

Fixes: ba2bd20f87 ("nir: Rework opt_copy_prop_vars to use deref instructions")
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
2023-11-02 20:28:46 +00:00
Alyssa Rosenzweig
a6afa48e86 clc: Add missing idep_vtn
From the libclc linking code. This should probably be split out but that seems
like potentially a task for another day. Avoids a linker error in the next
commit the easy way.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
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/25498>
2023-11-02 11:37:46 +00:00
Alyssa Rosenzweig
f164edfe71 vtn: Add spirv_library_to_nir_builder feature
This new entrypoint takes in a SPIR-V blob and generates a header containing
a static inline nir_builder-family function for each function in the SPIR-V
library. The generated function will look for the function in the shader and, if
not found, insert a new nir_function with the appropriate signature -- to be
linked with the library later. Then, it will call the function, with the
appropriate gymnastics to handle return values as necessary.

This makes it super convenient to wrap CL libraries for use in a NIR pass.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25498>
2023-11-02 11:37:46 +00:00
Alyssa Rosenzweig
b192f3c458 nir/builder: Add nir_call helper
This adds an idiomatic way to insert NIR function calls with the builder. Since
functions have variable numbers of arguments, this is a variadic function.

v2: Define with a variadic macro instead, for safety with the argument count.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
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/25498>
2023-11-02 11:37:46 +00:00
Alyssa Rosenzweig
23bea25207 nir: Add nir_remove_non_exported
For libraries.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
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/25498>
2023-11-02 11:37:46 +00:00
Alyssa Rosenzweig
6014f745d5 nir,vtn: Add exported bool to nir_function
For optimizing libraries.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
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/25498>
2023-11-02 11:37:46 +00:00
Faith Ekstrand
6388896985 nir: add deref follower builder for casts.
This fixes intel_clc builds with llvm 17 on gfx125_bvh_build_DFS_DFS
where it dies in the lower indirect derefs pass.

Co-authored-by: Dave Airlie <airlied@redhat.com>
Fixes: 4a4e175738 ("nir: Support deref instructions in lower_var_copies")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25536>
2023-11-01 22:35:23 +00:00
Rhys Perry
debddca134 nir: add helpers to skip idempotent passes
For example, in the loop:
while (more_late_algebraic) {
   more_late_algebraic = false;
   NIR_PASS(more_late_algebraic, nir, nir_opt_algebraic_late);
   NIR_PASS(_, nir, nir_opt_constant_folding);
   NIR_PASS(_, nir, nir_copy_prop);
   NIR_PASS(_, nir, nir_opt_dce);
   NIR_PASS(_, nir, nir_opt_cse);
}
if nir_opt_algebraic_late makes no progress, later passes might be
skippable depending on which ones made progress in the previous iteration.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24197>
2023-11-01 14:16:37 +00:00
Giancarlo Devich
7d0ae38ef7 nir: Workaround MSVC internal compiler error in ARM64 build
Changes a variable type from `nir_component_mask_t` to `uint32_t`. The
variable's name suggests it may have been meant to be a 32-bit integer
anyway.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25691>
2023-10-31 19:33:40 +00:00
Karol Herbst
d6a48ff402 vtn/opencl: always lower to libclc fmod
The nir/spirv variant is simply not precise enough and almost everybody
lowers it anyway.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25837>
2023-10-27 10:52:54 +00:00
Yonggang Luo
ce5475366e compiler,vulkan,drm-shim: Remove unused include directories from meson.build
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/24462>
2023-10-27 01:35:10 +00:00
Yonggang Luo
73b639ec5c nir: #include "util/macros.h" for BITFIELD64_MASK in nir.c
There is no neeed #include "main/menums.h" in nir.c,
as it's belongs to gallium code

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/24462>
2023-10-27 01:35:10 +00:00
Faith Ekstrand
49b3118302 nir/lower_bit_size: Use b2b for boolean subgroup ops
Without this, we replace vote_ieq(b) with vote_ieq(u2u32(b)) which is
wonky because we're doing a u2u on a 1-bit type. With this, we now
replace it with vote_ieq(b2b32(b)).  For other subgroup ops, we replace
things like *scan[op](b) with *scan[op](b2b32(b)).  For scan ops, this
assumes that b2b1(op(b1b32(x), b2b32(y))) = op(x, y) for all of the ops
iand, ior, and ixor.  This is true on all the back-ends I'm aware of.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25894>
2023-10-26 23:05:44 +00:00
Faith Ekstrand
5014759133 nir: Return b2b ops from nir_type_conversion_op()
Without this, nir_type_conversion_op(bool, bool32, RND) will return
u2u32 instead of b2b32 which is pretty unexpected behavior.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25894>
2023-10-26 23:05:44 +00:00