Commit graph

11259 commits

Author SHA1 Message Date
Timur Kristóf
473ef0b6fb radv: Use nir_remove_outputs with the noop FS.
As opposed to radv_remove_varyings, this one works fine with
mesh shaders as well.

This commit helps depth-only rendering with mesh shaders.

No Fossil DB changes.
(Possibly there are no applicable fossils in our DB.)

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33928>
2026-01-01 21:26:04 -06:00
Timur Kristóf
24e0e8980f radv: Don't call nir_link_opt_varyings anymore
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The old nir_link_opt_varyings pass is superseded by the
new nir_opt_varyings pass.

Fossil DB stats on Strix Halo (GFX11.5):

Totals from 1291 (1.62% of 79825) affected shaders:
MaxWaves: 37070 -> 37078 (+0.02%)
Instrs: 985094 -> 985326 (+0.02%); split: -0.07%, +0.09%
CodeSize: 5144668 -> 5145384 (+0.01%); split: -0.06%, +0.07%
VGPRs: 68040 -> 68160 (+0.18%); split: -0.12%, +0.30%
Latency: 7923260 -> 7921208 (-0.03%); split: -0.04%, +0.02%
InvThroughput: 1291120 -> 1291008 (-0.01%); split: -0.05%, +0.05%
VClause: 16590 -> 16580 (-0.06%)
SClause: 27360 -> 27376 (+0.06%); split: -0.08%, +0.14%
Copies: 68767 -> 69041 (+0.40%); split: -0.51%, +0.91%
Branches: 19431 -> 19449 (+0.09%)
PreSGPRs: 55679 -> 55704 (+0.04%); split: -0.01%, +0.05%
PreVGPRs: 47787 -> 47926 (+0.29%); split: -0.00%, +0.30%
VALU: 572252 -> 572489 (+0.04%); split: -0.10%, +0.14%
SALU: 139916 -> 139845 (-0.05%); split: -0.10%, +0.05%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
2026-01-01 18:10:05 -06:00
Timur Kristóf
7ee52b7066 radv: Don't call nir_remove_unused_varyings anymore
The nir_remove_unused_varyings pass is not necessary anymore,
because nir_opt_varyings already does the same.

Fossil DB stats on Strix Halo (GFX11.5):

Totals from 3085 (3.86% of 79825) affected shaders:
MaxWaves: 91286 -> 91290 (+0.00%)
Instrs: 1337749 -> 1335687 (-0.15%); split: -0.39%, +0.24%
CodeSize: 6625244 -> 6618148 (-0.11%); split: -0.38%, +0.27%
VGPRs: 140424 -> 140352 (-0.05%); split: -0.07%, +0.02%
Latency: 5028592 -> 5021465 (-0.14%); split: -0.26%, +0.12%
InvThroughput: 669773 -> 671718 (+0.29%); split: -0.24%, +0.53%
VClause: 24431 -> 24407 (-0.10%); split: -0.17%, +0.07%
SClause: 30114 -> 29435 (-2.25%); split: -2.28%, +0.03%
Copies: 99243 -> 101319 (+2.09%); split: -1.32%, +3.41%
Branches: 27445 -> 27599 (+0.56%)
PreSGPRs: 119444 -> 119472 (+0.02%); split: -0.67%, +0.69%
PreVGPRs: 96667 -> 96688 (+0.02%); split: -0.00%, +0.02%
VALU: 741846 -> 744017 (+0.29%); split: -0.14%, +0.44%
SALU: 197068 -> 195256 (-0.92%); split: -0.96%, +0.05%
VMEM: 54067 -> 54053 (-0.03%); split: -0.03%, +0.00%
SMEM: 56565 -> 55131 (-2.54%); split: -2.59%, +0.05%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
2026-01-01 18:03:22 -06:00
Timur Kristóf
43496a6bf9 radv: Don't call nir_compact_varyings anymore
nir_compact_varyings is not necessary anymore, because everything
that it does, is also done by nir_opt_varyings.

The resulting shader stats are slightly negative because
without nir_compact_varyings, the I/O variables in TCS
are sorted less "fortunately".

After discussing this with the RADV team, we decided that
this is an acceptable loss.

Fossil DB stats on Strix Halo (GFX11.5):

