Commit graph

11568 commits

Author SHA1 Message Date
Emma Anholt
fd7754fba1 nir/opt_algebraic_tests: Allow testing imad24_ir3.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39369>
2026-01-26 05:39:39 +00:00
Emma Anholt
ce7ad2639a nir: Fix C UB in imad24_ir3 evaluation.
Same fix as imul24, technically you can't shift into the top bit of the
int32, but the util helper does it right.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39369>
2026-01-26 05:39:39 +00:00
Caio Oliveira
231747b7fa spirv: Check Capability for identifying SPV_NV_mesh_shader
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Take advantage of the new enabled_capabilities.  Note MeshShadingNV
is not an alias to MeshShadingEXT.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39505>
2026-01-25 05:11:00 +00:00
Christian Gmeiner
4fedf6bedd nir/lower_blend: Add advanced blending support
Add support for advanced blending (VK_EXT_blend_operation_advanced and
GL_KHR_blend_equation_advanced), enabling around 40 advanced blend modes
including multiply, screen, overlay, HSL modes (hue, saturation, color,
luminosity), Porter-Duff modes, and extended modes like lineardodge
and vividlight.

Advanced blending slots into the existing blending logic alongside logic
operations and standard blending. The implementation supports both
premultiplied and non-premultiplied alpha for source and destination, and
provides three overlap modes (uncorrelated, conjoint, disjoint).

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38929>
2026-01-24 21:44:01 +00:00
Christian Gmeiner
9c7088f41c nir: Extract blend equation helpers to shared header
Move the blend equation helper functions (blend_multiply, blend_screen,
blend_overlay, etc.) from gl_nir_lower_blend_equation_advanced.c to a
new shared header file nir_blend_equation_advanced_helper.h.

These helpers implement the mathematical blend operations defined by
KHR_blend_equation_advanced and will be reused by the new NIR lowering
pass for VK_EXT_blend_operation_advanced.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38929>
2026-01-24 21:44:01 +00:00
Christian Gmeiner
4294e0bbd4 util/blend: Add advanced blend modes
VK_EXT_blend_operation_advanced and GL_NV_blend_equation_advanced
defines additional blend operations beyond what OpenGL KHR_blend_equation_advanced
provides. Add these modes to pipe_advanced_blend_mode.

Also add a default case to gl_nir_lower_blend_equation_advanced.c
to handle unsupported modes gracefully.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38929>
2026-01-24 21:44:00 +00:00
Christian Gmeiner
1eed6960c5 compiler/mesa/st: Move gl_advanced_blend_mode to util/blend.h
Rename gl_advanced_blend_mode to pipe_advanced_blend_mode and move it
to src/util/blend.h so it can be shared between OpenGL and Vulkan
drivers.

This prepares for implementing VK_EXT_blend_operation_advanced by
providing a common enum for advanced blend modes across APIs.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38929>
2026-01-24 21:44:00 +00:00
Daniel Schürmann
50bb16d8ea nir/lower_non_uniform_access: flag IF as always divergent taken
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Totals from 849 (1.01% of 84383) affected shaders: (Navi48)

