Commit graph

11753 commits

Author SHA1 Message Date
Alyssa Rosenzweig
e88346330e nir/lower_io: remove incorrect Intel _block cases
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
These should be handled like their non-_block counterparts - there is no i/o
index for them.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40096>
2026-02-28 16:32:14 +00:00
Georg Lehmann
6b464785b9 nir/opt_algebraic: optimize d3d9 iand(a, inot(b))
Foz-DB GFX1201:
Totals from 24 (0.02% of 112525) affected shaders:
Instrs: 15598 -> 15426 (-1.10%); split: -1.17%, +0.06%
CodeSize: 88716 -> 88260 (-0.51%); split: -0.98%, +0.46%
Latency: 54419 -> 53965 (-0.83%); split: -0.91%, +0.08%
InvThroughput: 10294 -> 10166 (-1.24%); split: -1.28%, +0.04%
VClause: 302 -> 300 (-0.66%)
SClause: 367 -> 363 (-1.09%); split: -1.63%, +0.54%
Copies: 712 -> 705 (-0.98%); split: -3.09%, +2.11%
PreSGPRs: 1402 -> 1424 (+1.57%); split: -0.14%, +1.71%
PreVGPRs: 850 -> 848 (-0.24%)
VALU: 9730 -> 9591 (-1.43%)
SALU: 1579 -> 1649 (+4.43%)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40104>
2026-02-26 14:44:01 +00:00
Georg Lehmann
a3f9c347bf nir/opt_algebraic: optimize b2f(a) - 1.0 to -b2f(a)
Foz-DB GFX1201:
Totals from 81 (0.07% of 112525) affected shaders:
Instrs: 95048 -> 94965 (-0.09%); split: -0.13%, +0.05%
CodeSize: 532148 -> 531864 (-0.05%); split: -0.09%, +0.04%
SpillSGPRs: 122 -> 125 (+2.46%)
Latency: 440372 -> 440402 (+0.01%); split: -0.02%, +0.03%
InvThroughput: 296078 -> 296173 (+0.03%); split: -0.03%, +0.06%
VClause: 1449 -> 1456 (+0.48%); split: -0.21%, +0.69%
SClause: 2249 -> 2256 (+0.31%); split: -0.09%, +0.40%
Copies: 3956 -> 3965 (+0.23%); split: -0.10%, +0.33%
PreVGPRs: 2900 -> 2899 (-0.03%)
VALU: 61212 -> 61098 (-0.19%); split: -0.19%, +0.01%
SALU: 6970 -> 6981 (+0.16%)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40104>
2026-02-26 14:44:01 +00:00
Georg Lehmann
5b974a922a nir: print all fp_math_ctrl bits
Examples:
div 32    %338 = ffma %89, %328.z, %335 // exact, preserve:sz,inf,nan
con 32    %28 = fmul %17.y, %27 (2.000000) // preserve:sz,inf,nan

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40093>
2026-02-26 14:14:26 +00:00
Alyssa Rosenzweig
8a450fb0ff nir/lower_subgroups: generalize vote lowering
We currently have code to lower quad votes to a ballot. The same idea works for
subgroup votes. Generalize the quad vote code and use it to lower
vote_all/vote_eq for backends setting a new lower_vote option.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40074>
2026-02-25 17:29:29 +00:00
Lionel Landwerlin
7f19814414 brw/nir: handle inline_data_intel more like push_data_intel
It's pretty much the same mechanism, except it's a different register
location.

With this change we gain indirect loading support.

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/39405>
2026-02-25 10:44:09 +00:00
Alyssa Rosenzweig
42c4f7935a nir: optimize u2u32(unpack_32_2x16_split_*)
Noticed while playing with pixel coord things.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40056>
2026-02-24 19:16:56 +00:00
Georg Lehmann
07260dc210 nir/lower_subgroups: lower shuffles and bitwise reduce to 32bit before scalarizing
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Pack/unpack should be a lot faster than duplicating the subgroup op.