Totals from 4577 (5.73% of 79825) affected shaders:
MaxWaves: 130456 -> 130532 (+0.06%); split: +0.06%, -0.00%
Instrs: 3012724 -> 3014809 (+0.07%); split: -0.06%, +0.13%
CodeSize: 15476368 -> 15484724 (+0.05%); split: -0.05%, +0.10%
VGPRs: 227976 -> 227832 (-0.06%); split: -0.14%, +0.07%
Latency: 13230769 -> 13237431 (+0.05%); split: -0.03%, +0.08%
InvThroughput: 1862029 -> 1864167 (+0.11%); split: -0.07%, +0.19%
VClause: 43128 -> 43123 (-0.01%); split: -0.08%, +0.07%
SClause: 61636 -> 61647 (+0.02%); split: -0.01%, +0.02%
Copies: 178023 -> 180309 (+1.28%); split: -0.80%, +2.09%
PreSGPRs: 195628 -> 195683 (+0.03%)
PreVGPRs: 161817 -> 161749 (-0.04%)
VALU: 1828727 -> 1831037 (+0.13%); split: -0.08%, +0.20%
SALU: 336688 -> 336668 (-0.01%); split: -0.01%, +0.00%
VMEM: 99441 -> 99545 (+0.10%); split: -0.00%, +0.11%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
2026-01-01 18:01:34 -06:00
Timur Kristóf
e2fabb4e4a radv: Don't call nir_opt_combine_stores anymore
Also no need for nir_lower_tess_level_array_vars_to_vec.
These should be now handled by nir_opt_vectorize_io.

Fossil DB stats on Strix Halo (GFX11.5):

Totals from 373 (0.47% of 79825) affected shaders:
Instrs: 381930 -> 380786 (-0.30%); split: -0.30%, +0.00%
CodeSize: 1888160 -> 1883644 (-0.24%); split: -0.24%, +0.01%
Latency: 1008755 -> 1008053 (-0.07%); split: -0.08%, +0.01%
InvThroughput: 156523 -> 155275 (-0.80%); split: -0.81%, +0.01%
Copies: 22357 -> 20812 (-6.91%); split: -6.93%, +0.02%
VALU: 240904 -> 239359 (-0.64%); split: -0.64%, +0.00%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
2026-01-01 17:59:48 -06:00
Timur Kristóf
1106b0a1e2 radv: Only run some optimizations when scalarization made progress
These passes are called to clean up after scalarization, so
only call them when scalarization actually made progress.

No Fossil DB changes on Strix Halo (GFX11.5)

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
2026-01-01 17:54:55 -06:00
Timur Kristóf
58020fdc01 radv: Scalarize and re-vectorize unlinked shader I/O
Reasons to do this:
- Optimize VS inputs (always unlinked)
- Allow some optimization on unlinked shaders for GPL/ESO
- Prepare for retiring the old linking passes

Fossil DB stats on Strix Halo (GFX11.5):

Totals from 1814 (2.27% of 79825) affected shaders:
MaxWaves: 51232 -> 51434 (+0.39%)
Instrs: 1213430 -> 1212744 (-0.06%); split: -0.20%, +0.14%
CodeSize: 6124996 -> 6122472 (-0.04%); split: -0.17%, +0.13%
VGPRs: 93336 -> 92988 (-0.37%); split: -0.45%, +0.08%
Latency: 5360820 -> 5357501 (-0.06%); split: -0.29%, +0.23%
InvThroughput: 763087 -> 762937 (-0.02%); split: -0.11%, +0.09%
VClause: 22037 -> 22059 (+0.10%); split: -0.19%, +0.29%
SClause: 30971 -> 30884 (-0.28%); split: -0.46%, +0.17%
Copies: 73139 -> 73294 (+0.21%); split: -0.82%, +1.03%
Branches: 20370 -> 20346 (-0.12%)
PreSGPRs: 77373 -> 77404 (+0.04%)
PreVGPRs: 68218 -> 67093 (-1.65%); split: -1.78%, +0.13%
VALU: 662849 -> 663059 (+0.03%); split: -0.09%, +0.12%
SALU: 206745 -> 206781 (+0.02%); split: -0.06%, +0.08%
VMEM: 34230 -> 34250 (+0.06%)

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
2026-01-01 17:54:31 -06:00
Timur Kristóf
8e6bff4caa radv: Lower 64-bit VS inputs to 32-bit
In RADV, we already lower all 64-bit I/O to 32-bit,
except VS inputs. Most of the newer NIR passes that
deal with I/O do not support 64-bit I/O, so now it's
time for us to also lower 64-bit VS inputs to 32-bit.

