Commit graph

211737 commits

Author SHA1 Message Date
Rhys Perry
20cd5cf5f7 aco: delay barrier waitcnt until they are needed
fossil-db (navi21):
Totals from 44 (0.06% of 79825) affected shaders:
Instrs: 16001 -> 15932 (-0.43%); split: -0.46%, +0.02%
CodeSize: 85800 -> 85548 (-0.29%); split: -0.30%, +0.01%
Latency: 190124 -> 173458 (-8.77%)
InvThroughput: 23605 -> 22756 (-3.60%)

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/36491>
2025-09-09 12:34:40 +00:00
Rhys Perry
843acfa50b aco: add a separate barrier_info for release/acquire barriers
These can wait for different sets of accesses.

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/36491>
2025-09-09 12:34:40 +00:00
Rhys Perry
6c446c2f83 aco: refactor waitcnt pass to use barrier_info
Currently there's just barrier_info_all, but more will be added later.

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/36491>
2025-09-09 12:34:40 +00:00
Rhys Perry
21332609b9 aco: don't move acquire barriers before interlock begin
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/36491>
2025-09-09 12:34:40 +00:00
Rhys Perry
0ee1c137f9 aco: don't move release barriers after interlock end
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/36491>
2025-09-09 12:34:40 +00:00
Rhys Perry
7c056dd473 aco: add is_atomic_or_control_instr helper
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/36491>
2025-09-09 12:34:40 +00:00
Rhys Perry
df6a3b7619 aco: reduce cost of using values defined in predecessors
For code like:
   if (cond) {
      val = load()
   }
   use(val)
The "use(val)" now has a similar cost to a use inside the IF.

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/36491>
2025-09-09 12:34:40 +00:00
Gert Wollny
b7ac5d8453 r600/sfn: Optimize pred(not X != 0) to pred(X == 0)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:54 +00:00
Gert Wollny
125ce0f909 r600/sfh: Handle 64 bit comparisons in predicate optimization
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:54 +00:00
Gert Wollny
abe9b61212 r600/sfn: relax restrictions when optimizing predicate evaluation with a register
If the comparison comes right before the predicate evaluation it still
can be contracted.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:53 +00:00
Gert Wollny
bbbb2be123 r600/sfn: emit 64 bit predicates like normal ALU ops
Also clean up the scheduler changes we did to deal with one-slot and
two slot predicate ops at the same time.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:53 +00:00
Gert Wollny
51d8ca2dff r600/sfn: optimize comparison results
* optimize not(compare(a,b)), nir_opt_algebraic does this only if the
  comparison result is used only once, but on a vector arch we still get
  an advantage when doing this, because it reduces dependencies.
* optimize b2f32(compare(a,b)), this is r600 specific

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:53 +00:00
Gert Wollny
82dffae611 r600/sfn: don't use dummy regs in alu ops when no dest register is needed
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:53 +00:00
Gert Wollny
4f1f5aa02d r600/sfn: Add handling of channels for dest-less ALU ops
This will be used to get rid of some dummy register handling.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:52 +00:00
Gert Wollny
90b2fbbab4 r600/sfn: Pass chan and dest_clamp to alu op if no dest register is given
v2: move common code

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:52 +00:00
Gert Wollny
4dd3951323 r600/sfn: fix op2_pred_sete_64 opcode
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
2025-09-09 12:11:52 +00:00
Georg Lehmann
08b58c3fac nir/lower_subgroups: remove lower_fp64 option
This was incorrect (it also lowered int64 reductions/scans), and the only
user can just use the general callback to precisely only lower what it wants.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37164>
2025-09-09 11:09:22 +00:00
Georg Lehmann
687510495f nir: remove subgroup size related nir_shader_compiler_options members
This was added with the goal to eventually replace the per
pass subgroup/ballot size options, but that won't work because
some backends don't have a fixed subgroup size across the compilation
process.

It was also mostly added to hack around mesa state tracker behavior,
and we have a better solution there now.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37164>
2025-09-09 11:09:22 +00:00
Georg Lehmann
c7d5108373 mesa/st: make double subgroup lowering more precise
Really don't touch anything else.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37164>
2025-09-09 11:09:21 +00:00
Georg Lehmann
9bc14a0047 nir/lower_subgroup: optimize reduce/scans with unknown subgroup size
We skip iterations with ifs.
These can be optimized aways after the subgroup size is known.
Every driver should do that because applications depend on it anyway.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37164>
2025-09-09 11:09:21 +00:00
Rhys Perry
c59a85d406 nir/load_store_vectorize: remove offset check in try_vectorize_shared2
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This doesn't seem useful anymore.