Instrs: 5411150 -> 5387935 (-0.43%)
CodeSize: 30782816 -> 30733420 (-0.16%); split: -0.21%, +0.05%
Latency: 44569512 -> 44282889 (-0.64%)
InvThroughput: 6822696 -> 6785429 (-0.55%); split: -0.55%, +0.00%
SClause: 159022 -> 159017 (-0.00%)
Branches: 174234 -> 152625 (-12.40%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39490>
2026-01-24 12:08:40 +00:00
Samuel Pitoiset
bb4157ad31 spirv: Update the JSON and headers
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39476>
2026-01-23 16:07:30 +00:00
Connor Abbott
c7a60fca3c nir, ir3: Make ir3 GS varyings use a proper index
Use a similar technique of reusing TCS-only varyings for VS/TES/GS.
This way outputs_written can be used to see whether GS lowering has
already been run.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
2026-01-21 20:54:15 +00:00
Connor Abbott
5abe3db518 nir/lower_clip: Correctly handle driver_location in VS lowering
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
2026-01-21 20:54:15 +00:00
Connor Abbott
62085044a4 nir: Allow lower_clip_fs with lowered IO
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
2026-01-21 20:54:14 +00:00
Connor Abbott
b8905ff2f0 nir/recompute_io_bases: Fix num_inputs with dual-slot VS inputs
Use num_normal_inputs, which also includes dual-slot inputs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
2026-01-21 20:54:14 +00:00
Connor Abbott
778ed567ed nir/recompute_io_bases: Fix handling of dual-source blending
We forgot to increment num_outputs for dual-source outputs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
2026-01-21 20:54:14 +00:00
Connor Abbott
32a4146992 nir: Fix recompute_io_bases with compact i/o arrays
Follow the example of unlower_io_to_vars, so that when called within
that pass we don't incorrectly recalculate bases for backends that have
compact arrays.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
2026-01-21 20:54:14 +00:00
Connor Abbott
3208cc80b1 nir: Move is is_compact() out of unlower_io_to_vars
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39328>
2026-01-21 20:54:13 +00:00
Lionel Landwerlin
a19e949824 brw: move coarse_z computation to NIR
So that we can print it easily with debug printfs

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38996>
2026-01-21 16:00:52 +00:00
Lionel Landwerlin
98194dfa0b nir: add intrinsics for Z calculation in shaders with FSR
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38996>
2026-01-21 16:00:52 +00:00
Lionel Landwerlin
12be2a580c nir/compiler_options: add nir_load_pixel_coord
And use it for nir_printf_fmt_at_px().

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38996>
2026-01-21 16:00:50 +00:00
Daniel Schürmann
89b9fcb5e7 nir/opt_load_store_vectorize: delay aliasing test in try_vectorize_shared2()
Checking for aliasing can be very expensive.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38659>
2026-01-21 14:20:06 +00:00
Daniel Schürmann
598928d7e7 nir/loop_analyze: determine whether all control flow gets eliminated upon loop unrolling
Totals from 17 (0.02% of 79839) affected shaders: (Navi48)

MaxWaves: 241 -> 243 (+0.83%); split: +5.81%, -4.98%
Instrs: 44198 -> 43786 (-0.93%); split: -8.19%, +7.26%
CodeSize: 230284 -> 226900 (-1.47%); split: -10.55%, +9.08%
VGPRs: 2152 -> 2524 (+17.29%); split: -3.90%, +21.19%
Scratch: 718848 -> 0 (-inf%)
Latency: 128977 -> 145720 (+12.98%); split: -2.12%, +15.10%
InvThroughput: 206804 -> 254250 (+22.94%); split: -0.32%, +23.27%
VClause: 1296 -> 1309 (+1.00%); split: -28.09%, +29.09%
SClause: 835 -> 833 (-0.24%)
Copies: 6284 -> 3630 (-42.23%); split: -44.51%, +2.28%
Branches: 1003 -> 961 (-4.19%)
PreSGPRs: 1003 -> 996 (-0.70%); split: -1.20%, +0.50%
PreVGPRs: 1510 -> 2130 (+41.06%)
VALU: 23577 -> 24309 (+3.10%); split: -6.26%, +9.37%
SALU: 5875 -> 5688 (-3.18%); split: -6.26%, +3.08%
VMEM: 3679 -> 3001 (-18.43%); split: -33.27%, +14.84%
SMEM: 1632 -> 1631 (-0.06%)
VOPD: 23 -> 24 (+4.35%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38659>
2026-01-21 14:20:06 +00:00
Daniel Schürmann
4997d8fb1b nir/loop_analyze: determine for all ALU whether it can be constant-folded
Totals from 16 (0.02% of 79839) affected shaders: (Navi48)

MaxWaves: 512 -> 464 (-9.38%)
Instrs: 11821 -> 17205 (+45.55%)
CodeSize: 60536 -> 86644 (+43.13%)
VGPRs: 732 -> 804 (+9.84%)
Latency: 68411 -> 39349 (-42.48%)
InvThroughput: 14217 -> 9306 (-34.54%)
VClause: 223 -> 302 (+35.43%)
SClause: 262 -> 317 (+20.99%)
Copies: 961 -> 696 (-27.58%); split: -39.23%, +11.65%
Branches: 182 -> 158 (-13.19%); split: -29.67%, +16.48%
PreSGPRs: 1210 -> 945 (-21.90%); split: -29.42%, +7.52%
PreVGPRs: 647 -> 633 (-2.16%)
VALU: 5112 -> 10857 (+112.38%)
SALU: 3215 -> 2335 (-27.37%); split: -30.67%, +3.30%
VMEM: 228 -> 349 (+53.07%)
SMEM: 567 -> 549 (-3.17%); split: -3.70%, +0.53%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38659>
2026-01-21 14:20:06 +00:00
Natalie Vock
30f6eacfad radv/rt: Call ahit/isec shaders
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39314>
2026-01-20 21:49:55 +00:00
Icenowy Zheng
b61dbc98fd nir/algebraic: fix Python-3.10-incompatible syntax
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Using a string literal enclosed with the same type of quotation marks
with the outer f-string isn't supported on Python 3.10, which is
currently still with security maintainance.

This leads to syntax error when building Mesa with Python 3.10.

Fix this by alternating these string literals' quotation mark to '' (as
the outer f-string uses "").

Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14673
Reviewed-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39372>
2026-01-20 11:14:41 +00:00
Faith Ekstrand
2313bec66e nir: Expose the guts of nir_lower_blend as builder helpers
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39367>
2026-01-19 21:33:14 +00:00
Faith Ekstrand
d2c2d798f8 nir/lower_blend: Optimize trivial logic op cases
There's no point in going to/from UNORM if we're just going to copy or
throw away the source.

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39367>
2026-01-19 21:33:14 +00:00
Faith Ekstrand
68d22b5a2a nir/lower_blend: Move the format to nir_lower_blend_rt
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39367>
2026-01-19 21:33:14 +00:00
Faith Ekstrand
d6556a580f nir,pan: Add and implement a new store_tile_pan intrinsic
Like we just did with load_tile_pan, this maps directly to ST_TILE in
the hardware.  This is more versatile and lets us do more of our
lowering in NIR.

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39367>
2026-01-19 21:33:13 +00:00
Faith Ekstrand
11b6cd2f2c nir,pan: Rework the pafrost tile load intrinsic
Instead of making it explicitly about outputs, this switchies it to
being a NIR version of LD_TILE.  It means we have to do a bit of work in
NIR and add a builder helper but the end result is something much more
versatile.

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39367>
2026-01-19 21:33:13 +00:00
Faith Ekstrand
4189865347 nir: panfrost tile loads are always divergent
Each lane refers to a different pixel.

Cc: mesa-stable
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39367>
2026-01-19 21:33:13 +00:00
Georg Lehmann
70a951c3f3 nir/search: allow inexact patterns if denorms have to be flushed
Patterns should ensure that they flush denorms with fcanonicalize.

Removing in between denorm flushing when fusing operations is explicitly
allowed unless those optimizations are generally disallowed by other
floating point math control flags.

Foz-DB Navi21:
Totals from 291 (0.35% of 82377) affected shaders:
Instrs: 138347 -> 137773 (-0.41%)
CodeSize: 751460 -> 748516 (-0.39%)
Latency: 1686466 -> 1686226 (-0.01%); split: -0.02%, +0.01%
InvThroughput: 270847 -> 269963 (-0.33%)
VClause: 2023 -> 2022 (-0.05%)
SClause: 5271 -> 5260 (-0.21%); split: -0.25%, +0.04%
Copies: 8929 -> 8912 (-0.19%)
VALU: 87108 -> 86552 (-0.64%)
SALU: 23460 -> 23443 (-0.07%)

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39180>
2026-01-19 16:11:29 +00:00
Georg Lehmann
442daeb54a nir/opt_algebraic: use fcanonicalize
Mostly optimizations, some minor fixes but I don't
think they are worth backporting.

Foz-DB Navi21:
Totals from 7570 (9.21% of 82151) affected shaders:
MaxWaves: 204288 -> 204476 (+0.09%); split: +0.09%, -0.00%
Instrs: 4511439 -> 4500261 (-0.25%); split: -0.25%, +0.00%
CodeSize: 23727088 -> 23644388 (-0.35%); split: -0.35%, +0.00%
VGPRs: 290944 -> 290616 (-0.11%); split: -0.12%, +0.01%
SpillSGPRs: 1256 -> 1251 (-0.40%)
Latency: 16738072 -> 16726717 (-0.07%); split: -0.10%, +0.04%
InvThroughput: 3736856 -> 3716631 (-0.54%); split: -0.55%, +0.01%
VClause: 66150 -> 66156 (+0.01%); split: -0.05%, +0.06%
SClause: 93644 -> 93631 (-0.01%); split: -0.02%, +0.01%
Copies: 448816 -> 458584 (+2.18%); split: -0.05%, +2.22%
Branches: 139817 -> 139775 (-0.03%); split: -0.03%, +0.00%
PreSGPRs: 321922 -> 321900 (-0.01%); split: -0.01%, +0.00%
PreVGPRs: 239709 -> 238856 (-0.36%); split: -0.39%, +0.03%
VALU: 2595164 -> 2584250 (-0.42%); split: -0.43%, +0.01%
SALU: 839038 -> 838965 (-0.01%); split: -0.02%, +0.01%
VMEM: 137584 -> 137583 (-0.00%)

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39180>
2026-01-19 16:11:29 +00:00
Rhys Perry
625afb0d29 nir: add fcanonicalize
v2(Georg Lehmann):
Always remove fcanonicalize if denorms must be neither flushed nor preserved.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39180>
2026-01-19 16:11:29 +00:00
Georg Lehmann
43d998df84 nir: document that both input and output denorms have to be flushed
This allows us to remove a * 1.0 or a - 0.0 if is_only_used_as_float.
We already rely on that.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39180>
2026-01-19 16:11:28 +00:00
Georg Lehmann
d7e88c0ccd nir/constant_expressions: flush input denorms if denorms have to be flushed
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39180>
2026-01-19 16:11:28 +00:00
Georg Lehmann
7e93aebbec nir/constant_expressions: don't avoid unused source variable warnings
The only use case for this was fddx/fddy and they are no longer alu
for good reasons. For current and future alu, unused sources don't make sense.

And if you really want it, you can still explicitly cast the variable to void.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39180>
2026-01-19 16:11:28 +00:00
Eric Engestrom
30c2e6dbf2 nir/meson: drop redundant --build-tests in favour of just checking if --out-tests is set
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39350>
2026-01-16 16:55:21 +00:00
Eric Engestrom
246095da49 nir/meson: only try to generate the nir_opt_algebraic tests when requested
Anything listed in a meson target's `output` is expected to exist once
the command has run. If it's missing, meson/ninja will run the command
again to try to generate it, resulting in a ton of files getting
re-generated/re-compiled for no reason.

Fixes: 4c30c44b75 ("nir: Generate unit tests for nir_opt_algebraic")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14667
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39350>
2026-01-16 16:55:21 +00:00
Michal Vanis
75d95cb355 glsl: replace gl ctx direct access
Replaces GL API context access with an abstraction as
to allow for https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21343

Signed-off-by: Michal Vanis <mik@vanis.sh>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38981>
2026-01-15 22:21:05 +00:00
Konstantin Seurer
4c30c44b75 nir: Generate unit tests for nir_opt_algebraic
This catches a number of bugs in the current NIR algebraic optimizations
or opcodes implementations (as fixed in this series, or documented in the
XFAIL tests), and should prevent many future bugs from landing.

This required bumping the test timeout, because s390x is very slow to
emulate in CI.

Closes: #3338
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:43 +00:00
Emma Anholt
df215cc3cd nir/opt_algebraic_tests: Mark patterns as unsupported or xfails.
This way as a pattern author/editor you can immediately see whether it's
getting test coverage and if there are known issues with the pattern.
This will also give us clear outcomes from testing as we fix failing
patterns.

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:43 +00:00
Konstantin Seurer
f5864ed408 nir/opt_algebraic_tests: Add an option for generating unit tests
It only emits tests for exact patterns which do not use instructions
that drop precision by design.

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:40 +00:00
Emma Anholt
14fafebc1a nir/algebraic: Fix typo in error message print.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:40 +00:00
Konstantin Seurer
363b2655b6 nir: Add a unit test base class for algebraic patterns
nir_algebraic_pattern_test can validate shaders with the following
structure:

%0 = @provide(base = 0)
...
%N = @provide(base = input_count)

// multiple equivalent expressions
a = ...
b = ...

valid = ieq(a, b)
@use(valid)

Expressions are evaluated by emulating the shader using
nir_eval_const_opcode.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:37 +00:00
Emma Anholt
8ebe630a13 nir/search_helpers: Avoid UB in is_2x_16_bits()/is_neg2x_16_bits().
Same trick we do for nir_imul evaluation -- do the multiply in unsigned to
get defined behavior from C.  Fixes UBSan failures with
nir_opt_algebraic_pattern_tests.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:37 +00:00
Emma Anholt
7dbd170a7f nir/opcodes: Cast isub/iadd3's args to uint to avoid UB integer underflow.
Same treatment as iadd itself got.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:37 +00:00
Emma Anholt
8529aaa399 nir/opcodes: Avoid technical UB left shifting ints.
We all know that (int)0xff << 24 is fine, but UBSan doesn't like it.
These were triggered by nir_opt_algebraic_pattern_tests.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:37 +00:00
Konstantin Seurer
079d416e99 nir: Fix the types of udot_.*_uadd_sat
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:37 +00:00
Konstantin Seurer
38d0bd7dd3 nir: Add an assert_eq intrinsic for testing nir_opt_algebraic
During the test this will compares both sources and fails the test if they
are not equal.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:37 +00:00
Emma Anholt
ed8676dc28 nir: Rename the unit_test_*_amd intrinics to be un-vendored.
We'll reuse these from the nir_opt_algebraic_pattern_test.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39076>
2026-01-15 19:09:37 +00:00