No Fossil DB changes on Strix Halo (GFX11.5).

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33979>
2026-01-01 17:44:40 -06:00
Samuel Pitoiset
b3c983b8dd amd,radv,radeonsi: add a new function to update windowed perf counters
Some checks failed
macOS-CI / macOS-CI (dri) (push) Has been cancelled
macOS-CI / macOS-CI (xlib) (push) Has been cancelled
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39065>
2025-12-24 07:20:01 +00:00
Samuel Pitoiset
47366527ce radv: fix capturing performance counters with SPM
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14333
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39065>
2025-12-24 07:20:01 +00:00
Samuel Pitoiset
e03461f3bd radv: change the default value of RADV_TRACE_CACHE_COUNTERS on < GFX10
To not print a warning about missing SPM by default on < GFX10.
Also move the function to radv_physical_device.c and make it non-static.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39065>
2025-12-24 07:20:01 +00:00
Timur Kristóf
450a6189de radv: Initialize transfer queue gang when needed
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Initialize gang CS on unsupported transfer operations.

Add a wait when:
- SDMA needs to wait for previous transfer operations on ACE
- ACE needs to wait for previous transfer operations on SDMA

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:59 +00:00
Timur Kristóf
cc5190829f radv: Declare some gang submit functions in radv private header.
They will be called from the transfer copy functions.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:59 +00:00
Timur Kristóf
b1938901d0 radv: Use SDMA fence packet when flushing gang semaphores
Add back the SDMA fence packet to radv_flush_gang_semaphore.
This was regressed by 9666bd1245.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:59 +00:00
Timur Kristóf
d71a05dffa radv: Implement gang semaphores for transfer queues.
We need to use gang semaphores in the following two scenarios:

1. Leader to follower semaphore:
Increment the leader to follower semaphore when the leader wants
to block the follower: a transfer operation on ACE needs to wait
for a previous operation on SDMA.

2. Follower to leader semaphore:
Increment the follower to leader semaphore when the follower wants
to block the leader: a transfer operation on SDMA needs to wait
for a previous operation on ACE.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:58 +00:00
Timur Kristóf
4d0975dc83 radv: Update comments for gang semaphores
Change the explanation to use "leader" and "follower" terminology.
Explain better how it is used with GFX/ACE and SDMA/ACE.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:58 +00:00
Timur Kristóf
65bf4e7dcd radv: Require gang submit and compute for transfer queues
RADV's transfer queue implementation will use compute for
the transfer operations that aren't supported by the SDMA,
so we'll need gang submissions for that.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:58 +00:00
Timur Kristóf
f481a5f887 radv: Add function to determine if SDMA supports an image.
The following are not supported by SDMA:
- Sparse images (aka. PRT) on older GPUs
- Multisampled images

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:58 +00:00
Timur Kristóf
f55771a17d radv: Bypass L2 for gang semaphore BO with SDMA/ACE
When the "gang leader" is SDMA, we need to ensure that the
gang semaphores BO is coherent between SDMA and CP.
To achieve this, we need bypass the L2 cache when either SDMA
or CP are connected to L2.

Suggested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
2025-12-23 12:14:58 +00:00
Timur Kristóf
fc57fa4589 radv, radeonsi: Don't pass task ring info to mesh/task payload lowering
The pass now uses the ring descriptors to figure these out.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39032>
2025-12-22 15:17:59 +00:00
Samuel Pitoiset
044e7f6017 radv/nir: fix front_face opts for points/lines and unknown prim
Fixes new VKCTS coverage dEQP-VK.glsl.builtin_var.frontfacing.*.

Fixes: af375c6756 ("radv: Optimize fs builtins using static gfx state")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39041>
2025-12-22 07:59:30 +00:00
Daniel Schürmann
1e8d367537 amd: add and use ac_cu_info::has_vtx_format_alpha_adjust_bug
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38701>
2025-12-22 07:34:48 +00:00
Daniel Schürmann
f7c4aa48a0 ac/gpu_info: add some more flags to ac_cu_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38701>
2025-12-22 07:34:46 +00:00
Daniel Schürmann
f791e46c47 aco: add ac_cu_info to aco_compiler_options
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38701>
2025-12-22 07:34:46 +00:00
Daniel Schürmann
553b431aca ac/gpu_info: move some CU information into separate struct ac_cu_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38701>
2025-12-22 07:34:44 +00:00
Samuel Pitoiset
045b778ed6 radv: add the SQTT relocated shaders BO to the cmdbuf list
Found this while debugging another thing with amdgpu.debug_mask=0x1 (VM).

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39002>
2025-12-22 07:13:06 +00:00
Benjamin Cheng
fa8b0b6bbb radv/video: Enable write combine for decode
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39025>
2025-12-18 15:25:57 -05:00
Marek Olšák
3c5c96fedb radv: double pixel throughput in certain cases of PS without interpolated inputs
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This reduces the number of initialized VGPRs by 1 when no barycentric
coordinates are used.