fossil-db (gfx1201):
Totals from 111 (0.14% of 79839) affected shaders:
Instrs: 152356 -> 151883 (-0.31%); split: -0.35%, +0.04%
CodeSize: 808484 -> 805584 (-0.36%); split: -0.39%, +0.04%
VGPRs: 7880 -> 7844 (-0.46%); split: -0.91%, +0.46%
Latency: 4121366 -> 4120648 (-0.02%); split: -0.04%, +0.02%
InvThroughput: 814622 -> 815362 (+0.09%); split: -0.02%, +0.11%
VClause: 3066 -> 3065 (-0.03%); split: -0.10%, +0.07%
SClause: 2594 -> 2593 (-0.04%)
Copies: 9412 -> 9447 (+0.37%); split: -0.47%, +0.84%
PreSGPRs: 4012 -> 4026 (+0.35%)
PreVGPRs: 4025 -> 4070 (+1.12%); split: -0.22%, +1.34%
VALU: 80457 -> 81039 (+0.72%); split: -0.08%, +0.80%
SALU: 16542 -> 16528 (-0.08%); split: -0.10%, +0.02%
VOPD: 39 -> 44 (+12.82%)

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/36370>
2025-09-09 10:11:52 +00:00
Rhys Perry
0f364aded3 nir/opt_offsets: improve shared2 optimization
Combine additions too, instead of just constant offsets.

fossil-db (gfx1201):
Totals from 97 (0.12% of 79839) affected shaders:
Instrs: 145269 -> 144886 (-0.26%); split: -0.27%, +0.01%
CodeSize: 762184 -> 759556 (-0.34%); split: -0.36%, +0.01%
VGPRs: 5812 -> 5764 (-0.83%)
Latency: 4050681 -> 4050528 (-0.00%); split: -0.01%, +0.00%
InvThroughput: 617458 -> 617181 (-0.04%); split: -0.05%, +0.00%
Copies: 8719 -> 8672 (-0.54%); split: -0.70%, +0.16%
PreVGPRs: 3558 -> 3543 (-0.42%); split: -0.59%, +0.17%
VALU: 77793 -> 77462 (-0.43%); split: -0.44%, +0.01%
SALU: 17028 -> 17009 (-0.11%)

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/36370>
2025-09-09 10:11:51 +00:00
Rhys Perry
c10e495182 nir/opt_offsets: fix progress determination with offsets that add to zero
If the offset is iadd(iadd(iadd(a, 1), b), -1), try_extract_const_addition
will create a dead iadd(a, b) and claim that it didn't modify the shader.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36370>
2025-09-09 10:11:50 +00:00
Rhys Perry
9aad852af8 nir/opt_offsets: report progress if NUW is set
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36370>
2025-09-09 10:11:50 +00:00
Tomeu Vizoso
5eab4f06d5 teflon/tests: Remove dependency on xtensor
Upstream has been moving headers around and breaking users.

Because we don't use it for much right now, drop the dependency
altogether by open coding some rand() helpers.

Issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13681
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37220>
2025-09-09 11:07:19 +02:00
Sviatoslav Peleshko
b148d47c3e anv: Always disable Color Blending for unused Render Targets
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Commit d2f7b6d5 changed the BLEND_STATE update process so that only
the used render targets will be updated. This mostly works fine, but
in cases when the Dual Source Blending was used previously, we still
must turn it off to avoid the undefined behavior that leads to hangs.

Fixes: d2f7b6d5 ("anv: implement VK_KHR_dynamic_rendering_local_read")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13675
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37246>
2025-09-09 07:38:50 +00:00
Yonggang Luo
f3c3b99e60 clang-format: Move ForEachMacros into src/.clang-format for freedreno
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37235>
2025-09-09 07:04:55 +00:00
Yonggang Luo
773a7f347a clang-format: Update the .clang-format files to conformance clang-format json-schema
The document is at
https://clang.llvm.org/docs/ClangFormatStyleOptions.html

