Commit Graph

8778 Commits

Author SHA1 Message Date
Daniel Schürmann a5a40beefa aco: don't emit WQM for bool_to_scalar_condition
This was only necessary to ensure that the source is computed in WQM
if the current exec mask is in WQM.

Totals from 23170 (17.17% of 134913) affected shaders: (GFX10.3)
VGPRs: 1384464 -> 1383400 (-0.08%); split: -0.08%, +0.01%
SpillSGPRs: 7575 -> 7574 (-0.01%)
CodeSize: 146444752 -> 146317104 (-0.09%); split: -0.13%, +0.04%
MaxWaves: 429870 -> 429868 (-0.00%)
Instrs: 27202586 -> 27170316 (-0.12%); split: -0.17%, +0.05%
Latency: 379488313 -> 379335412 (-0.04%); split: -0.07%, +0.03%
InvThroughput: 69500561 -> 69487704 (-0.02%); split: -0.03%, +0.01%
VClause: 473080 -> 473038 (-0.01%); split: -0.02%, +0.01%
SClause: 1080576 -> 1080571 (-0.00%); split: -0.06%, +0.06%
Copies: 1492865 -> 1504604 (+0.79%); split: -0.40%, +1.19%
Branches: 711295 -> 716849 (+0.78%); split: -0.01%, +0.79%
PreSGPRs: 1331362 -> 1328402 (-0.22%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14951>
2022-02-11 19:05:30 +00:00
Daniel Schürmann f816dd1be7 aco: don't propagate WQM for p_as_uniform
This was needed, so that in case of active helper lanes,
these contain the correct value. It is now handled implicitly.

Totals from 1004 (0.74% of 134913) affected shaders: (GFX10.3)
CodeSize: 7581020 -> 7580892 (-0.00%); split: -0.00%, +0.00%
Instrs: 1454940 -> 1454908 (-0.00%); split: -0.00%, +0.00%
Latency: 12984953 -> 12984894 (-0.00%); split: -0.00%, +0.00%
InvThroughput: 3173037 -> 3173049 (+0.00%); split: -0.00%, +0.00%
PreSGPRs: 47498 -> 47273 (-0.47%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14951>
2022-02-11 19:05:30 +00:00
Daniel Schürmann 825cd696dc aco/insert_exec_mask: stay in WQM while helper lanes are still needed
This patch flags all instructions WQM which don't require
Exact mode, but depend on the exec mask as long as WQM
is needed on any control flow path afterwards.
This will mostly prevent accidental copies of WQM values
within Exact mode, and also makes a lot of other workarounds
unnecessary.

Totals from 17374 (12.88% of 134913) affected shaders: (GFX10.3)
VGPRs: 526952 -> 527384 (+0.08%); split: -0.01%, +0.09%
CodeSize: 33740512 -> 33766636 (+0.08%); split: -0.06%, +0.14%
MaxWaves: 488166 -> 488108 (-0.01%); split: +0.00%, -0.02%
Instrs: 6254240 -> 6260557 (+0.10%); split: -0.08%, +0.18%
Latency: 66497580 -> 66463472 (-0.05%); split: -0.15%, +0.10%
InvThroughput: 13265741 -> 13264036 (-0.01%); split: -0.03%, +0.01%
VClause: 122962 -> 122975 (+0.01%); split: -0.01%, +0.02%
SClause: 334805 -> 334405 (-0.12%); split: -0.51%, +0.39%
Copies: 275728 -> 282341 (+2.40%); split: -0.91%, +3.31%
Branches: 92546 -> 90990 (-1.68%); split: -1.68%, +0.00%
PreSGPRs: 504119 -> 504352 (+0.05%); split: -0.00%, +0.05%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14951>
2022-02-11 19:05:30 +00:00
Samuel Pitoiset aa3405e812 radv/winsys: fix initializing debug/perftest options if multiple instances
Since the winsys uses refcount, options like RADV_DEBUG_ZERO_VRAM might
have not been initialized if the first instance wasn't created with
application info.

This fixes missing zerovram for vkd3d-proton.

Cc: 21.3 22.0 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14978>
2022-02-11 16:12:47 +01:00
Daniel Schürmann af4b26c53a radv: move nir_opt_shrink_stores from radv_optimize_nir()
No need to call this pass in a loop.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14480>
2022-02-11 11:50:52 +01:00
Daniel Schürmann 2a92452a0e nir/opt_shrink_vectors: Remove shrinking of store intrinsics data source
This is done via nir_opt_shrink_stores.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14480>
2022-02-11 11:50:47 +01:00
Jason Ekstrand bda4c4f6b6 vulkan: Take a vk_command_pool in vk_command_buffer_init()
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14917>
2022-02-11 08:06:25 +00:00
Jason Ekstrand 29a164b088 radv: Use vk_command_pool
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14917>
2022-02-11 08:06:24 +00:00
Louis-Francis Ratté-Boulianne 5e263cc324 vulkan/runtime: Add a level field to vk_command_buffer
Looks like 3 implementations already have that field in their private
command_buffer struct, and having it at the vk_command_buffer opens the
door for generic (but suboptimal) secondary command buffer support.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14917>
2022-02-11 08:06:24 +00:00
Samuel Pitoiset 03ab9d895e radv/ci: update CI lists for CTS 1.3.1.0
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14946>
2022-02-10 14:52:42 +00:00
Daniel Schürmann fce6ca0f3a radv: remove exports without color attachment or writemask
This lets us make use of NIR's more advanced DCE.
This includes removing of CF constructs, PS inputs and VS outputs.

Totals from 1959 (1.45% of 134913) affected shaders: (GFX10.3)
VGPRs: 73464 -> 71944 (-2.07%); split: -3.79%, +1.72%
SpillSGPRs: 6 -> 0 (-inf%)
CodeSize: 4860324 -> 4675248 (-3.81%); split: -4.92%, +1.11%
LDS: 2619904 -> 2781696 (+6.18%); split: -0.37%, +6.55%
MaxWaves: 50614 -> 50852 (+0.47%); split: +1.63%, -1.16%
Instrs: 924233 -> 887836 (-3.94%); split: -5.01%, +1.07%
Latency: 5635532 -> 5418083 (-3.86%); split: -4.53%, +0.67%
InvThroughput: 1107764 -> 1077542 (-2.73%); split: -3.44%, +0.71%
VClause: 17361 -> 16163 (-6.90%); split: -8.38%, +1.47%
SClause: 31886 -> 29323 (-8.04%); split: -8.52%, +0.48%
Copies: 53529 -> 52127 (-2.62%); split: -5.30%, +2.68%
Branches: 22993 -> 22802 (-0.83%); split: -3.44%, +2.61%
PreSGPRs: 53123 -> 51395 (-3.25%); split: -3.60%, +0.35%
PreVGPRs: 59699 -> 57424 (-3.81%); split: -5.13%, +1.32%

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14771>
2022-02-10 14:23:26 +00:00
Bas Nieuwenhuizen 8d5be0a2b3 radv: Add submit locking with trace bo.
Otherwise cmdbuffers from different queues can override the trace id
from each other, making for a very confusing hang report.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14868>
2022-02-10 03:49:02 +00:00
Samuel Pitoiset 53dc5f774d radv: only emit the per-vertex VRS state if the pipeline forced it
If the primitive shading rate is not written by the last VGT stage
(like if no FS), it's useless to emit the VRS state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14907>
2022-02-09 17:40:37 +01:00
Samuel Pitoiset d0171dffe1 radv: do not force per-vertex VRS if there is no pixel shader
This has no effect.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14907>
2022-02-09 17:40:37 +01:00
Samuel Pitoiset 2451290bc4 radv: rewrite RADV_FORCE_VRS directly in NIR
This introduces a small NIR pass that exports
VARYING_SLOT_PRIMITIVE_SHADING_RATE if RADV_FORCE_VRS is used,
instead of doing this in both backend compilers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14907>
2022-02-09 17:40:34 +01:00
Samuel Pitoiset 6fba52cfd2 radv: allow RADV_FORCE_VRS with pipeline VRS declared as dynamic
This is for vkd3d which needs to always declare the VRS dynamic state
because it's fully dynamic in DX12. Ignoring the VRS dynamic state
when it's a no-op seems the best way to handle this, although it's
definitely not perfect.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14910>
2022-02-09 08:17:17 +00:00
Emma Anholt ef112db311 ci: Bump VK-GL-CTS to 1.3.1.0.
The main thing is VK 1.3 testing, but also includes test bugfixes.  The
1.3 CTS required an uprev of deqp-runner to handle a new style of test
output, and that deqp-runner brings in some neat new features, too (piglit
in your deqp-runner suite, and extension list checking).

A bunch of VK tests got renamed, so I replaced panvk's custom test list
with simple include filters on the main test list.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> (panvk)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14920>
2022-02-08 22:16:36 +00:00
Daniel Schürmann 5e9df85b1a aco: optimize discard_if when WQM is not needed afterwards
Totals from 11560 (8.57% of 134913) affected shaders: (GFX10.3)
CodeSize: 12092560 -> 11997652 (-0.78%)
Instrs: 2205325 -> 2181598 (-1.08%)
Latency: 15376048 -> 15356958 (-0.12%); split: -0.12%, +0.00%
InvThroughput: 3526105 -> 3525120 (-0.03%); split: -0.03%, +0.00%
Copies: 98543 -> 87601 (-11.10%)
Branches: 16919 -> 16873 (-0.27%)
PreSGPRs: 291584 -> 291532 (-0.02%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14805>
2022-02-08 16:16:07 +00:00
Daniel Schürmann 13c3137960 aco: merge block_kind_uses_[demote|discard_if]
These serve the same purpose. The new name is
block_kind_uses_discard.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14805>
2022-02-08 16:16:07 +00:00
Daniel Schürmann e7d1c8cc5e aco: make Preserve_WQM independent from block_kind_uses_discard_if
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14805>
2022-02-08 16:16:07 +00:00
Daniel Schürmann 08b8500dfb aco: remove block_kind_discard
This case doesn't seem to happen in practice.
No need to micro-optimize it.

This patch merges instruction selection for discard/discard_if.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14805>
2022-02-08 16:16:07 +00:00
Daniel Schürmann b67092e685 aco: emit nir_intrinsic_discard() as p_discard_if()
This simplifies the code and emits a slightly better
sequence in some cases.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14805>
2022-02-08 16:16:07 +00:00
Dylan Baker a52e4871fe meson: add radv to meson devenv
I either rebased this out of the original PR, just failed to commit it
and then reset it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14879>
2022-02-07 21:22:12 -08:00
Rhys Perry 7ddad1b93a radv: fix R_02881C_PA_CL_VS_OUT_CNTL with mixed cull/clip distances
Matches radeonsi.

Seems Vulkan CTS doesn't really test cull distances. Removing
VARYING_SLOT_CULL_DIST0/VARYING_SLOT_CULL_DIST1 variables doesn't break
any of dEQP-VK.clipping.*, except for tests which read the variables in
the fragment shader.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5984
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14882>
2022-02-07 12:36:38 +00:00
Samuel Pitoiset 9ea4029f9f Revert "radv: re-apply "Do not access set layout during vkCmdBindDescriptorSets.""
The most famous RADV revert over the past months. This was an issue
in RADV and not an use-after-free (descriptor set layouts can be
destroyed almost at any time).

This reverts commit b775aaff1e.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14621>
2022-02-07 08:24:36 +01:00
Samuel Pitoiset 66f7289d56 radv: add reference counting for descriptor set layouts
The spec states that descriptor set layouts can be destroyed almost
at any time:

   "VkDescriptorSetLayout objects may be accessed by commands that
    operate on descriptor sets allocated using that layout, and those
    descriptor sets must not be updated with vkUpdateDescriptorSets
    after the descriptor set layout has been destroyed. Otherwise,
    descriptor set layouts can be destroyed any time they are not in
    use by an API command."

Based on ANV.

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5893
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14621>
2022-02-07 08:24:36 +01:00
Emma Anholt a177f0de8f ci: Uprev vulkan-cts to 1.2.8.0
This brings in some interesting new vulkan tests and fixes for the
spurious KHR-GL TF failures.  Also, reduces the runtime of
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.36 so that it
should stop timing out.

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13779>
2022-02-03 22:41:23 +00:00
Rhys Perry 0447a2303f aco: don't encode src2 for v_writelane_b32_e64
Encoding src2 doesn't cause issues for print_asm() because we have a
workaround there, but it does for RGP and it seems the developers are not
interested in fixing it.

https://github.com/GPUOpen-Tools/radeon_gpu_profiler/issues/61

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14832>
2022-02-03 16:52:00 +00:00
Rhys Perry 5e3b8eeac4 aco: add test for optimizations with casts
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/14810>
2022-02-03 16:02:04 +00:00
Rhys Perry 6b1dfa7eac aco: fix neg(mul)/abs(mul) optimization with different bit-size
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/14810>
2022-02-03 16:02:04 +00:00
Rhys Perry 13bbc7c882 aco: don't combine add/mul of different bit-size
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/14810>
2022-02-03 16:02:04 +00:00
Rhys Perry 3d8a8c6fc1 aco: don't apply omod/clamp of different bit-size
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/14810>
2022-02-03 16:02:04 +00:00
Rhys Perry 7e30f99b0a aco: don't combine fneg/fabs of different bit-size
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/14810>
2022-02-03 16:02:04 +00:00
Rhys Perry 27f1f5537d aco/tests: implement sub-dword program inputs
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/14810>
2022-02-03 16:02:04 +00:00
Rhys Perry e86b88f85b aco/tests: add a bunch more building helpers
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/14810>
2022-02-03 16:02:04 +00:00
Samuel Pitoiset 52c850445e radv: stop setting streamout state when a new pipeline is bound
It's required to have a valid graphics bound pipeline with XFB when
vkCmdBeginTransformFeedbackKHR() is called. This removes extra work
when binding a pipeline.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14610>
2022-02-03 07:57:07 +00:00
Bas Nieuwenhuizen 0395c483d4 radv: Handle SDMA for padding.
Also assert that nobody actually needs to chain an SDMA IB because we have
not implemented non-PKT3 chaining.

Fixes: ef40f2ccc2 ("radv/amdgpu: Fix handling of IB alignment > 4 words.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5923
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14781>
2022-02-02 22:23:17 +00:00
Emma Anholt d4b6d03408 r300/r600: Add drm-shim support.
I was tired of swapping gpus around just to check shader-db results of MRs
for these.  I put it in src/amd since it doesn't make sense in either of
r300 or r600.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14809>
2022-02-02 00:59:08 +00:00
Samuel Pitoiset 1cadd19197 radv/winsys: fix missing buffer_make_resident() for the null winsys
With latest Fossilize everything should now be captured correctly
but without this, all Fossilize databases that need
VK_EXT_custom_border_color would just crash.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14821>
2022-02-01 18:18:28 +00:00
Connor Abbott 913bec10c4 nir/lower_subgroups: Rename lower_shuffle to lower_relative_shuffle
This option only applies to relative shuffles (up/down/xor), and in a
moment we're going to add an option to lower normal shuffles, so rename
it.

While we're here, rename lower_shuffle() to lower_to_shuffle() for
similar reasons.

Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14412>
2022-02-01 16:27:45 +00:00
Rhys Perry ba44634e4d aco: fix v_mac_legacy_f32
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: f68797ead7 ("aco: create v_mac_legacy_f32/v_fmac_legacy_f32")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5952
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14820>
2022-02-01 15:08:04 +00:00
Rhys Perry 16e0c312fa aco: preserve pass_flags during format conversions
This helps the "vopc() & exec" optimization.

fossil-db (Sienna Cichlid):
Totals from 1638 (1.21% of 134913) affected shaders:
CodeSize: 3331804 -> 3327520 (-0.13%); split: -0.19%, +0.06%
Instrs: 611807 -> 610096 (-0.28%)
Latency: 5579326 -> 5574874 (-0.08%)
InvThroughput: 936782 -> 936731 (-0.01%); split: -0.01%, +0.00%
Copies: 43324 -> 43302 (-0.05%); split: -0.06%, +0.01%

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/14773>
2022-01-31 13:45:01 +00:00
Rhys Perry 1804c21fb5 aco: optimize abs(mul(a, b))
fossil-db (Sienna Cichlid):
Totals from 18 (0.01% of 134913) affected shaders:
CodeSize: 173924 -> 173852 (-0.04%)
Instrs: 33864 -> 33846 (-0.05%)
Latency: 122233 -> 122211 (-0.02%)
InvThroughput: 22482 -> 22462 (-0.09%)

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/14773>
2022-01-31 13:45:01 +00:00
Rhys Perry 452975f257 aco: fix neg(abs(mul(a, b))) if the mul is not VOP3
Previously, is_abs was just ignored if mul_instr->isVOP3()==false.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 93c8ebfa78 ("aco: Initial commit of independent AMD compiler")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14773>
2022-01-31 13:45:01 +00:00
Tatsuyuki Ishi 89f376b506 radv/sqtt: Add and enable basic EXT_debug_utils support.
Only CommandBuffer markers for now.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14645>
2022-01-28 07:47:10 +00:00
Martin Roukala (né Peres) 978ea32acf radv/ci: mark the dEQP fails related to a missing VKCTS 1.3 as expected
Now that RADV is exposing Vulkan 1.3 by default, VKCTS is getting
confused by it and fails 2 tests:

 - dEQP-VK.api.version_check.version: This version of CTS does not
   support Vulkan device version 1.3.204 (Fail)
 - dEQP-VK.info.device_properties: deviceProperties apiVersion not
   valid (Fail)

Mark both of these failures as expected, while we wait for VKCTS 1.3
to be released.

Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14729>
2022-01-27 07:55:53 +00:00
Rhys Perry 7a0cf7f6d1 radv: fix optimized MSAA copies with suballocated images
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: deb4685df3 ("radv: implement optimized MSAA copies using FMASK")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5829
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14705>
2022-01-26 10:54:33 +00:00
Bas Nieuwenhuizen 67220077ed radv/amdgpu: Use aligned sizing for IB buffers.
Otherwise aligning might run over buffer size ...

Fixes: 1f36f6b83f ("radv/winsys: use same IBs padding as the kernel")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14644>
2022-01-25 21:02:41 +00:00
Bas Nieuwenhuizen ef40f2ccc2 radv/amdgpu: Fix handling of IB alignment > 4 words.
We reserved space for chaining by subtracting 4 words from max_dw, but
then the new alignment code in radv_amdgpu_cs_finalize ended up running
all over that. That resulted in going over buffer size when chaining.
When lucky you'd get a crash, and when unlucky other stuff might happen.

This always adds the 4 words at the end, but initializes with NOP by
default. That way we still adhere to the alignment rules.

Fixes: 1f36f6b83f ("radv/winsys: use same IBs padding as the kernel")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14644>
2022-01-25 21:02:41 +00:00
Samuel Pitoiset 047992821b radv/ci: mark dEQP-VK.api.version_check.version as expected failure on Stoney
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Samuel Pitoiset 08c6f437cf radv: advertise Vulkan 1.3
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Samuel Pitoiset 923309e201 radv: bump conformance version to 1.3.0.0 for RDNA2
We can't report conformance for an older major API version and this is
required to pass dEQP-VK.api.driver_properties.conformance_version.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Samuel Pitoiset 2a88e21570 radv: switch a bunch of struct/enum to 1.3 versions
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Samuel Pitoiset 852197537e radv: add a no-op version of vkGetPhysicalDeviceToolPropertiesEXT()
It seems the vulkan common runtime code exposes VK_EXT_tooling but
doesn't (yet) have a fallback if the backend doesn't enable this
extension. Implement it as a no-op for a temporary workaround.

This fixes crashes with dEQP-VK.api.tooling_info.*.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Samuel Pitoiset 9be4d36d5f radv: report textureCompressionASTC_HDR as not supported
To fix a mismatch with
dEQP-VK.api.info.get_physical_device_properties2.features.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Samuel Pitoiset 2d12041967 radv: implement 1.3 features/properties
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Bas Nieuwenhuizen 492dc06fbe radv: Remove VK_EXT_display_control support in favor of common impl.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14365>
2022-01-24 12:57:35 +00:00
Samuel Pitoiset a0e8b774fc radv: stop checking if pipelines are NULL during draws/dispatches
This can't happen.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14617>
2022-01-24 11:15:00 +00:00
Samuel Pitoiset 86b8fa9aee radv: do not restore NULL compute pipelines after meta operations
This should be safe as long as the driver restores descriptors and
push constants correctly for compute pipelines.

This might also reduce the number of compute pipeline changes if eg.
consecutve subpass fast clears with compute.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14616>
2022-01-24 08:47:58 +00:00
Samuel Pitoiset 8f70143c50 radv/winsys: set GTT_WC flag for CS IBs on GFX6
It was missing it seems.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14612>
2022-01-24 08:27:03 +00:00
Samuel Pitoiset 447cddd455 radv: fix copying VRS rates if the ds attachment uses mips
While the VRS image can't have mips (and no layers because still not
supported by RADV), applications might still want to bind a
depth/stencil attachment where the base level isn't 0.

Found by inspection.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14518>
2022-01-24 08:06:38 +00:00
Samuel Pitoiset 86909babc9 radv: fix copying VRS rates to HTILE if the depth/stencil is cleared
If the application binds a fragment shading rate attachment to a
subpass and also clears the depth stencil attachment, the VRS rates
would have been reinitialized to 1x1 with fast clears. It makes more
sense to clear and then copy instead of the opposite.

Found by inspection.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14518>
2022-01-24 08:06:38 +00:00
Samuel Pitoiset 7dd456b173 radv: disable attachmentFragmentShadingRate for RADV_DEBUG=nohiz
Region based VRS can only work if HTILE is enabled.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14518>
2022-01-24 08:06:38 +00:00
Samuel Pitoiset c47b8d7bf3 radv: optimize CPU overhead of si_cp_dma_prefetch() slightly
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5008
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14618>
2022-01-21 20:15:52 +00:00
Rhys Perry 3712cd2767 radv: use 8x4 workgroups for wave32 RT
Beginning of Quake II RTX, 50% resolution scale, RX 6800: 54 -> 56 FPS.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14011>
2022-01-21 16:25:16 +00:00
Rhys Perry e7002b6f96 radv: use wave32 for raytracing
Beginning of Quake II RTX, 50% resolution scale, RX 6800: 48 -> 54 FPS.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14011>
2022-01-21 16:25:16 +00:00
Rhys Perry 2298a96f9f radv: fix raytracing with wave32
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5452
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14011>
2022-01-21 16:25:16 +00:00
Rhys Perry 9e171b6d49 ac/nir: use shorter builder names
This makes a lot of lines shorter.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>
2022-01-21 13:45:33 +00:00
Rhys Perry 533118413b ac/nir: avoid providing an align_mul to intrinsic builders
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>
2022-01-21 13:45:33 +00:00
Rhys Perry c0a586bad7 ac/nir: avoid providing a write_mask to intrinsic builders
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>
2022-01-21 13:45:33 +00:00
Rhys Perry 8951608f08 radv: avoid providing an align_offset to intrinsic builders
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>
2022-01-21 13:45:33 +00:00
Rhys Perry 552e59aee3 radv: avoid providing an align_mul to intrinsic builders
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>
2022-01-21 13:45:33 +00:00
Rhys Perry 7833759a41 radv: avoid providing a write_mask to intrinsic builders
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>
2022-01-21 13:45:33 +00:00
Samuel Pitoiset b8c518f0fb radv: fix computing the number of color samples if no attachments
When no color attachments, the rasterization samples should be used.

Fixes: 0222dace90 ("radv: Support VK_KHR_dynamic_rendering for pipeline creation.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5830
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14642>
2022-01-21 09:38:37 +00:00
Rhys Perry f68797ead7 aco: create v_mac_legacy_f32/v_fmac_legacy_f32
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436>
2022-01-20 22:54:42 +00:00
Rhys Perry 43e32ad074 aco: consider legacy multiplications in optimizer
Optimize omod, -(a*b), b2f(a)*b, a*1, a*0 and create MAD/FMA.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436>
2022-01-20 22:54:42 +00:00
Rhys Perry e7f91b194a radv,aco,ac/llvm: implement fmulz and ffmaz
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436>
2022-01-20 22:54:42 +00:00
Charles Giessen 80a99ae906 radv: Update LoaderICDInterfaceVersion to v5
With the proper version checking in the common vulkan instance code
(commit 88b9b68) it is now possible to bring the reported interface
version up to v5.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14563>
2022-01-20 07:25:07 +00:00
Dave Airlie 1352e0ba0c mesa/*: add a shader primitive type to get away from GL types.
This creates an internal shader_prim enum, I've fixed up most
users to use it instead of GL types.

don't store the enum in shader_info as it changes size, and confuses
other things.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
2022-01-19 21:54:58 +00:00
Dave Airlie d54c07b4c4 mesa/*: use an internal enum for tessellation primitive types.
To avoid dragging gl.h into places it has no business being,
defined tessellation primitive mode to an enum.

This has a lot of fallout all over the place.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
2022-01-19 21:54:58 +00:00
Dave Airlie acd0afdba4 amd: move uvd decode definitions to common place
This just makes sharing these easier later.

 Acked-by: Leo Liu <leo.liu@amd.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14607>
2022-01-20 07:07:32 +10:00
Dave Airlie 14551f2bde amd: move vcn decoding regs + structs to a common file.
This just moves the main regs + fw interface structs to a new shared
file.

 Acked-by: Leo Liu <leo.liu@amd.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14607>
2022-01-20 07:07:30 +10:00
Samuel Pitoiset 96cc300746 radv: fix missing destroy for the overallocation mutex
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14611>
2022-01-19 16:47:56 +00:00
Marcin Ślusarz a4b8f69bb5 radv/ci: add line endings exception for files generated with wine
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11779>
2022-01-19 15:17:17 +00:00
Rhys Perry b59764a9fc aco: use p_extract for SGPR nir_op_unpack_half_2x16_split_y
fossil-db (Sienna Cichlid):
Totals from 7264 (5.40% of 134627) affected shaders:
VGPRs: 548152 -> 548184 (+0.01%)
SpillSGPRs: 7615 -> 7607 (-0.11%)
CodeSize: 71025152 -> 70993036 (-0.05%); split: -0.05%, +0.00%
Instrs: 13386799 -> 13298580 (-0.66%); split: -0.66%, +0.00%
Latency: 177464497 -> 177091693 (-0.21%); split: -0.21%, +0.00%
InvThroughput: 32185148 -> 32151873 (-0.10%); split: -0.10%, +0.00%
VClause: 233167 -> 233166 (-0.00%); split: -0.00%, +0.00%
SClause: 468423 -> 468426 (+0.00%); split: -0.00%, +0.01%
Copies: 950727 -> 942753 (-0.84%); split: -0.85%, +0.02%
Branches: 455919 -> 455901 (-0.00%); split: -0.01%, +0.00%

fossil-db (Vega):
Totals from 7264 (5.39% of 134762) affected shaders:
SGPRs: 738800 -> 738816 (+0.00%)
VGPRs: 550264 -> 550344 (+0.01%)
SpillSGPRs: 11149 -> 11157 (+0.07%)
CodeSize: 67487104 -> 67466772 (-0.03%); split: -0.03%, +0.00%
Instrs: 13142106 -> 13061767 (-0.61%)
Latency: 209278575 -> 208438854 (-0.40%); split: -0.40%, +0.00%
InvThroughput: 81486405 -> 81265773 (-0.27%); split: -0.27%, +0.00%
VClause: 222293 -> 222291 (-0.00%); split: -0.00%, +0.00%
SClause: 447783 -> 447800 (+0.00%); split: -0.00%, +0.01%
Copies: 1243760 -> 1238842 (-0.40%); split: -0.43%, +0.03%

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/14592>
2022-01-19 12:41:48 +00:00
Marek Olšák 3cafa3e852 ac/surface: allow displayable DCC with any resolution (e.g. 8K)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14529>
2022-01-18 01:44:17 -05:00
Samuel Pitoiset 88f1918919 radv/winsys: fix zero submit if no timeline semaphore support
Kernels that don't support timeline semaphores also don't support
transferring syncobjs. Use export/import instead.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5845
Fixes: 967fc415fc ("radv: Add new submission path for use by the common sync framework.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14538>
2022-01-17 08:38:29 +01:00
Emma Anholt f6ffefba3e nir: Apply nir_opt_offsets to nir_intrinsic_load_uniform as well.
Doing this for ir3 required adding a struct for limits of how much base to
fold in (which NTT wants as well for its case of shared vars), otherwise
the later work to lower to the 1<<9 word limit would emit more
instructions.

The shader-db results are that sometimes the reduction in NIR instruction
count results in the fewer sampler prefetches due to the shader being
estimated to be shorter (dota2, nexuiz):

total instructions in shared programs: 8996651 -> 8996776 (<.01%)
total cat5 in shared programs: 86561 -> 86577 (0.02%)

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14023>
2022-01-16 19:11:29 +00:00
Jason Ekstrand 8b3d947267 spirv,radv: Fix some GL enum comments
GL_LINE_STRIP_ADJACENCY is 0xB.  0xA is GL_LINES_ADJACENCY.  While we're
here, drop the ARB prefixes.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14157>
2022-01-14 15:08:09 +00:00
Charles Giessen 9d013f2c24 radv: Update description of vk_icdNegotiateLoaderICDInterfaceVersion
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14299>
2022-01-14 10:25:41 +01:00
Samuel Pitoiset e6173ed1d2 radv: allow to disable anisotropic filtering for single level image with drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14471>
2022-01-13 16:17:48 +00:00
Samuel Pitoiset 49c1b40290 radv: only clear VRS_HTILE_ENCODING on GFX10.3+
On older chips like GFX9, bit 19 is RB_ALIGNED.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5859
Fixes: 9c746157ae ("radv: reset VRS if the current subpass doesn't have a VRS attachment")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14530>
2022-01-13 12:57:39 +00:00
Rhys Perry cc802cab7c radv: add RADV_DEBUG=splitfma
This splits application-provided FMA in vertex/geometry/tesselation/mesh
shaders.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14458>
2022-01-12 23:50:35 +00:00
Daniel Schürmann 8a78706643 nir: refactor nir_opt_move
This patch is a rewrite of nir_opt_move.
Differently from the previous version, each instruction is checked
if it can be moved downwards and then inserted before the first user
of the definition. The advantage is that less insert operations are
performed, the original order is kept if two movable instructions have
the same first user, and instructions without user in the same block
are moved towards the end.

v2: Only return true if an instruction really changed the position.
    Don't care for discards, this will be handled by another MR.
v3: fix self-referring phis and update according to nir_can_move_instr().
v4: use nir_can_move_instr() and nir_instr_ssa_def()
v5: deduplicate some code

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3657>
2022-01-12 13:41:54 +00:00
Pierre-Eric Pelloux-Prayer 86262b6eac radeonsi,radv: fix usages of surf_pitch
For linear textures, pitch[level] should be used instead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14454>
2022-01-12 11:39:53 +00:00
Samuel Pitoiset 9cd8908c03 radv: fix computing the fb size in presence of dynamic VRS attachment
This fixes
dEQP-VK.fragment_shading_rate.dynamic_rendering.attachment_rate.*.

Fixes: e914a6710f ("radv: Expose the VK_KHR_dynamic_rendering extension.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14421>
2022-01-12 11:16:31 +00:00
Samuel Pitoiset 9c746157ae radv: reset VRS if the current subpass doesn't have a VRS attachment
With a scenario like:
BeginRP(DS + VRS att)
Draw()
EndRP()
BeginRP(same DS)
Draw()
EndRP()

The second draw shouldn't use VRS but it did because the VRS bit
is always set during DS surface initialization if a surface can use VRS.
So, it would have been using the previous copied VRS rates.

Found by inspection.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14443>
2022-01-12 10:22:29 +00:00
Samuel Pitoiset ec4dcd53db radv: stop checking if dynamic states changed
This is costly for the CPU and might hurt "good" applications that
already avoid that like DXVK/vkd3d-proton.

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5009
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12441>
2022-01-12 09:48:29 +00:00
Bas Nieuwenhuizen 38b3661b8f radv: 256 byte push constants.
This helps vkd3d-proton, especially when indirecting more stuff.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14485>
2022-01-12 01:08:39 +00:00
Bas Nieuwenhuizen 43f8e07765 radv: Use 16-bits to store push constant indices.
Otherwise things horrible go wrong when we get 256 bytes of push
constants.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14485>
2022-01-12 01:08:39 +00:00
Bas Nieuwenhuizen 3a36d0b787 radv: Use MAX_PUSH_CONSTANTS_SIZE for saved push constants.
So that it can never again get out of sync.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14485>
2022-01-12 01:08:39 +00:00
Pierre-Eric Pelloux-Prayer 7650e6fc4c radv: implement wsi's private transfer queue using SDMA
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13959>
2022-01-11 12:18:35 +00:00
Pierre-Eric Pelloux-Prayer d6ea60d5a2 radv: allocate the prime buffer as uncached
This is a write only buffer so caches aren't needed.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13959>
2022-01-11 12:18:35 +00:00
Pierre-Eric Pelloux-Prayer 7b5ab48c40 radv: partial sdma support
SDMA code adapted from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12763

The only supported use case is image (linear or tiled) -> buffer and only GFX9+ is
supported (for now).

Since RADV_QUEUE_TRANSFER aren't exposed to applications, this cannot be used,
except by the driver.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13959>
2022-01-11 12:18:35 +00:00
Pierre-Eric Pelloux-Prayer 148b2d0040 amd: add SDMA_NOP_PAD
And use it in amdgpu_cs.c.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13959>
2022-01-11 12:18:35 +00:00
Daniel Schürmann 4e2b624c10 aco: validate VOP3P opsel correctly
Before RA, subdword operands must use .xx
After RA, opsel can either be .xx or .yy

Cc: mesa-stable
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14472>
2022-01-11 11:41:12 +00:00
Thomas H.P. Andersen 7daba1fe65 replace 0 with NULL for NULL pointers
This updates many places where 0 is used as NULL pointer.

There are a few warnings left when I build the default
configuration but they either relate to code
outside of mesa or where "None" is used instead.

Found with static analysis (smatch)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12174>
2022-01-10 22:53:32 +00:00
Rhys Perry 60c711833f aco: remove pack_half_2x16(a, 0) optimization
This makes the compiler less predictable and should only have a very small
effect on performance.

fossil-db (Vega):
Totals from 2410 (1.79% of 134756) affected shaders:
CodeSize: 6911568 -> 6942840 (+0.45%)

Fixes Horizon Zero Dawn artifacts.

If a shader has:
   a = pack_half_2x16(a, 0) //rtne
   store(pack_half_2x16(0, b) | a) //rtne
   a = unpack_2x16(a).x
It will become:
   store(pack_half_2x16(a, b)) //rtz
   a = unpack_2x16(pack_half_2x16(a, 0)).x //rtne

So a later shader with "unpack_2x16(load()).x" will use "a" rounded to
zero, while the previous shader will use "a" rounded to the nearest even.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 2f125908b3 ("radv,aco: lower_pack_half_2x16")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14475>
2022-01-10 22:19:29 +00:00
Rhys Perry 0f5d90c2a7 ac/nir: fix store_buffer_amd write_masks
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14447>
2022-01-10 19:01:04 +00:00
Danylo Piliaiev b8d486f298 nir/algebraic: Separate has_dot_4x8 into has_sdot_4x8 and has_udot_4x8
Adreno GPUs has native instruction for unsigned and mixed dot_4x8 but
not signed dot product.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13986>
2022-01-10 13:20:39 +02:00
Rhys Perry 1756930a79 radv: increase maxTaskOutputCount to 65535
This is the minimum required by the spec.

Fixes dEQP-VK.api.info.vulkan1p2_limits_validation.nv_mesh_shader

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14446>
2022-01-07 15:04:11 +00:00
Bas Nieuwenhuizen 85ca7fab29 radv: Add common entrypoint dependency.
To ensure we have the header. The revert likely reintroduced compilation flakiness due
to missing dependencies.

Fixes: a255f6f823 ("radv: do not use the common entrypoint for the Metro Exodus layer")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14430>
2022-01-07 02:21:36 +00:00
Bas Nieuwenhuizen 63101914f8 radv: Set optimal copy alignment to 1.
I think we set it to 128 for no reason at all. The app is still
required to align to the texel size.

Note that we prefer 4 bytes for non-formatted buffer->buffer copy,
but that isn't in scope for these properties according to the
Vulkan spec.

It also happens to help hide what looks like an application bug at
this point with Baldurs Gate 3.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5509
Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14415>
2022-01-07 01:59:13 +00:00
Mike Blumenkrantz 05a5e5a2bc radv: fix xfb query copy param ordering
Fixes: afff9dd0f0 ("radv: Use correct buffer size for query pool result copies.")

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14422>
2022-01-06 17:44:09 +00:00
Samuel Pitoiset f43b0d5cdc radv/winsys: remove unused syncobj functions
The vulkan common runtime code uses the drm functions directly.

Fixes: 91fe0b5629 ("radv: Delete lots of sync code.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14375>
2022-01-06 09:13:50 +00:00
Samuel Pitoiset da0c708d79 radv: remove remaining dead code related to the old sync code
Fixes: 91fe0b5629 ("radv: Delete lots of sync code.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14375>
2022-01-06 09:13:50 +00:00
Samuel Pitoiset a255f6f823 radv: do not use the common entrypoint for the Metro Exodus layer
This is incorrect, it will calls the function recursively.

It seems there is random build failures with common runtime code
and MSVC but that's a different issue.

Closes: #5815
Fixes: 46c59e8fd6 ("radv: Remove dependencies on vk_common entrypoints.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14374>
2022-01-05 19:22:50 +00:00
Jason Ekstrand b2073f5e5d radv: Move QueueSignalReleaseImageANDROID to common code
This is mostly a copy+paste job but with a few syntax changes to make it
follow more closely with other common Vulkan code.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14372>
2022-01-05 16:36:10 +00:00
Jason Ekstrand dfb1e1777c anv,radv,v3dv: Move AcquireImageANDROID to common code
All three implementations are identical.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14372>
2022-01-05 16:36:10 +00:00
Marek Olšák 3c471c0eb5 ac/nir: move ac_are_tessfactors_def_in_all_invocs into radeonsi
radv isn't going to use it because it's for the TCS epilog

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:31 +00:00
Marek Olšák 116a05c721 ac: move ac_exp_param.h to ac_nir.h
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:31 +00:00
Marek Olšák 2c4926dfc8 radeonsi: use nir->scratch_size instead of ac_count_scratch_private_memory
It's the same.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:31 +00:00
Marek Olšák 12b942bd16 radeonsi: pass sample_coverage VGPR index to the PS prolog instead of guessing
The code was correct, but little confusing. This is cleaner.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:30 +00:00
Marek Olšák fd14e0afb1 radeonsi: set done=1 for PS exports at the end of si_llvm_build_ps_epilog
so that we can reorder the exports

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:30 +00:00
Marek Olšák d382ceea2b ac/llvm: remove the num_channels parameter from ac_build_buffer_store_dword
It was used when LLVM didn't support vec3 and we had to pass vec4
with num_channels=3. We no longer need to do that.

This also removes the vec3 splitting or conversion to vec4 in callers.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:30 +00:00
Marek Olšák e6aac44051 ac/llvm: add vindex into ac_build_buffer_store_dword
for future work

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:30 +00:00
Marek Olšák bb017d5d16 amd/registers: work around an assertion in parse_kernel_headers.py
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14266>
2022-01-05 12:46:30 +00:00
Marek Olšák 3ea5beca1f radv: apply spi_cu_en to CU_EN
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
2022-01-05 01:36:10 -05:00
Marek Olšák 955c6de1c1 radv: set COMPUTE_DESTINATION_EN_SEn to spi_cu_en
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
2022-01-05 01:36:10 -05:00
Marek Olšák 384014bebe radeonsi: apply spi_cu_en to CU_EN
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
2022-01-05 01:36:10 -05:00
Marek Olšák b06b481dfe radeonsi: program COMPUTE_STATIC_THREAD_MGMT_SE4..7 on Arcturus
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
2022-01-05 01:36:10 -05:00
Marek Olšák 470b61f3a9 ac/gpu_info: add AMD_CU_MASK environment variable to set CU_EN
requested internally

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
2022-01-05 01:36:10 -05:00
Marek Olšák a68cb9db8d ac/gpu_info: set cu_mask correctly for Arcturus
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
2022-01-05 01:36:10 -05:00
Timur Kristóf d34d0f38e1 radv: Support VRS for mesh shaders.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14193>
2022-01-04 17:46:02 +00:00
Timur Kristóf bc94c2718a aco: Emit VRS rate when it's per-primitive.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14193>
2022-01-04 17:46:02 +00:00
Timur Kristóf 811c001049 radv: Lower primitive shading rate for mesh shaders.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14193>
2022-01-04 17:46:02 +00:00
Timur Kristóf c6becb9574 radv: Note when a mesh shader writes the primitive shading rate.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14193>
2022-01-04 17:46:02 +00:00
Samuel Pitoiset 12ac44378d radv: add UMR markers for the vertex prolog
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376>
2022-01-04 07:50:07 +00:00
Samuel Pitoiset 14622b8bcc radv: dump the VS prolog disassembly to the hang report
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376>
2022-01-04 07:50:07 +00:00
Samuel Pitoiset d659c2ef9c radv: save the vertex prolog to the trace BO for debugging
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376>
2022-01-04 07:50:07 +00:00
Samuel Pitoiset 2bf25e6f6e radv,aco: keep track of the prolog disassembly if necessary
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376>
2022-01-04 07:50:07 +00:00
Samuel Pitoiset e836174077 aco: do not print prologs disassembly if no disassembler
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376>
2022-01-04 07:50:07 +00:00
Samuel Pitoiset 3ef736c94e aco: fix a dynamic-stack-buffer-overflow when printing instructions
Detected by ASAN.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14329>
2022-01-04 08:04:50 +01:00
Tatsuyuki Ishi 31d839aacc aco: lower masked swizzle to DPP8
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13971>
2021-12-31 20:56:39 +00:00
Tatsuyuki Ishi da0412e55b aco: support DPP8
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13971>
2021-12-31 20:56:39 +00:00
Bas Nieuwenhuizen 46c59e8fd6 radv: Remove dependencies on vk_common entrypoints.
Fixes: 91fe0b5629 ("radv: Delete lots of sync code.")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14366>
2021-12-31 17:49:10 +01:00
Bas Nieuwenhuizen 8c4c63a6ed radv: Rename submit2->submit.
Cleanup after the big switcheroo.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen 84ec547f69 radv: Remove syncobj reset mechanism.
Now done with the vulkan runtime.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen 91fe0b5629 radv: Delete lots of sync code.
This make things all fall back to the common synchronization functions
which will switch things to the new submission path and to use
vk_fence and vk_semaphore.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>

radv: Use common AcquireNextImage2KHR.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>

radv: Use common functions for Metro Exodus layer.

Needs to be squashed with the big "switch the world" deletion patch
but kept it separate for review.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen 967fc415fc radv: Add new submission path for use by the common sync framework.
Basically just a copy of radv's internal deferred submission handler.

This uses the new winsys submit2 to later be able to move the sem_info
to the winsys.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen 93cde57f7a radv: Add new cs_submit2 winsys call.
A bit more runtime dependence so we can remove all the syncobj stuff
in radv itself.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen 9d75f23350 radv: Use vk_command_buffer for preambles.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen 31da5c41b6 radv: Set horizontal sync types.
We basically use 2 types for amdgpu:

1) syncobj. This supports both binary & timeline and autodetects
  all the features.
2) emulated timelines if (1) doesn't detect timeline syncobj support.

Note that one has to put these in order of preference so that the
common CreateFence/CreateSemaphore functions decide on the right
type.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen 1965872b41 radv: Add function to allow WSI signalling fences/semaphores.
Added but not enabled yet. Will enable in the big switchover.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:18 +00:00
Bas Nieuwenhuizen 3055d2f9df radv: Initialize vk device drm fd.
For common sync.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:18 +00:00
Bas Nieuwenhuizen 1a84dd6358 radv: Use vulkan runtime for device lost.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:18 +00:00
Bas Nieuwenhuizen 085f99b729 radv: Use dispatch table for wsi_display.c
Pretty sure this could be moved into WSI.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:18 +00:00
Bas Nieuwenhuizen 40558dbe91 radv: Use dispatch table for QueueWaitIdle in the SQTT layer.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:18 +00:00
Daniel Schürmann 16a527deef aco: don't split VOP3P definitions
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Daniel Schürmann 7e02787a54 aco: use p_create_vector(v2b,v2b) in get_alu_src_vop3p()
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Daniel Schürmann e56d8b0b2e aco: use explicit zero-padding for 64bit image loads in expand_vector()
Previously, this only worked because of regClass mismatches
in the allocated vector.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Daniel Schürmann 91f17e1c73 aco/optimizer: apply extract from subdword p_split_vector
Totals from 1345 (1.00% of 134572) affected shaders: (GFX10.3)
VGPRs: 76752 -> 76744 (-0.01%); split: -0.02%, +0.01%
SpillSGPRs: 1459 -> 1460 (+0.07%)
SpillVGPRs: 1776 -> 1784 (+0.45%); split: -0.39%, +0.84%
CodeSize: 13310964 -> 13309420 (-0.01%); split: -0.06%, +0.05%
Scratch: 178176 -> 179200 (+0.57%)
Instrs: 2516874 -> 2516860 (-0.00%); split: -0.05%, +0.05%
Latency: 23228506 -> 23230338 (+0.01%); split: -0.14%, +0.15%
InvThroughput: 6002384 -> 6000158 (-0.04%); split: -0.24%, +0.21%
VClause: 41115 -> 41117 (+0.00%); split: -0.28%, +0.29%
SClause: 104639 -> 104664 (+0.02%); split: -0.07%, +0.09%
Copies: 185121 -> 184862 (-0.14%); split: -0.69%, +0.55%
Branches: 100740 -> 100735 (-0.00%); split: -0.01%, +0.00%
PreVGPRs: 70119 -> 69968 (-0.22%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Daniel Schürmann fb622775b5 aco/optimizer: optimize extract(extract())
Totals from 53 (0.04% of 134572) affected shaders: (GFX10.3)
SpillVGPRs: 1780 -> 1776 (-0.22%); split: -0.34%, +0.11%
CodeSize: 968352 -> 963196 (-0.53%); split: -0.55%, +0.02%
Scratch: 180224 -> 178176 (-1.14%)
Instrs: 169800 -> 169158 (-0.38%); split: -0.39%, +0.01%
Latency: 6186064 -> 6141408 (-0.72%); split: -1.16%, +0.44%
InvThroughput: 2605044 -> 2582967 (-0.85%); split: -1.37%, +0.52%
VClause: 4851 -> 4866 (+0.31%); split: -0.16%, +0.47%
SClause: 1744 -> 1746 (+0.11%)
Copies: 42874 -> 42325 (-1.28%); split: -1.40%, +0.12%
Branches: 5762 -> 5765 (+0.05%); split: -0.02%, +0.07%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Daniel Schürmann 5ad9c20d4a aco/optimizer: apply extract from p_extract_vector
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Daniel Schürmann 11712729eb aco/optimizer: keep instr_mod_labels after applying extract
This allows to use clamp on SDWA and VOP3 opsel instructions.

Totals from 32 (0.02% of 134572) affected shaders: (GFX10.3)
SpillVGPRs: 1783 -> 1780 (-0.17%); split: -0.50%, +0.34%
CodeSize: 881480 -> 881496 (+0.00%); split: -0.15%, +0.15%
Instrs: 154400 -> 154388 (-0.01%); split: -0.13%, +0.12%
Latency: 5021791 -> 5033485 (+0.23%); split: -0.67%, +0.90%
InvThroughput: 2486454 -> 2492312 (+0.24%); split: -0.67%, +0.91%
VClause: 4763 -> 4755 (-0.17%); split: -0.52%, +0.36%
Copies: 42866 -> 42965 (+0.23%); split: -0.25%, +0.48%
Branches: 5640 -> 5639 (-0.02%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Daniel Schürmann 1502c22e2c aco: don't allow SDWA on VOP3P instructions
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13576>
2021-12-31 14:52:14 +00:00
Samuel Pitoiset 90994e4db7 radv: add drirc radv_disable_htile_layers and enable it for F1 2021
To workaround some flickering issues in the main menu.
See https://github.com/HansKristian-Work/vkd3d-proton/issues/950

Cc: 21.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14354>
2021-12-31 14:27:32 +00:00
Samuel Pitoiset ce5d7bf508 radv: fix copying mutable descriptors to sampler descriptors
This fixes a heap-buffer-overflow detected by ASAN.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14330>
2021-12-31 13:39:56 +00:00
Timur Kristóf 6fee84bc2e radv: Enable NV_mesh_shader with a perftest flag.
We don't plan to support NV_mesh_shader officially on RADV,
because it performs poorly on AMD hardware. However, we are
implementing this extension to get some experience with mesh
shader technology.

Users should not rely on this support because we are going
to remove it if/when a potential cross-vendor extension appears.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf f2dd1fbc63 radv: Implement NV_mesh_shader draw calls.
The NV indirect command buffer format is not supported by
the hardware, so we have to emit several copy packets to
make it work.

Otherwise it works by emulating the number of launched
MS workgroups by setting the number of "input vertices".

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 8d238f5581 aco: Export per-primitive mesh shader output attributes.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf fc1424f1d8 aco: Use the correct outinfo for mesh shaders.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 92556d6067 aco: Add 1D workgroup_id support for mesh shaders.
I'll add support for 3D workgroup_id later, but NV_mesh_shader only
supports 1D workgroups.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 7759323b75 aco: Update README about NGG and mesh shaders.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 6766e6a985 aco: Add Mesh and Task shader stages.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 7ae425c5d4 radv: Add support for mesh shading pipelines in the command buffer.
- Prefetch mesh shaders
- Flush mesh shader descriptors
- Assert that input assembly, etc. are ignored.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 8dc4f626ac radv: Create mesh shading pipelines.
- Fill gfx10_ngg_info
- Allow NULL input assembly state
- Assert that the correct shader stages are used
- Program VGT_GS_MAX_VERT_OUT, GS_EN, GS_FAST_LAUNCH

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf e2df56f502 radv: Set output driver locations for mesh shaders.
Ignore primitive count and indices which work differently.

Then, assign driver locations to per-vertex and per-primitive
outputs independently because we allocate separate LDS
areas for them.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 11501fa686 radv: Compile mesh shaders and apply the necessary NIR lowerings.
Mesh shaders use NGG, but the API allows many compute shader
features such as workgroups and shared memory.
Use the appropriate NIR lowerings for these, then
call ac_nir_lower_ngg_ms.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf ae82d9d8f4 radv: Setup shader arguments for mesh shaders.
Use the same code path as other NGG shaders, but with
a few special cases.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf e3a80d9d29 radv: Add support for per-primitive mesh shader outputs.
Generic per-primitive outputs:

They work similarly to other NGG outputs.
In the ISA they are param export instructions that are executed
on the primitive threads. These per-primitive params must be
sorted last among both mesh shader outputs and pixel shader inputs.

PS can read these inputs using the same old VINTRP instructions.
They use the same amount of LDS space as per-vertex PS inputs.

Special per-primitive outputs:

The VRS rate x, y, viewport and layer are special per-primitive
outputs which must go to the second channel of the primitive
export instruction, which is enabled by EN_PRIM_PAYLOAD.

If the PS wants to read these, they must also be exported as
a generic param.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf c7027156ea radv: Cleanup VS output param assignment.
Makes the code a little cleaner, and makes it easier to add
per-primitive PS inputs.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 256dcc209f radv: Cleanup PS input generation.
This cleans up radv_pipeline_generate_ps_inputs.
Makes the code a little cleaner, and makes it easier to add
per-primitive PS inputs.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 459b4961bd radv: Add mesh shader specific info.
Use the same old outinfo structure as other NGG shaders.
Additionally, store the output primitive type.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 32bc466dcb radv: Add radv_pipeline_has_mesh helper.
This will be used to determine whether a pipeline uses
mesh shading or not.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 7aa42e023a ac/nir/ngg: Lower NV mesh shaders to NGG semantics.
Lower mesh shader outputs to shared memory.

At the end of the shader, read the outputs from shared memory
and export their values as NGG expects.

We allocate separate shared memory (LDS) areas for per-vertex,
per-primitive outputs, primitive indices, primitive count.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13580>
2021-12-31 13:05:09 +00:00
Timur Kristóf 1a1f5ad11d gitlab-ci: Disable radv-fossils again.
It gets a HTTP 504 error code when trying to access a git repo.
Disable it again until this issue is resolved.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14364>
2021-12-31 13:38:32 +01:00
Qiang Yu 1876285c27 ac/surface: add prt_tile_depth
For supporting 3D sparse texture.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14223>
2021-12-30 16:11:19 +08:00
Qiang Yu 92d810fa74 ac/surface: fix prt_first_mip_tail calculation for gfx9+
Use firstMipIdInTail directly from addrlib which calculated this
in a different way:

Original way: either dimension size of mipmap should be less than
the tile size.

Addrlib way: all dimesion size of the mipmap should be less than
the tile size and at lest one dimension size should be less than
half of the tile size, so that all following mip levels can fit
in one tile and any commit for level in the mip tail also commit
for all levels in mip tail.

Theoretically either way is OK but addrlib way needs less care
about the mip tail commit and better align with the true memory
layout given by itself.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14223>
2021-12-30 16:11:19 +08:00
Samuel Pitoiset b249e700ac radv: print number of levels with RADV_DEBUG=img
Might help debugging image related issues like DCC or HTILE.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14336>
2021-12-29 15:24:42 +00:00
Samuel Pitoiset 4942e10890 radv: stop checking buffer size in vkCreateBuffer()
This was added to fix dEQP-VK.api.buffer.basic.size_max_uint64 but
with VK_KHR_maintenance4 this is now considered invalid usage.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14331>
2021-12-29 15:03:28 +00:00
Daniel Stone 05818bf7a4 Revert "gitlab-ci: disable radv-fossils"
The fossils-db repository is fixed now.

This reverts commit 7b8ea33848.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14337>
2021-12-29 13:48:03 +00:00
Samuel Pitoiset 34151f9be9 radv: fix clears with value of "1" and different DCC signedness
For example, if the driver clears a view of SINT with 127 and the image
format is UNORM, the hw fills "1" instead of the clear value
(127.0f / 255.0f). This CB feature is GFX9+ only.

This should fix test_typed_srv_cast_clear from vkd3d-proton once it
correctly sets the MUTABLE flag (which is still buggy as of c0a3fa8a).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5676
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14228>
2021-12-28 16:35:51 +00:00
Georg Lehmann 554e1c2000 radv: Increase maxFragmentCombinedOutputResources.
This also includes storage images and storage buffers, not just color
attachments.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14311>
2021-12-28 16:15:26 +00:00
Bas Nieuwenhuizen 50658ed8da radv/amdgpu: Use VkResult for wait_timeline_syncobj.
So we can actually return errors.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14165>
2021-12-28 15:55:18 +00:00
Bas Nieuwenhuizen 20b51cdabe radv: Skip wait timeline ioctl with 0 handles.
Fixes: 55d8022878 "radv: Add winsys functions for timeline syncobj."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14165>
2021-12-28 15:55:18 +00:00
Bas Nieuwenhuizen afff9dd0f0 radv: Use correct buffer size for query pool result copies.
1. the dst stride may be too small if count=1.
2. the src stride may be too small due to the availability bit.

So lets just compute the size needed explicitly and use it.

Fixes: 90a0556c ("radv: use pool stride when copying single query results")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14242>
2021-12-28 15:35:51 +00:00
Samuel Pitoiset b775aaff1e radv: re-apply "Do not access set layout during vkCmdBindDescriptorSets."
Uplay needs this to avoid a crash because it does an use-after-free
of a descriptor set layout. This was initially introduced by Bas to
workaround a similar issue with Baldur's Gate 3, it seems needed again.

Cc: 21.3 mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5789
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14318>
2021-12-28 15:56:55 +01:00
Samuel Pitoiset 01f1bd4dfd radv: re-enable fast clears for images that support comp-to-single
This optimized path was disabled, oops.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14176>
2021-12-28 14:24:40 +00:00
Samuel Pitoiset 7b7debe8f9 radv: fix restoring subpass during hw/fs color resolves
This fixes an stack-use-after-scope detect by ASAN because the
subpass is used after the loop by radv_mark_noncoherent_rb().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14317>
2021-12-28 12:53:12 +00:00
Samuel Pitoiset 030daf80b5 radv/winsys: remove radv_amdgpu_winsys_bo::is_shared
This has never been used.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14287>
2021-12-28 12:51:29 +01:00
Samuel Pitoiset 847048fa24 radv/winsys: stop zeroing few structs in buffer_from_fd()
Errors are correctly handled here.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14287>
2021-12-28 12:51:27 +01:00
Samuel Pitoiset 3368e522b4 radv: remove unnecessary NULL checks in vkMapMemory()/vkUnmapMemory()
It's required to have a valid device memory handle and it would make
no sense to call these functions with a NULL pointer.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14287>
2021-12-28 12:51:25 +01:00
Lionel Landwerlin 7b8ea33848 gitlab-ci: disable radv-fossils
For some reason CI is unable to pull a git repo needed to run this.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14312>
2021-12-27 15:13:40 -08:00
Vinson Lee 222487fabe radv: Fix memory leak on error path.
Fix defects reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable signal_semaphore_infos going out of scope leaks the storage it points to
leaked_storage: Variable wait_semaphore_infos going out of scope leaks the storage it points to.

Fixes: 3da7d10d9b ("radv: implement vkQueueSubmit2KHR()")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14260>
2021-12-24 00:15:53 -08:00
Timur Kristóf b293299776 aco/optimizer_postRA: Fix applying VCC to branches.
Fixes: a93092d0ed
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14281>
2021-12-21 22:53:23 +00:00
Timur Kristóf ce4daa259c aco/optimizer_postRA: Fix combining DPP into VALU.
Fixes: 4ac47ad1cd
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14281>
2021-12-21 22:53:23 +00:00
Daniel Schürmann d36a43598c aco/ra: fix get_reg_for_operand() in case of stride mismatches
We have to clear the register file from the previous operand
as otherwise, there might be no space left.

Totals from 5 (0.00% of 134572) affected shaders: (GFX10.3)
CodeSize: 21144 -> 21000 (-0.68%); split: -0.72%, +0.04%
Instrs: 3738 -> 3720 (-0.48%); split: -0.51%, +0.03%
Latency: 517229 -> 516319 (-0.18%); split: -0.18%, +0.00%
InvThroughput: 49068 -> 48902 (-0.34%); split: -0.38%, +0.04%
Copies: 501 -> 483 (-3.59%); split: -3.79%, +0.20%

Cc: mesa-stable
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14279>
2021-12-21 17:15:45 +00:00
Daniel Schürmann 30a7199e37 aco/optimizer: propagate and fold inline constants on VOP3P instructions
This patch aims to propagate and fold constants on VOP3P instructions
by using omod selection and the fneg modifier.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13688>
2021-12-21 13:23:36 +01:00
Daniel Schürmann 62bcfcd0a8 aco: change fneg for VOP3P to use fmul with +1.0
This will be useful to be able to also apply
fneg_lo and fneg_hi.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13688>
2021-12-21 13:23:36 +01:00
Daniel Schürmann 193bd740ab aco/optimizer: fix fneg modifier propagation on VOP3P
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13688>
2021-12-21 13:23:36 +01:00
Rhys Perry fa4e08112e aco: remove SMEM constant/addition combining out of the loop
There's no reason for this optimization to be in this loop.

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/13755>
2021-12-17 22:14:36 +00:00
Rhys Perry dd18925f86 aco: skip &-4 before SMEM
The hardware ignores the low 2 bits. I'm not sure if they are ignored
before or after the address is calculated, but this optimization should be
cautious enough.

fossil-db (Sienna Cichlid):
Totals from 259 (0.19% of 134572) affected shaders:
SpillSGPRs: 1381 -> 1382 (+0.07%)
SpillVGPRs: 1783 -> 1782 (-0.06%); split: -0.67%, +0.62%
CodeSize: 1598612 -> 1596084 (-0.16%); split: -0.30%, +0.14%
Scratch: 180224 -> 179200 (-0.57%); split: -1.14%, +0.57%
Instrs: 284885 -> 284268 (-0.22%); split: -0.34%, +0.12%
Latency: 6585634 -> 6603388 (+0.27%); split: -0.48%, +0.75%
InvThroughput: 2638983 -> 2648474 (+0.36%); split: -0.58%, +0.94%
VClause: 6797 -> 6820 (+0.34%); split: -0.15%, +0.49%
SClause: 6569 -> 6574 (+0.08%); split: -1.11%, +1.19%
Copies: 50561 -> 50586 (+0.05%); split: -0.61%, +0.66%
Branches: 10058 -> 10062 (+0.04%); split: -0.01%, +0.05%

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/13755>
2021-12-17 22:14:36 +00:00
Rhys Perry cf5fc4b973 aco: disallow SMEM offsets that are not multiples of 4
These can't be encoded on GFX6/7, and combining these additions causes
CTS failures on GFX10.3.

I think the low 2 MSBs are ignored before the addition, not after, so
load(a + 3, 0) becomes load(a, 3), which is the same as load(a, 0).

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/13755>
2021-12-17 22:14:36 +00:00
Bas Nieuwenhuizen 860532c5a1 radv: Add safety check for RGP traces on VanGogh.
To avoid accidental hangs.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5260
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13730>
2021-12-17 21:25:01 +00:00
Samuel Pitoiset ac8afe3f44 radv: fix dynamic rendering global scissor
Make sure to clamp the global scissor to the render area.

This fixes dEQP-VK.draw.dynamic_rendering.*oversized.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14170>
2021-12-17 16:51:00 +00:00
Rhys Perry 94603786c5 aco: fix check_vop3_operands() for f16vec2 ffma fneg combine
For v_pk_fma_f16, we should consider all three operands, not the first
two.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 15a375b4c8 ("radv,aco: don't lower some ffma instructions")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14229>
2021-12-17 11:16:12 +00:00
Bas Nieuwenhuizen ed7c48f94a radv/amdgpu: Only wait on queue_syncobj when needed.
If signalled on the same queue it is totally useless, so only wait
if we have a syncobj that is explicitly being waited on, which can
be from potentially another queue/ctx. (Ideally we'd check but there
is no way to do so currently. Might revisit when we integrate the
common sync framework)

Fixes: 7675d066ca ("radv/amdgpu: Add support for submitting 0 commandbuffers.")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14214>
2021-12-17 08:54:08 +00:00
Samuel Pitoiset 5ce4017a2b radv,aco: do not disable anisotropy filtering for non-mipmap images
This fixes
dEQP-VK.texture.filtering_anisotropy.single_level.anisotropy_*.mag_linear_min_linear.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14171>
2021-12-16 07:20:50 +00:00
Samuel Pitoiset 8a327722d5 ac/nir: add an option to disable anisotropic filtering for single level images
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14171>
2021-12-16 07:20:50 +00:00
Samuel Pitoiset cca8803e6b radv/winsys: update sparse mappings with OP_REPLACE instead of OP_MAP/OP_UNMAP
When the BO is NULL, AMDGPU will reset the PTE VA range to the initial
state. Otherwise, it will first unmap all existing VA that overlap the
requested range and then map. This seems better than using MAP/UNMAP.

This reduces stuttering in Forza Horizon 5.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>
2021-12-15 08:17:29 +01:00
Samuel Pitoiset a6ca0a8c52 radv/winsys: stop using reference counting for virtual BOs
This shouldn't be necessary because applications have to manage
resources and memory themselves.

This also prevented memory to be freed if an application doesn't unbind
a sparse memory object and free it, which is legal as long as the
resource isn't used afterwards.

This was introduced to unmap the sparse mappings when destroying
a virtual BO, but now that the driver uses OP_CLEAR it's no longer
needed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>
2021-12-15 08:17:26 +01:00
Samuel Pitoiset a931d5a4a4 radv/winsys: clear the PRT VA range when destroying a virtual BO
Instead of unmapping every range.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>
2021-12-15 08:17:24 +01:00
Samuel Pitoiset 782474782b radv/winsys: remove useless has_sparse_vm_mappings checks
Sparse is only exposed on GFX8+, so this is always TRUE.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14116>
2021-12-15 08:17:22 +01:00
Rhys Perry 451e6c1b32 radv: have the null winsys set more fields
I copied stuff from ac_gpu_info.c until there were no Sienna Cichild or
Polaris10 fossil-db changes between real hardware and RADV_FORCE_FAMILY.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14126>
2021-12-14 12:11:50 +00:00
Bas Nieuwenhuizen 9e8fa8168b radv: Expose the ETC2 emulation.
As needed on Android (as it is required) and by driconf flag otherwise.
The non-Android case would be on the host side for an Android VM.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
2021-12-14 11:30:48 +00:00
Bas Nieuwenhuizen a8078bab91 radv: Deal with border colors with emulated ETC2.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
2021-12-14 11:30:48 +00:00
Bas Nieuwenhuizen 1153db23f5 radv: Add ETC2 decode shader.
To make sure that apps actually get something when the HW doesn't
support ETC2. To do that we decompress after every copy operation.

Includes a quite complicated decode shader. It is not bit-to-bit
equivalent to AMD APUs that support ETC2, but close enough to
pass CTS. Likely missing bits are related to the R11 and R11G11
formats where we decode to 16 bits but likely do the extension
differently.

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
2021-12-14 11:30:48 +00:00
Bas Nieuwenhuizen 42a71be793 radv: Add extra plane for decoding ETC images with emulation.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
2021-12-14 11:30:48 +00:00
Bas Nieuwenhuizen c55ebdb76d radv: Use the correct base format for reintepretation.
Going to hit it when emulating ETC2 through another plane.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
2021-12-14 11:30:48 +00:00
Bas Nieuwenhuizen 7c5fe66f8a radv: Set up ETC2 emulation wiring.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
2021-12-14 11:30:48 +00:00
Rhys Perry 15a375b4c8 radv,aco: don't lower some ffma instructions
GFX10.3 has no v_mad_f32 and we can't recombine exact ffma into a
v_fma_f32 if they're split. GFX9+ only has v_fma_f16 and no generation has
a 64-bit MAD.

fossil-db (GFX10.3):
Totals from 84040 (57.46% of 146267) affected shaders:
VGPRs: 3717256 -> 3688064 (-0.79%); split: -0.87%, +0.08%
SpillSGPRs: 10419 -> 10403 (-0.15%)
CodeSize: 263064884 -> 262442820 (-0.24%); split: -0.31%, +0.07%
MaxWaves: 2036908 -> 2038374 (+0.07%); split: +0.10%, -0.03%
Instrs: 49849448 -> 49572182 (-0.56%); split: -0.60%, +0.04%
Latency: 908130602 -> 907764246 (-0.04%); split: -0.18%, +0.14%
InvThroughput: 207051300 -> 206762704 (-0.14%); split: -0.24%, +0.10%

fossil-db (GFX10):
Totals from 2 (0.00% of 146267) affected shaders:
Latency: 8123 -> 8107 (-0.20%)

fossil-db (GFX9):
Totals from 2 (0.00% of 146401) affected shaders:
(no statistics affected)

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/9805>
2021-12-13 11:22:33 +00:00
Rhys Perry 165ca5088b radv,aco: implement nir_op_ffma
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/9805>
2021-12-13 11:22:33 +00:00
Rhys Perry c5f02a1cd3 aco: swap multiplication operands if needed to create v_fmac_f32/etc
For v_pk_fma_f32 and v_fma_f32 from nir_op_ffma, we don't try to put
scalars in the first operand.

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/9805>
2021-12-13 11:22:33 +00:00
Rhys Perry f4f5d577fc aco: swap operands if necessary to create v_madak/v_fmaak
Also rewrite the check_literal logic to be more straightforward.

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/9805>
2021-12-13 11:22:33 +00:00
Rhys Perry 2665320c78 aco: create v_fmamk_f32/v_fmaak_f32 from nir_op_ffma
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/9805>
2021-12-13 11:22:33 +00:00
Rhys Perry a487747ebd aco: use more predictable tiebreaker when forming MADs
fossil-db (GFX10.3):
Totals from 84981 (58.10% of 146267) affected shaders:
VGPRs: 3829896 -> 3820480 (-0.25%); split: -0.33%, +0.08%
CodeSize: 270860472 -> 270850132 (-0.00%); split: -0.08%, +0.08%
MaxWaves: 2035822 -> 2042516 (+0.33%); split: +0.39%, -0.06%
Instrs: 51285526 -> 51308869 (+0.05%); split: -0.03%, +0.08%
Latency: 931503706 -> 932556231 (+0.11%); split: -0.19%, +0.30%
InvThroughput: 217084232 -> 217070849 (-0.01%); split: -0.12%, +0.11%

fossil-db (GFX10):
Totals from 85520 (58.47% of 146267) affected shaders:
VGPRs: 3729132 -> 3725344 (-0.10%); split: -0.21%, +0.10%
CodeSize: 272796500 -> 272783084 (-0.00%); split: -0.09%, +0.08%
MaxWaves: 2246410 -> 2249012 (+0.12%); split: +0.17%, -0.05%
Instrs: 51643962 -> 51664865 (+0.04%); split: -0.04%, +0.08%
Latency: 932331949 -> 933274979 (+0.10%); split: -0.19%, +0.29%
InvThroughput: 214187040 -> 214130994 (-0.03%); split: -0.13%, +0.11%

fossil-db (GFX9):
Totals from 84619 (57.80% of 146401) affected shaders:
SGPRs: 5366240 -> 5366944 (+0.01%); split: -0.09%, +0.10%
VGPRs: 3765608 -> 3764972 (-0.02%); split: -0.23%, +0.22%
CodeSize: 263634732 -> 263616320 (-0.01%); split: -0.08%, +0.08%
MaxWaves: 546617 -> 547091 (+0.09%); split: +0.18%, -0.09%
Instrs: 51426195 -> 51458334 (+0.06%); split: -0.03%, +0.10%
Latency: 1164445660 -> 1161923480 (-0.22%); split: -0.46%, +0.24%
InvThroughput: 542964697 -> 542329595 (-0.12%); split: -0.26%, +0.14%

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/9805>
2021-12-13 11:22:33 +00:00
Samuel Pitoiset 9a388beda7 radv: ignore dynamic inheritance if the render pass isn't NULL
From the Vulkan spec:

    "If the pNext chain of VkCommandBufferInheritanceInfo includes a
     VkCommandBufferInheritanceRenderingInfoKHR structure, then that
     structure controls parameters of dynamic render pass instances
     that the VkCommandBuffer can be executed within. If
     VkCommandBufferInheritanceInfo::renderPass is not VK_NULL_HANDLE,
     or VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT is not
     specified in VkCommandBufferBeginInfo::flags, parameters of this
     structure are ignored."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14109>
2021-12-13 10:48:44 +00:00
Samuel Pitoiset 841949e50b radv: fix dynamic rendering inheritance if the subpass index isn't 0
The driver will always create only one subpass in the render pass
for inheritance but the subpass index isn't always zero.

This fixes dEQP-VK.multiview.dynamic_rendering.secondary_cmd_buffer*.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14109>
2021-12-13 10:48:44 +00:00
Samuel Pitoiset 43022ecc3a radv: enable lower_lod_zero_width
This fixes dEQP-VK.glsl.texture_functions.query.texturequerylod.*.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14147>
2021-12-13 10:00:07 +00:00
Rhys Perry c7fa15b381 aco: improve clrx disassembly
- remove uninteresting lines of output
- remove binary offset before instructions, for easier diffing
- replace generated labels with block numbers
- add encoded instructions at the end of lines, like LLVM dissaembly
- print constant data instead of trying to disassemble it

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/14042>
2021-12-10 23:46:30 +00:00
Samuel Pitoiset e2ad92eb22 radv: do not perform depth/stencil resolves for suspended render pass
From the Vulkan spec:

    "Store and resolve operations are only performed at the end of a
     render pass instance that does not specify the
     VK_RENDERING_SUSPENDING_BIT_KHR flag."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14112>
2021-12-10 22:03:00 +00:00
Samuel Pitoiset c27348a3f7 Revert "radv: Add bufferDeviceAddressMultiDevice support."
This was a workaround for fixing a crash with Baldur's Gate 3 at start
but the game fixed it since.

This reverts commit 1fe375e7cf.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14134>
2021-12-10 21:38:00 +00:00
Rhys Perry 786d434397 aco: don't create unnecessary addition in indirect get_sampler_desc()
I don't think this has any effect on GFX9+ because the addition is
combined into the load.

fossil-db (polaris10):
Totals from 12595 (9.29% of 135627) affected shaders:
SGPRs: 1054348 -> 1054860 (+0.05%); split: -0.02%, +0.07%
VGPRs: 667240 -> 667320 (+0.01%); split: -0.01%, +0.02%
CodeSize: 82761508 -> 82512816 (-0.30%); split: -0.30%, +0.00%
MaxWaves: 62182 -> 62181 (-0.00%)
Instrs: 16072934 -> 16010764 (-0.39%); split: -0.39%, +0.00%
Latency: 582819635 -> 582287964 (-0.09%); split: -0.13%, +0.04%
InvThroughput: 276460536 -> 276417613 (-0.02%); split: -0.06%, +0.05%
VClause: 261656 -> 261654 (-0.00%); split: -0.01%, +0.01%
SClause: 680952 -> 680854 (-0.01%); split: -0.05%, +0.04%
Copies: 1727202 -> 1727742 (+0.03%); split: -0.12%, +0.15%
Branches: 547050 -> 547033 (-0.00%); split: -0.01%, +0.00%

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/14043>
2021-12-09 17:58:54 +00:00
Timur Kristóf 77db4e27b1 aco: Clean up and fix quad group instructions with WQM.
According to the Vulkan spec chapter 9.25 Helper Invocations,
quad group operations have to be executed by helper invocations.

This commit cleans up the code for quad group instructions by
unifying the code path of quad broadcast with the others, and then
calling emit_wqm just once at the end.

Fixes: 93c8ebfa78
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5570
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13929>
2021-12-09 17:36:51 +00:00
Dave Airlie d051854cca treewide: drop mtypes/macros includes from main
These aren't required in lots of places, so remove them.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14127>
2021-12-08 22:14:45 +00:00
Bas Nieuwenhuizen 7f34b70474 radv: Use the winsys 0 cmdbuffer submission support.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14097>
2021-12-08 20:21:05 +00:00
Bas Nieuwenhuizen 7675d066ca radv/amdgpu: Add support for submitting 0 commandbuffers.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14097>
2021-12-08 20:21:05 +00:00
Bas Nieuwenhuizen 6eb0821315 radv/winsys: Add queue family param to submit.
Extracting it from the first CS will not go over well once we try
submitting 0 of them.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14097>
2021-12-08 20:21:05 +00:00
Bas Nieuwenhuizen c03d258046 radv/amdgpu: Add a syncobj per queue.
For merging our own dependencies in without submitting.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14097>
2021-12-08 20:21:05 +00:00