I have verified with zink that this indeed increases performance for
cases where sysvals like frag_coord and front_face are used without
interpolated PS inputs.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38936>
2025-12-18 03:37:58 +00:00
Samuel Pitoiset
f8feed17e1 ac,radv,radeonsi: add tracked register macros to common code
Because the tracked registers are really driver dependant, the driver
is expected to handle the tracked_registers struct itself.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38740>
2025-12-17 15:09:26 +00:00
Samuel Pitoiset
c580fc667f ac,radv: add ac_cmdbuf::context_roll and use it
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38740>
2025-12-17 15:09:26 +00:00
Samuel Pitoiset
f3b385859a ac,radv: add more cmdbuf emit helpers
Some can't be shared with RadeonSI because it uses templates in some
places.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38740>
2025-12-17 15:09:25 +00:00
Samuel Pitoiset
b444dc145a radv: remove redundant assertions in radeon_emit_{array}()
The common helpers already have assertions.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38740>
2025-12-17 15:09:25 +00:00
Samuel Pitoiset
262fc80e45 ac,radv,radeonsi: add functions to initialize tracked regs
Also initialize the new slots for RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38740>
2025-12-17 15:09:25 +00:00
Samuel Pitoiset
44314e1ea6 ac,radv,radeonsi: add ac_tracked_regs
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38740>
2025-12-17 15:09:24 +00:00
Samuel Pitoiset
c97bd17d4d radv: switch to AC_TRACKED_xxx
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38740>
2025-12-17 15:09:23 +00:00
Samuel Pitoiset
5d76202b6d radv: create descriptors for color/depth-stencil surfaces earlier
For less CPU overhead when rendering begins and also because it's
easy to pre-compute those descriptors.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38714>
2025-12-17 11:11:18 +00:00
Samuel Pitoiset
c8729cdd3c radv/meta: stop passing a stencil attachment for depth decompress
It should only be the depth aspect.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38714>
2025-12-17 11:11:18 +00:00
Samuel Pitoiset
43d7d97b13 radv/meta: inject image view usage info
This will be used to initialize color/depth-stencil descriptors earlier
when the image view is created.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38714>
2025-12-17 11:11:18 +00:00
Samuel Pitoiset
ce69cabb60 radv: constify radv_{cb,ds}_buffer_info parameters
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38714>
2025-12-17 11:11:18 +00:00
Daniel Schürmann
125ac1626d radv: remove precomputed registers from radv_shader_binary
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
It is enough to compute them after upload.
This saves some disk space and eliminates an unlikely
bug where the shader cache is shared between two GPUs
with the same chip but a different number of enabled CUs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38970>
2025-12-17 08:16:06 +00:00
Samuel Pitoiset
6193483c4f radv: rename RADEON_FLAG_VA_UNCACHED to RADEON_FLAG_GL2_BYPASS
Easier to understand.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38907>
2025-12-16 07:17:08 +00:00
Samuel Pitoiset
0beb83b0eb radv: add RADV_DEBUG=vm option
Useful for debugging page faults because this adds a gap between every
VA allocation.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38907>
2025-12-16 07:17:08 +00:00
Mauro Rossi
e8134e6eaf radv/rt: Fix gnu-empty-initializer error
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Fixes the following building error happening with clang:

FAILED: src/amd/vulkan/libvulkan_radeon.so.p/nir_radv_nir_rt_traversal_shader.c.o
...
../src/amd/vulkan/nir/radv_nir_rt_traversal_shader.c:1159:49: error: use of GNU empty initializer extension [-Werror,-Wgnu-empty-initializer]
   struct radv_nir_rt_traversal_params params = {};
                                                ^
1 error generated.

Fixes: f692ac76 ("radv/rt: Use traversal vars for object origin/direction in ahit/isec")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38954>
2025-12-15 22:27:29 +01:00
Timur Kristóf
0324700c03 radv: Use zero-filled BO for GFX6 and GFX10 null index buffer bug
GFX10 hangs when drawing from a 0-sized index buffer.
GFX6 has a HW bug when the index buffer	address is 0.

Looking at VK CTS runs, GFX6 still triggers VM faults despite the
current mitigation, and it also tries to access memory when the
index buffer is zero sized. So it looks like GFX6 and GFX10
really have the same bug.

Let's share the mitigation between the two.
Use a zero-filled BO instead of the upload buffer.
This fixes VM faults on GFX6, and should speed up GFX10 a bit.