No fossil-db changes, but multiple people complained about this to me.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40024>
2026-02-24 13:48:35 +00:00
Georg Lehmann
4dc0f7d540 spirv: implement SPV_VALVE_mixed_float_dot_product
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40003>
2026-02-24 08:55:52 +00:00
Georg Lehmann
0d6fe16ce8 nir: add mixed float dot opcodes
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40003>
2026-02-24 08:55:52 +00:00
Georg Lehmann
d870d10ad9 vulkan,spirv: update headers
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40003>
2026-02-24 08:55:52 +00:00
Rob Clark
ff8b688fc7 nir: Fix validation error after nir_round_int_to_float()
CL CTS test_conversions hits a nir_validate assert than ufind_msb is 32b
or 64b:

    16     %61 = @load_global (%185) (access=none, align_mul=2, align_offset=0)
    32    %240 = ufind_msb %61 error: src_bit_size == 32 || src_bit_size == 64 (../src/compiler/nir/nir_validate.c:273)

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40054>
2026-02-23 22:06:50 +00:00
Faith Ekstrand
e3dc3dccd6 pan/fb: Add a common FB load shader builder
One of the advantages to this new FB load shader, apart from it being
common, is that it's able to properly handle partial tile loads.
Instead of doing the force_preload/clear dance that PanVK is currently
doing, these shaders are clever enough to detect whether or not they're
inside the Vulkan render area and clear the inside while loading the
border pixels.

In order for this to work, there are two new intrinsics which provide
the framebuffer bounding box and the clear values.  We need this in
order to handle partial loads correctly.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39759>
2026-02-23 21:00:01 +00:00
Faith Ekstrand
88ad8bc75d nir/gather_info: Add support for panfrost tile load/store intrinsics
Fixes: 6fc1030e4f ("nir: Add some new panfrost fragment shader intrinsics")
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39759>
2026-02-23 21:00:01 +00:00
Faith Ekstrand
ae901f6175 nir/print: Add panfrost blend intrinsics
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39759>
2026-02-23 21:00:01 +00:00
Caio Oliveira
4207cc673d nir: Handle nir_instr_type_cmat_call in more places
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Prefer to be explicit when handling it, like is done for regular
nir_instr_type_call.