The json-schema at
https://www.schemastore.org/clang-format.json

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37235>
2025-09-09 07:04:55 +00:00
Georg Lehmann
4143f0725a radv/nir/lower_cmat: clean up GFX11 ACC->B convert
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37213>
2025-09-09 06:08:55 +00:00
Georg Lehmann
5c0ebcdaef radv/nir/lower_cmat: clean up gfx12 transpose
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37213>
2025-09-09 06:08:55 +00:00
Georg Lehmann
2da7b4bd0a radv/nir/lower_cmat: add shuffle_xor_imm helper
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37213>
2025-09-09 06:08:54 +00:00
Christian Gmeiner
1492de1bc3 radv: re-format using clang-format
No manual changes here, this is simply running
$ ninja -C build/ clang-format

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37226>
2025-09-09 05:48:56 +00:00
Karol Herbst
dcfa4fafca rusticl: add a bunch of trivial tests
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/35188>
2025-09-09 00:49:33 +00:00
norablackcat
ccf099d0d1 rusticl: add Test targets
v2: Add more targets and a little test lib to add stubs for missing symbols
v3: Condition building tests on a recent enough meson (@leftmostcat)
v4: Set suite parameter for new tests (@leftmostcat)

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35188>
2025-09-09 00:49:33 +00:00
Dallas Strouse
6af462b27f rusticl/device: skip loading devices in cfg(test)
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35188>
2025-09-09 00:49:33 +00:00
Karol Herbst
85deec44d7 rusticl: specify allowed lints for tests in lib.rs
Sadly, meson doesn't allow us to specify custom flags for test targets yet

Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35188>
2025-09-09 00:49:33 +00:00
Karol Herbst
06776969d6 rusticl: drop global allow statements
Just to stay consistent. We might want to use them instead of declaring
them inside meson, but I'd rather prefer we have a consistent list across
all crates and that's easier done in meson.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35188>
2025-09-09 00:49:33 +00:00
norablackcat
af269d3394 rusticl: fix unit tests
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35188>
2025-09-09 00:49:32 +00:00
Karol Herbst
1b777e6cae rusticl: drop unneeded dependency to generated sources
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35188>
2025-09-09 00:49:32 +00:00
Mel Henning
eba08245a8 treewide: Spell indices correctly
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
LOLed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36184>
2025-09-08 23:03:13 +00:00
Mel Henning
17876a00af nir: Add a faster lowest common ancestor algorithm
On a fossil from the blender 4.5.0 vulkan backend, this improves compile
times in nak by about 17%. Compile time of other shaders improves by a
more modest 1.2%.

No stat changes on shader-db.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36184>
2025-09-08 23:03:13 +00:00
Mel Henning
0d07b86073 util: Add range_minimum_query
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36184>
2025-09-08 23:03:13 +00:00
Mel Henning
cd06366ca2 nir/phi_builder: Adjust valid_metadata assert
so we can add more metadata to nir_metadata_control_flow.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36184>
2025-09-08 23:03:13 +00:00
Mel Henning
ee8d448241 nir: Don't require nir_metadata_control_flow
We're about to add to nir_metadata_control_flow, and we don't want
passes to require the new metadata.

Via coccinelle:

@@
expression e1;
@@
- nir_metadata_require(e1, nir_metadata_control_flow)
+ nir_metadata_require(e1, nir_metadata_block_index | nir_metadata_dominance)

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36184>
2025-09-08 23:03:13 +00:00
Alyssa Rosenzweig
162f07f80c hk: assume largePoints always set
doesn't matter. this came from a Mesa audit around Vulkan features.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37240>
2025-09-08 21:56:30 +00:00
Faith Ekstrand
6eac1cefd9 vulkan/wsi/x11: Use mesa_logX() instead of fprintf()
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We have a logging framework.  We should use it.  This way we can shut
these warnings off in CI if we want to.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37203>
2025-09-08 21:28:10 +00:00
Faith Ekstrand
14c2afcb06 util/log: Add a MESA_LOG_LEVEL environment variable
This lets us control how much logging we want Mesa to do, which is
useful in CI where we don't want to collect lots of log spam that then
has to be saved somewhere.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37203>
2025-09-08 21:28:10 +00:00
Christian Gmeiner
72ba6bbbe3 r300: re-format using clang-format
No manual changes here, this is simply running
$ ninja -C build/ clang-format

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37224>
2025-09-08 21:14:53 +00:00
Faith Ekstrand
92e329ba5a mesa: Use mesa_log_if_debug() for no context errors
This is the same function _mesa_error() invokes in the case where we do
have a context.  This will cause these errors to only print by default
in debug mode and to not print at all if MESA_DEBUG=silent is set.  With
the current checks, which only check for the presence of environment
variables, MESA_DEBUG=silent or LIBGL_DEBUG=quiet will both turn on this
warning, which isn't what anybody wants.

Also, delete the spurrious "gl" that's getting prepended to the name.
The names already start with "gl" so we're logging things about
glglDeleteShader right now, which is silly.

Reviewed-by: Valentine Burley <valentine.burley@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37202>
2025-09-08 20:31:26 +00:00
Mike Blumenkrantz
28342d1f11 zink: correctly handle batch_id==0 in check_last_finished()
in some places this assert is used to hang check, but here we
can assume that the batch_id is always valid (i.e., not a hang) and
check it accordingly to avoid spurious crashes

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37239>
2025-09-08 15:04:33 -04:00