Note that the zero-filled BO is also going to be used for
other bug mitigations on GFX6-7.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38958>
2025-12-15 21:03:19 +00:00
Benjamin Cheng
59f821218c radv/video: Move probability table filling to bind
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We should not manipulate the session buffers at command recording time.
It shouldn't cause any problems as these initialized probability tables
are not modified by firmware, but moving these to bind time should be
safer and also faster if an application frequently RESETs.

Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38926>
2025-12-15 18:49:28 +00:00
Georg Lehmann
ec81337d8d radv: use nir_opt_uniform_subgroup
Foz-DB Navi21:
Totals from 665 (0.68% of 97581) affected shaders:
MaxWaves: 12856 -> 12822 (-0.26%)
Instrs: 2073376 -> 2068645 (-0.23%); split: -0.23%, +0.00%
CodeSize: 11116904 -> 11098376 (-0.17%); split: -0.18%, +0.01%
VGPRs: 39584 -> 39568 (-0.04%); split: -0.20%, +0.16%
SpillSGPRs: 160 -> 155 (-3.12%)
SpillVGPRs: 2995 -> 2968 (-0.90%)
Latency: 15432093 -> 15503462 (+0.46%); split: -0.13%, +0.59%
InvThroughput: 3344411 -> 3351185 (+0.20%); split: -0.08%, +0.28%
VClause: 50278 -> 50225 (-0.11%); split: -0.15%, +0.04%
SClause: 57537 -> 57505 (-0.06%); split: -0.18%, +0.13%
Copies: 189642 -> 188175 (-0.77%); split: -0.86%, +0.08%
Branches: 68800 -> 68502 (-0.43%); split: -0.45%, +0.02%
PreSGPRs: 37646 -> 37068 (-1.54%)
PreVGPRs: 35891 -> 35943 (+0.14%)
VALU: 1386943 -> 1385881 (-0.08%); split: -0.09%, +0.01%
SALU: 287322 -> 284165 (-1.10%); split: -1.11%, +0.01%
VMEM: 90874 -> 90820 (-0.06%)

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38902>
2025-12-15 12:22:32 +00:00
Georg Lehmann
fee87679bf radv/nir: fix front_face_fsign opt
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
If front facing primitives are culled, there are only back facing fragments left.

Fixes: 0fe8250bf4 ("radv: optimize known front_face_fsign too")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38937>
2025-12-13 10:22:21 +01:00
Georg Lehmann
17e597093d radv: eliminate unused FS output channels
For formats that don't have all color channels, there is no reason to
output all of them.
Games often write to R only or RGB formats with non trivial remaining channels.

Foz-DB Navi21:
Totals from 10270 (10.55% of 97347) affected shaders:
MaxWaves: 249166 -> 250950 (+0.72%); split: +0.73%, -0.01%
Instrs: 8442016 -> 8354715 (-1.03%); split: -1.05%, +0.01%
CodeSize: 45939644 -> 45487156 (-0.98%); split: -1.01%, +0.02%
VGPRs: 472584 -> 463784 (-1.86%); split: -1.98%, +0.12%
SpillSGPRs: 1502 -> 1448 (-3.60%)
LDS: 6024192 -> 6011904 (-0.20%)
Inputs: 42463 -> 41773 (-1.62%)
Outputs: 24601 -> 23955 (-2.63%)
Latency: 78011745 -> 77653907 (-0.46%); split: -0.56%, +0.10%
InvThroughput: 19767826 -> 19274046 (-2.50%); split: -2.53%, +0.03%
VClause: 177891 -> 176681 (-0.68%); split: -0.80%, +0.12%
SClause: 236784 -> 235324 (-0.62%); split: -0.72%, +0.10%
Copies: 621048 -> 616096 (-0.80%); split: -1.03%, +0.23%
Branches: 202608 -> 201811 (-0.39%); split: -0.44%, +0.05%
PreSGPRs: 441032 -> 437698 (-0.76%); split: -0.77%, +0.01%
PreVGPRs: 378067 -> 369564 (-2.25%); split: -2.26%, +0.01%
VALU: 5906415 -> 5833179 (-1.24%); split: -1.25%, +0.01%
SALU: 973428 -> 968088 (-0.55%); split: -0.61%, +0.06%
VMEM: 298277 -> 296504 (-0.59%); split: -0.61%, +0.01%
SMEM: 402244 -> 399612 (-0.65%); split: -0.71%, +0.06%

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38853>
2025-12-12 17:00:51 +00:00
Georg Lehmann
5d2f3065fd radv: gather color0_written with scalar io correctly
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38853>
2025-12-12 17:00:51 +00:00
Georg Lehmann
18013e3281 radv: consider dual src blend for when epilog needs alpha
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38853>
2025-12-12 17:00:51 +00:00