Even though functions called by cmat_call have restrictions on them ("no
tangled instructions" for example), which could allow a couple of passes
to treat them differently, there's no tracking of what functions are
used only in such cases, so being conservative here should be safe.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39903>
2026-02-20 13:09:45 -08:00
Daniel Schürmann
f4e3ab5266 nir/divergence: Ignore divergent_loop_{continue|break} for nir_block::divergent
This is already implicitly accounted for.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39934>
2026-02-19 19:55:33 +00:00
Daniel Schürmann
eabd7cc22c nir/divergence: Fix nir_block::divergent in presence of divergent breaks
If no second pass is necessary, we might miss setting nir_block::divergent
to true, if a loop has a divergent break.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39934>
2026-02-19 19:55:31 +00:00
Daniel Schürmann
a57b900a59 nir/divergence: rename divergent_loop_cf to divergent_cf
in order to better reflect the actual semantics.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39934>
2026-02-19 19:55:31 +00:00
Georg Lehmann
5d5f99bfe8 nir/opt_algebraic: create more b2f if sign of zero doesn't matter
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39966>
2026-02-19 15:21:27 +00:00
Georg Lehmann
d87943ad3d nir/opt_algebraic: preserve signed zero when creating new b2f
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39966>
2026-02-19 15:21:27 +00:00
Georg Lehmann
5e544ecd08 nir/opcodes: remove valid_fp_math_ctrl bits from some opcodes
This is mostly about conversions.

Conversions from float to int don't care about signed zero
and in the case of plain f2u/f2i, nan and inf are always
undefined too.

Conversions for int to float can't create nan, so they don't
need preserve_nan.

b2f only cares about preserve_sz, and nothing else.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39966>
2026-02-19 15:21:27 +00:00
Georg Lehmann
62f3be87c4 nir/serialize: omit serializing fp_math_ctrl if it has to be 0
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39966>
2026-02-19 15:21:27 +00:00
Alyssa Rosenzweig
5d5c2a6430 nir/opt_intrinsics: use data helpers
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39939>
2026-02-19 14:47:11 +00:00
Alyssa Rosenzweig
84f3849688 nir/opt_fragdepth: use data helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39939>
2026-02-19 14:47:11 +00:00
Alyssa Rosenzweig
9da61b3ea5 nir/opt_uniform_atomics: use data helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39939>
2026-02-19 14:47:11 +00:00
Alyssa Rosenzweig
76d5436f04 nir/lower_atomics: use data helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39939>
2026-02-19 14:47:11 +00:00
Alyssa Rosenzweig
8fb1d65426 nir: add nir_get_io_data_src
This complements our existing nir_get_io_index_src helper. Most, but annoyingly
not all, stores put their data source in source 0. Having a helper for this lets
us reduce special casing in a bunch of random places.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39939>
2026-02-19 14:47:11 +00:00
Maíra Canal
5a1e0112a9 nir: add load_texture_scale intrinsic
Add load_texture_scale to the list of intrinsics whose divergence
depends on their sources. This is needed to support running divergence
analysis on VC4.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39768>
2026-02-19 09:57:05 +00:00
Alyssa Rosenzweig
e172f97fdd nir/opt_constant_folding: optimize ballot(false)
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
always zero. noticed on dEQP-VK.subgroups.ballot.graphics.graphic

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39948>
2026-02-18 23:40:44 +00:00
Rob Clark
8cc99edb7b nir: Fill in missing conversion opts
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
I noticed we were missing:

    (('u2f16', ('u2u64', 'a@32')), ('u2f16', a))

This was do to coupling the u2f/i2f opts with i2i/u2u in the same loop
(with different positionals).  The `if B <= S\ncontinue` doesn't apply
to the second part.  So just split these into two loops.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14848
Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39899>
2026-02-18 15:13:21 +00:00
Rhys Perry
fd22c48b2a nir/algebraic: remove ignore_exact
This was used because the exact bit meant something different for
comparisons than it did for the replacement expression, but that isn't the
case anymore.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39809>
2026-02-18 14:04:22 +00:00
Rhys Perry
f44de53586 nir: only set fp_math_ctrl if meaningful
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39809>
2026-02-18 14:04:22 +00:00
Rhys Perry
12df083e0b nir: fix fmin_agx/fmax_agx constant folding
This seems to have two issues:
- since d7e88c0ccd, denormals would be flushed
- it did a f32->u32 conversion

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39809>
2026-02-18 14:04:22 +00:00
Rhys Perry
dfad15df0b nir/load_store_vectorize: don't update last_entry after a barrier
fossil-db (navi31):
Totals from 2 (0.00% of 84369) affected shaders:
Instrs: 7738 -> 7740 (+0.03%)
Latency: 333207 -> 333239 (+0.01%)
InvThroughput: 33320 -> 33324 (+0.01%)
VClause: 382 -> 384 (+0.52%)
VMEM: 656 -> 658 (+0.30%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 4ca7ee7bd7 ("nir/opt_load_store_vectorize: Allow to vectorize at most one entry of each type across blocks")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14825
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39849>
2026-02-18 10:09:14 +00:00
Rhys Perry
b203329e0d nir/load_store_vectorize: more carefully add entries from loop preheader
This would fix both stores 'b' and 'c' from being vectorized:
a = load(0)
loop {
   b = load(0)
   if (break)
   store(0)
}
c = load(0)

fossil-db (navi31):
Totals from 8 (0.01% of 84369) affected shaders:
Instrs: 12035 -> 12066 (+0.26%)
CodeSize: 63016 -> 63208 (+0.30%)
Latency: 176091 -> 177013 (+0.52%)
InvThroughput: 43894 -> 43981 (+0.20%)
SClause: 194 -> 196 (+1.03%)
Copies: 803 -> 812 (+1.12%)
VALU: 7666 -> 7675 (+0.12%)
SALU: 1102 -> 1105 (+0.27%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 4ca7ee7bd7 ("nir/opt_load_store_vectorize: Allow to vectorize at most one entry of each type across blocks")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14825
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39849>
2026-02-18 10:09:14 +00:00
Alyssa Rosenzweig
f55e87db93 nir: add missing ssbo atomics to nir_get_io_index_src_number
Match other SSBO intrinsics and other atomics.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39895>
2026-02-17 15:42:36 +00:00
Daniel Schürmann
d66de1bb49 glsl_to_nir: emit loop continue construct
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/39777>
2026-02-17 13:15:36 +00:00
Georg Lehmann
6a662a59b7 nir/opt_algebraic: optimize 1.0 - b2f(a) to b2f(inot(a))
Which can then be cleaned up further.

Foz-DB Navi48:
Totals from 4156 (3.62% of 114655) affected shaders:
MaxWaves: 102580 -> 102620 (+0.04%)
Instrs: 11696222 -> 11679986 (-0.14%); split: -0.16%, +0.02%
CodeSize: 64452544 -> 64379204 (-0.11%); split: -0.13%, +0.02%
VGPRs: 288256 -> 288172 (-0.03%)
SpillSGPRs: 7290 -> 7297 (+0.10%)
Latency: 160690992 -> 160643825 (-0.03%); split: -0.05%, +0.02%
InvThroughput: 26869332 -> 26849963 (-0.07%); split: -0.09%, +0.02%
VClause: 237078 -> 237003 (-0.03%); split: -0.04%, +0.01%
SClause: 270560 -> 270564 (+0.00%); split: -0.01%, +0.01%
Copies: 936165 -> 937970 (+0.19%); split: -0.07%, +0.26%
Branches: 302981 -> 302992 (+0.00%); split: -0.00%, +0.00%
PreSGPRs: 244967 -> 245303 (+0.14%)
PreVGPRs: 232930 -> 232886 (-0.02%); split: -0.02%, +0.00%
VALU: 6200283 -> 6187264 (-0.21%); split: -0.23%, +0.02%
SALU: 1759176 -> 1760275 (+0.06%); split: -0.10%, +0.16%
VOPD: 447502 -> 446194 (-0.29%); split: +0.14%, -0.43%

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39917>
2026-02-17 10:01:21 +00:00
Rhys Perry
c0143829f9 nir/opt_intrinsics: optimize inot(inverse_ballot(const))
No fossil-db changes.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38262>
2026-02-16 19:39:43 +00:00
Georg Lehmann
bca5aab2be nir: let nir_analyze_fp_range take a nir_def
This is midly worse for vector constants, but so much simpler.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39756>
2026-02-16 18:08:53 +00:00
Georg Lehmann
474af815ff nir: rename nir_analyze_range because it's float only
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39756>
2026-02-16 18:08:53 +00:00
Georg Lehmann
f2a59fdea6 nir: remove non float nir_analyse_range support
This was always unused/unfinished.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39756>
2026-02-16 18:08:53 +00:00
Georg Lehmann
f7222d6939 nir/opt_algebraic: remove few uses of integer nir_analyze_range
Surprisingly, this has an effect on GFX1201:

Totals from 66 (0.08% of 82405) affected shaders:
Instrs: 200725 -> 201517 (+0.39%)
CodeSize: 978676 -> 981488 (+0.29%)
Latency: 291736 -> 291760 (+0.01%)
InvThroughput: 31556 -> 31604 (+0.15%)
Copies: 11928 -> 12588 (+5.53%)
Branches: 14850 -> 15048 (+1.33%)
SALU: 68981 -> 69509 (+0.77%)

I say surprisingly, because nir_analyze_range handles nothing but
constants and bcsel for integers. Maybe rdr2 is actually
hitting some weird bcsel(a, #b, #c) == 0 case where b and c are not 0?
No, I looked at a few of those shaders, and it's just noise from changed
instruction order.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39756>
2026-02-16 18:08:53 +00:00
Marek Olšák
aa92b464f3 nir/opt_non_uniform_access: use new query flags
NFC for drivers

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39743>
2026-02-16 12:59:36 +00:00
Marek Olšák
61a96be494 nir/lower_non_uniform_access: add an option not to lower tex & image queries
AMD can do non-uniform queries. The RADV change will be in a separate commit.

NFC for drivers.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39743>
2026-02-16 12:59:36 +00:00
Marek Olšák
a9df891bc6 nir: allow get_ssbo_size to return a 64-bit result
to match get_ubo_size, and to support HW where SSBOs can have a 64-bit size.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39743>
2026-02-16 12:59:36 +00:00
Marek Olšák
c151402f35 nir: add ACCESS to get_ubo_size
so that we can set NON_UNIFORM

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39743>
2026-02-16 12:59:36 +00:00
Marek Olšák
1d09a975bf nir: handle get_ubo_size as a resource query in nir_shader_gather_info
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39743>
2026-02-16 12:59:36 +00:00
Ian Romanick
9017d37e84 nir: Use STACK_ARRAY instead of NIR_VLA
The number of fields comes from the shader, so it could be a value large
enough that using alloca would be problematic.

Fixes: c11833ab24 ("nir,spirv: Rework function calls")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39866>
2026-02-14 01:19:27 +00:00