Georg Lehmann
f5bace5bf6
nir: fix frsq range analysis
...
Foz-DB Navi21:
Totals from 98 (0.12% of 79377) affected shaders:
Instrs: 157311 -> 157675 (+0.23%); split: -0.03%, +0.26%
CodeSize: 844296 -> 846648 (+0.28%); split: -0.00%, +0.28%
Latency: 1275467 -> 1276259 (+0.06%); split: -0.00%, +0.06%
InvThroughput: 266980 -> 267098 (+0.04%); split: -0.03%, +0.07%
Copies: 11094 -> 11093 (-0.01%)
PreVGPRs: 5945 -> 5977 (+0.54%)
VALU: 110585 -> 110953 (+0.33%); split: -0.04%, +0.38%
SALU: 18481 -> 18476 (-0.03%)
Cc: mesa-stable
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33557 >
(cherry picked from commit 81b4629636 )
2025-02-18 22:46:11 +01:00
Georg Lehmann
5c65587861
nir: fix range analysis for frcp
...
Foz-DB Navi21:
Totals from 448 (0.56% of 79377) affected shaders:
Instrs: 669306 -> 669318 (+0.00%); split: -0.00%, +0.00%
CodeSize: 3736580 -> 3738840 (+0.06%); split: -0.00%, +0.06%
Latency: 5860916 -> 5860961 (+0.00%); split: -0.00%, +0.00%
InvThroughput: 1344094 -> 1344135 (+0.00%); split: -0.00%, +0.00%
VClause: 13878 -> 13879 (+0.01%)
Copies: 58538 -> 58532 (-0.01%)
VALU: 479807 -> 479820 (+0.00%); split: -0.00%, +0.00%
Cc: mesa-stable
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33557 >
(cherry picked from commit 25300ac18a )
2025-02-18 22:46:09 +01:00
James Hogan
fdb7f38da0
glsl: Expose gl_ViewID_OVR back to GLSL 1.30
...
OVR_multiview requires OpenGL 3.0, so expose gl_ViewID_OVR builtin back
to GLSL 1.30 on OpenGL.
v2: Minor whitespace fix
Fixes: 328c29d600 ("mesa,glsl,gallium: add GL_OVR_multiview")
Signed-off-by: James Hogan <james@albanarts.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33346 >
(cherry picked from commit b774b615d2 )
2025-02-04 20:47:26 +01:00
Tapani Pälli
cb71030387
mesa: enable GL_EXT_conservative_depth extension
...
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33065 >
2025-01-30 10:50:37 +00:00
Timothy Arceri
e639cd768d
glsl: fix return value for subgroupBallot()
...
The original code attempted to create a second instance of the intrinsic
with only a different return value which isn't possible since the params
(in this case 0 params) are the same. To fix this were need to create
two differently named intrinsics.
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Fixes: a496d84ac8 ("glsl: add KHR_shader_subgroup_ballot builtin functions")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12510
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33231 >
2025-01-30 06:06:32 +00:00
Daniel Schürmann
3868102a04
nir/loop_analyze: stack-allocate loop_info_state
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:36 +00:00
Daniel Schürmann
fbaabcfb0a
nir/loop_analyze: store nir_loop_induction_variable hash table in loop_info
...
No need to create a separate array.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:36 +00:00
Daniel Schürmann
f327ece9bf
nir/loop_analyze: re-use the same nir_loop_variable struct before and after the increment
...
The information is redundant.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:36 +00:00
Daniel Schürmann
de30bfd5b8
nir/loop_analyze: ignore terminating induction variable in guess_loop_limit()
...
The array access might be using a different induction variable.
Totals from 23 (0.03% of 79395) affected shaders: (Navi31)
Instrs: 113742 -> 121017 (+6.40%)
CodeSize: 592152 -> 636228 (+7.44%)
Latency: 439244 -> 426784 (-2.84%)
InvThroughput: 36264 -> 35199 (-2.94%)
SClause: 3048 -> 3426 (+12.40%)
Copies: 10630 -> 10733 (+0.97%)
Branches: 3774 -> 4310 (+14.20%)
PreSGPRs: 1683 -> 1696 (+0.77%)
PreVGPRs: 1230 -> 1232 (+0.16%)
VALU: 51026 -> 55912 (+9.58%)
SALU: 15270 -> 15638 (+2.41%)
SMEM: 4456 -> 5149 (+15.55%)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:36 +00:00
Daniel Schürmann
7eb2e96d16
nir/loop_analyze: insert only induction vars into hash map
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:35 +00:00
Daniel Schürmann
f0fd04327f
nir/loop_analyze: replace nir_loop_variable array with hash table
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:35 +00:00
Daniel Schürmann
642a980c9e
nir/loop_analyze: don't initialize nir_loop_variable separately
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:35 +00:00
Daniel Schürmann
f11edceae3
nir/loop_analyze: directly record induction variables into nir_loop_info
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:35 +00:00
Daniel Schürmann
e639c4d74f
nir/loop_analyze: remove nir_loop_variable::in_loop
...
This information is redundant.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:35 +00:00
Daniel Schürmann
7f244ced10
nir/loop_analyze: remove nir_loop_variable::in_if_branch and nir_loop_variable::in_nested_loop
...
This information is redundant.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:35 +00:00
Daniel Schürmann
83f395a7ce
nir/loop_analyze: only iterate loop header phis in compute_induction_information()
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33131 >
2025-01-30 03:48:35 +00:00
Alyssa Rosenzweig
d58ece8d83
nir/serialize: strip function names names
...
this makes stripped nir smaller.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33273 >
2025-01-29 14:37:41 +00:00
Marek Olšák
71e95b373b
radeonsi: remove si_shader_info code that is no longer needed
...
A lot of this info is now derived from shader variant NIR.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32910 >
2025-01-29 07:19:56 +00:00
Marek Olšák
d580313929
radeonsi: add load_polygon_stipple_buffer_amd instead of using si_shader_args
...
We will lower polygon stipple before we have si_shader_args, so we need
an intrinsic to get the buffer descriptor.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32910 >
2025-01-29 07:19:43 +00:00
Friedrich Vock
50e6e3e4ad
nir: Add indirect call optimizations
...
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29577 >
2025-01-29 04:38:51 +00:00
Friedrich Vock
ebbb18aeb6
nir: Free liveness info when invalidating metadata
...
Liveness info can be huge, since with larger shaders it essentially
grows quadratically (linear increase in number of SSA defs *
linear increase in blocks).
Freeing liveness info early helps somewhat mitigate memory usage here.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29577 >
2025-01-29 04:38:51 +00:00
Friedrich Vock
9b1f31a615
nir: Add nir_instr_is_before helper
...
is_instr_between works similarly but requires special-casing w.r.t
the first instruction in a block for the same effect.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29577 >
2025-01-29 04:38:51 +00:00
Friedrich Vock
a8ce60eec1
nir: Apply passes to all functions
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29577 >
2025-01-29 04:38:51 +00:00
Friedrich Vock
bb40284f76
nir: Add indirect calls
...
Used to jump to a function referred to by a runtime pointer.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29577 >
2025-01-29 04:38:51 +00:00
Friedrich Vock
4432cf0a58
vtn: Set parameter type in glsl_type_add_to_function_params
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29577 >
2025-01-29 04:38:51 +00:00
Friedrich Vock
26cbb6b933
nir: Add parameter divergence info
...
Indirect calls may have non-divergent parameters that need to be
explicitly marked as such.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29577 >
2025-01-29 04:38:51 +00:00
Alyssa Rosenzweig
3bfcc4f323
clc,libagx: automatically set lang version
...
bit less meson cargocult.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33242 >
2025-01-28 23:01:32 +00:00
Alyssa Rosenzweig
9f460eadab
clc,libagx: drop --in for mesa_clc
...
just accept the arguments as-is. this matches how gcc/clang actually work
and simplifies the meson.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33242 >
2025-01-28 23:01:32 +00:00
Pavel Ondračka
ea6ccb8628
nir: add support for clamping in nir_lower_tex_shadow
...
From OpenGL 4.6 - 8.23.1 Depth Texture Comparison Mode
Let Dt be the depth texture value and St be the stencil index
component. If there is no stencil component, the value of St is
undefined. Let Dref be the reference value, provided by the shader’s
texture lookup function. If the texture’s internal format indicates
a fixed-point depth texture, then Dt and Dref are clamped to the
range [0, 1]; otherwise no clamping is performed.
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33140 >
2025-01-28 00:01:07 +00:00
Friedrich Vock
767737536e
nir,vtn: Add return info to parameters
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33246 >
2025-01-27 22:21:19 +00:00
Friedrich Vock
3321a56d1d
nir: Serialize all parameter attributes
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33246 >
2025-01-27 22:21:19 +00:00
Alyssa Rosenzweig
54879582b4
nir: fix O(N^2) behaviour in nir_remove_dead_variables
...
..where N = # of functions in the shader. We were accidentally reprocessing the
whole shader for every function impl. Noticed when reading a vtn_bindgen2
profile.
We elect to port the relevant part of the pass to instrctions_pass which fixes
the perf problem while deleting a pile of code.
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/33245 >
2025-01-27 21:40:49 +00:00
Lionel Landwerlin
74f57d7267
meson: required SPIRV-Tools LLVM workaround on LLVM17+
...
Otherwise, compiling some of the shaders in src/intel/shaders, we can
hit the following message from our internal CLC glue code :
"SPIRV-Tools doesn't contain https://github.com/KhronosGroup/SPIRV-Tools/pull/5534 "
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: db11165c07 ("intel/cl: switch to SPIRV as shader storage")
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33234 >
2025-01-27 13:16:27 +00:00
Rhys Perry
cdae225243
nir/divergence: assume all instructions are loop invariant if no continues
...
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/32998 >
2025-01-27 12:40:14 +00:00
Alyssa Rosenzweig
f0e3fe195f
nir/lower_robust_access: do not preserve control flow
...
we insert if's, which dirties control flow metadata. caught by the new metadata
validation blowing up.
Cc: mesa-stable
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33216 >
2025-01-26 13:54:08 -05:00
Mel Henning
4ab5f0240a
nir: Update num_blocks in sort_unstructured_blocks
...
Cc: mesa-stable
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33219 >
2025-01-26 12:52:59 -05:00
Mel Henning
78911ae635
nir_validate: Handle unstructured control flow
...
in validate_ssa_dominance. NAK was hitting an assertion in the
structured iterator because it lowers to unstructured control flow.
Fixes: 0eb5f66660 ("nir/validate: validate ssa dominance by default")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12524
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33219 >
2025-01-26 12:52:47 -05:00
Marek Olšák
61e289d0ca
nir/opt_varyings: handle user barycentrics
...
This failed an assertion because the barycentric src wasn't an intrinsic.
v2: also do it in backward_inter_shader_code_motion
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33024 >
2025-01-25 12:20:26 -05:00
Marek Olšák
234b416ffb
ac/nir: lower fbfetch_output in ac_nir_lower_ps_early
...
so that we can gather shader_info after this and all system values that
this adds will be gathered.
shader_info won't be gathered after si_nir_lower_abi, which is why we
have to lower fbfetch_output here.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33024 >
2025-01-25 12:20:25 -05:00
Lionel Landwerlin
5adac011b8
meson: rework mesa-clc=system handling
...
In theory you can build a driver using OpenCL kernels with a
-Dmesa-clc=system. That shouldn't require any LLVM/Clang/etc...
But the checks to find the pre-compiled mesa_clc & vtn_bindgen
binaries are in meson files or conditions only triggered if you build
with LLVM (:
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Dylan Baker <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33014 >
2025-01-25 03:28:07 +00:00
Lionel Landwerlin
857236a81d
spirv: build vtn_bindgen for Anv/Iris
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Dylan Baker <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33014 >
2025-01-25 03:28:07 +00:00
Lionel Landwerlin
b0a882b3dc
libcl_vk: add some vulkan enums/structures for DGC
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Dylan Baker <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33014 >
2025-01-25 03:28:07 +00:00
Lionel Landwerlin
d3d771607d
libcl: add MIN2/MAX2 macros
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Dylan Baker <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33014 >
2025-01-25 03:28:07 +00:00
Lionel Landwerlin
1067d95987
compiler: add VARYING_BIT_PRIMITIVE_COUNT
...
Cc stable for the next patches that are fixing something.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33038 >
2025-01-24 10:19:28 +00:00
Timothy Arceri
09f73024a5
glsl: fix num_views linker error
...
The declaration must be the same across shaders but not all shaders
must make the declaration.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33149 >
2025-01-24 01:47:55 +00:00
Timothy Arceri
914697c4ac
glsl: fix num_views validation message
...
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33149 >
2025-01-24 01:47:55 +00:00
Rhys Perry
0eb5f66660
nir/validate: validate ssa dominance by default
...
This no longer modifies dominance metadata, so enable it by default.
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/32005 >
2025-01-23 23:35:44 +00:00
Rhys Perry
b145045112
nir/validate: preserve dominance during SSA validation
...
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/32005 >
2025-01-23 23:35:44 +00:00
Rhys Perry
b1945fd21a
nir/validate: validate metadata
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9572
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32005 >
2025-01-23 23:35:44 +00:00
Rhys Perry
2d94ca93b5
nir/liveness: stop requiring instr indices
...
nir_live_defs_impl() doesn't actually use them, and every
nir_metadata_require of nir_metadata_live_defs already requires them.
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/32005 >
2025-01-23 23:35:44 +00:00