platform/upstream/mesa.git
11 months agovc4: Convert to new-style NIR registers
Faith Ekstrand [Fri, 14 Jul 2023 08:42:57 +0000 (03:42 -0500)]
vc4: Convert to new-style NIR registers

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24153>

11 months agonir/trivialize: Move decl_reg to the start of the block
Iago Toral Quiroga [Thu, 20 Jul 2023 09:16:07 +0000 (11:16 +0200)]
nir/trivialize: Move decl_reg to the start of the block

This makes it so we never find a reg_decl in between a reg_store and the def
for its value, which helps avid inserting copy movs.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24153>

11 months agonir/trivialize: Handle more RaW hazards
Alyssa Rosenzweig [Tue, 18 Jul 2023 14:46:14 +0000 (10:46 -0400)]
nir/trivialize: Handle more RaW hazards

Consider the snippet of NIR:

   div 32    %447 = @load_reg (%442) (base=0, legacy_fabs=0, legacy_fneg=0)
   div 32    %463 = @load_reg (%442) (base=0, legacy_fabs=0, legacy_fneg=0)
   con 32    %409 = iadd %17 (0x3), %447
                    @store_output (%182 (0x601), %463) (base=0, wrmask=x, component=0, src_type=invalid...
                    @store_reg (%409, %442) (base=0, wrmask=x, legacy_fsat=0)

The load_reg's are trivial, so the %442 read will get folded into store_output.
But under the old definition, the store_reg is also trivial so it gets folded
into the iadd... causing a read-after-write hazard and invalid code generation.

The fix is to amend our definition of store_reg triviality to account for loads
getting folded in. It's not good enough that there's no intervening load_reg,
there can also be no intervening source that gets chased to a load_reg. Handle
that case as well.

Identified in dEQP-VK.geometry.input.basic_primitive.triangles_adjacency on
V3DV.

Fixes: d313eba94ef0 ("nir: Add pass for trivializing register access")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reported-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24153>

11 months agonir/trivialize: Trivialize cross-block loads
Faith Ekstrand [Tue, 18 Jul 2023 15:17:31 +0000 (10:17 -0500)]
nir/trivialize: Trivialize cross-block loads

In order for a register load to be trivial, it cannot be used in any
block other than the one in which it is loaded.  We're not currently
explicitly doing anything to ensure this invariant holds.  It may be
that it holds regardless but I couldn't find any documented reason why
it should so let's explicitly handle that case.  Worst case, the newly
added code does nothing.

Fixes: d313eba94ef0 ("nir: Add pass for trivializing register access")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24153>

11 months agonir/trivialize: Maintain divergence information
Faith Ekstrand [Thu, 20 Jul 2023 14:22:50 +0000 (09:22 -0500)]
nir/trivialize: Maintain divergence information

Because this pass is intended to be run after out-of-SSA and directly
before injesting the NIR into the back-end, it may come after divergence
analysis and needs to preserve the divergence information. Fortunately,
since all we ever do is insert nir_op_mov, this is easy.

Fixes: d313eba94ef0 ("nir: Add pass for trivializing register access")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24153>

11 months agonir: Properly handle divergence for load_reg
Faith Ekstrand [Wed, 19 Jul 2023 16:20:16 +0000 (11:20 -0500)]
nir: Properly handle divergence for load_reg

This commit makes three changes:

 1. Default all newly created registers divergent because this is the
    safer default.

 2. Make divergence analysis do something sane with register divergence.
    It's not perfect because divergence analysis isn't able to prove
    registers divergent based on stores but at least if someone uses
    registers a bit they'll end up with safe defaults.  This matches
    what they'd get with nir_ssa_def_init().

 3. Make the load_reg() helper automatically propagate divergence from
    the register.  Because the defaults for both nir_ssa_def_init() and
    nir_decl_reg() are to mark everything divergent, this only means
    that nir_load_reg() of a uniform reg is now uniform.

Putting all these together, nir_from_ssa should now be producing
load_reg intrinsics with the proper uniform information.

Fixes: 7229bffcb133 ("nir: Add intrinsics for register access")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24153>

11 months agopan/bi: Remove leftover include
Alyssa Rosenzweig [Tue, 18 Jul 2023 14:50:00 +0000 (10:50 -0400)]
pan/bi: Remove leftover include

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24153>

11 months agointel/compiler/test: fix crashes when TEST_DEBUG is set
Marcin Ślusarz [Fri, 23 Jun 2023 15:13:13 +0000 (17:13 +0200)]
intel/compiler/test: fix crashes when TEST_DEBUG is set

Dumping instructions requires that ISA info is not empty.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24274>

11 months agolavapipe: fixes indent of function lvp_inline_uniforms
Yonggang Luo [Thu, 29 Jun 2023 19:58:04 +0000 (03:58 +0800)]
lavapipe: fixes indent of function lvp_inline_uniforms

The indent fixes are in separate patch is for easier to review

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24316>

11 months agolavapipe: Convert to use nir_foreach_function_impl
Yonggang Luo [Thu, 29 Jun 2023 19:45:24 +0000 (03:45 +0800)]
lavapipe: Convert to use nir_foreach_function_impl

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24316>

11 months agozink: Convert to use nir_foreach_function_impl when possible
Yonggang Luo [Thu, 29 Jun 2023 19:15:21 +0000 (03:15 +0800)]
zink: Convert to use nir_foreach_function_impl when possible

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24316>

11 months agofreedreno: Switch to use nir_foreach_function_impl in tu_shader.cc
Yonggang Luo [Wed, 28 Jun 2023 11:07:12 +0000 (19:07 +0800)]
freedreno: Switch to use nir_foreach_function_impl in tu_shader.cc

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24316>

11 months agolima: Convert to use nir_foreach_function_impl when possible
Yonggang Luo [Thu, 29 Jun 2023 20:23:20 +0000 (04:23 +0800)]
lima: Convert to use nir_foreach_function_impl when possible

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24316>

11 months agorusticl/core: Make convert_spirv_to_nir output pair (KernelInfo, NirShader)
Antonio Gomes [Mon, 24 Jul 2023 14:51:40 +0000 (11:51 -0300)]
rusticl/core: Make convert_spirv_to_nir output pair (KernelInfo, NirShader)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl/core: Delete KernelDevState and KernelDevStateInner
Antonio Gomes [Sun, 23 Jul 2023 16:07:08 +0000 (13:07 -0300)]
rusticl/core: Delete KernelDevState and KernelDevStateInner

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl/program: New helper functions to NirKernelBuild
Antonio Gomes [Sun, 23 Jul 2023 16:34:04 +0000 (13:34 -0300)]
rusticl/program: New helper functions to NirKernelBuild

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl: Move NirKernelBuild to ProgramDevBuild
Antonio Gomes [Sun, 23 Jul 2023 16:02:21 +0000 (13:02 -0300)]
rusticl: Move NirKernelBuild to ProgramDevBuild

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl/compiler: Remove unnecessary functions
Antonio Gomes [Sun, 9 Jul 2023 19:38:23 +0000 (16:38 -0300)]
rusticl/compiler: Remove unnecessary functions

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl: Move Cso to Program
Antonio Gomes [Sun, 9 Jul 2023 19:50:20 +0000 (16:50 -0300)]
rusticl: Move Cso to Program

Commit got huge, but couldn't figure out a better way to split without
breaking stuff.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl/compiler: Add NirPrintfInfo
Antonio Gomes [Sun, 9 Jul 2023 19:28:03 +0000 (16:28 -0300)]
rusticl/compiler: Add NirPrintfInfo

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl/kernel: Add CsoWrapper
Antonio Gomes [Sat, 8 Jul 2023 18:29:27 +0000 (15:29 -0300)]
rusticl/kernel: Add CsoWrapper

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agorusticl/kernel: Removing unnecessary clone in kernel launch
Antonio Gomes [Tue, 2 May 2023 20:53:42 +0000 (17:53 -0300)]
rusticl/kernel: Removing unnecessary clone in kernel launch

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23898>

11 months agoci/freedreno: add a530 flake vs-lessthanequal-uvec4-uvec4
David Heidelberg [Tue, 25 Jul 2023 09:17:33 +0000 (11:17 +0200)]
ci/freedreno: add a530 flake vs-lessthanequal-uvec4-uvec4

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24314>

11 months agostate_tracker: fix dereference before null check
Illia Polishchuk [Mon, 8 May 2023 01:36:10 +0000 (04:36 +0300)]
state_tracker: fix dereference before null check

Coverity error
CID 1528178 (#1 of 1): Dereference before null check (REVERSE_INULL)

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20893>

11 months agoglx: fix dead code when gc var cannot be null due to earlier check
Illia Polishchuk [Mon, 8 May 2023 01:02:27 +0000 (04:02 +0300)]
glx: fix dead code when gc var cannot be null due to earlier check

CID 1528170 (#1 of 1): Logically dead code (DEADCODE)
At condition gc, the value of gc cannot be NULL.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20893>

11 months agos/Intel: fix/anv: fix: potentially overflowing expression in genX
Illia Polishchuk [Mon, 8 May 2023 00:56:53 +0000 (03:56 +0300)]
s/Intel: fix/anv: fix: potentially overflowing expression in genX

CID 1528164 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression
pool->n_passes * pool->khr_perf_preamble_stride with type
unsigned int (32 bits, unsigned) is evaluated using 32-bit arithmetic,
and then used in a context that expects an expression of type uint64_t (64 bits, unsigned).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20893>

11 months agoiris: remove NULL check for already dereferenced pointer earlier
Illia Polishchuk [Mon, 8 May 2023 00:46:05 +0000 (03:46 +0300)]
iris: remove NULL check for already dereferenced pointer earlier

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Found by Coverity.

CID: 1528158
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20893>

11 months agoi915: change format in dbg string
Illia Abernikhin [Sun, 15 Jan 2023 13:48:00 +0000 (15:48 +0200)]
i915: change format in dbg string
Actually, uintptr_t is of type unsigned long, but the
debug line uses the %d format specifier, which expects an int.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Illia Abernikhin <illia.abernikhin@globallogic.com>
Found by Coverity.

CID: 1515961
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20893>

11 months agostate_tracker: moving initialisation of whandle out from if statement
Illia Abernikhin [Tue, 15 Nov 2022 07:53:01 +0000 (09:53 +0200)]
state_tracker: moving initialisation of whandle out from if statement
whandle initialization inside if statement but used also outside

Signed-off-by: Illia Abernikhin <illia.abernikhin@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Found by Coverity.

CID: 1516746
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20893>

11 months agolavapipe: Advertise samplerYcbcrConversion
Konstantin Seurer [Sat, 22 Jul 2023 17:10:07 +0000 (19:10 +0200)]
lavapipe: Advertise samplerYcbcrConversion

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agolavapipe: Implement samplerYcbcrConversion
Konstantin Seurer [Sat, 22 Jul 2023 16:56:21 +0000 (18:56 +0200)]
lavapipe: Implement samplerYcbcrConversion

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agolavapipe: Fix binding immutable samplers with desc buffers
Konstantin Seurer [Sat, 22 Jul 2023 17:08:02 +0000 (19:08 +0200)]
lavapipe: Fix binding immutable samplers with desc buffers

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agolavapipe: Store immutable_samplers as lvp_sampler array
Konstantin Seurer [Sat, 22 Jul 2023 16:53:27 +0000 (18:53 +0200)]
lavapipe: Store immutable_samplers as lvp_sampler array

We will need this to access the ycbcr conversion.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agolavapipe: Remove dummy sampler ycbcr conversion
Konstantin Seurer [Sat, 22 Jul 2023 16:27:44 +0000 (18:27 +0200)]
lavapipe: Remove dummy sampler ycbcr conversion

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agogallivm: Ignore nir_tex_src_plane
Konstantin Seurer [Sat, 22 Jul 2023 17:08:44 +0000 (19:08 +0200)]
gallivm: Ignore nir_tex_src_plane

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agogallivm: Fix subsampled format sampling under Vulkan
Konstantin Seurer [Sun, 23 Jul 2023 10:32:26 +0000 (12:32 +0200)]
gallivm: Fix subsampled format sampling under Vulkan

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agodraw: Do not restart the primitive_id at 0
Konstantin Seurer [Sun, 23 Jul 2023 10:33:15 +0000 (12:33 +0200)]
draw: Do not restart the primitive_id at 0

Otherwise the primitive_id will wrap around to 0 if more than 4096
patches are drawn.

cc: mesa-stable

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>

11 months agoradv: pass submit info to radv_check_gpu_hangs()
Samuel Pitoiset [Tue, 25 Jul 2023 06:07:29 +0000 (08:07 +0200)]
radv: pass submit info to radv_check_gpu_hangs()

This will allow to dump preambles/postambles CS and eventually even
more CS.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24191>

11 months agoradv/amdgpu: rename old_ib to ib in radv_amdgpu_winsys_cs_dump()
Samuel Pitoiset [Tue, 25 Jul 2023 06:07:07 +0000 (08:07 +0200)]
radv/amdgpu: rename old_ib to ib in radv_amdgpu_winsys_cs_dump()

Forgot this variable when I renamed the ib_buffers array.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24191>

11 months agoradv/amdgpu: fix dumping CS with the chained IBs path
Samuel Pitoiset [Tue, 25 Jul 2023 06:06:45 +0000 (08:06 +0200)]
radv/amdgpu: fix dumping CS with the chained IBs path

ib_buffer is now NULL in both paths, and the first IB is the beginning
of the chain.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24191>

11 months agoradv: use next_stage for determining the stage to lower NGG
Samuel Pitoiset [Thu, 20 Jul 2023 15:31:55 +0000 (17:31 +0200)]
radv: use next_stage for determining the stage to lower NGG

If the next stage is FS, it's also the last VGT API stage.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>

11 months agoradv: simplify getting next VS stage for VS prologs
Samuel Pitoiset [Thu, 20 Jul 2023 15:11:50 +0000 (17:11 +0200)]
radv: simplify getting next VS stage for VS prologs

It's the VS shader info stage.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>

11 months agoradv: determine as_ls earlier by using the next stage
Samuel Pitoiset [Fri, 21 Jul 2023 09:10:37 +0000 (11:10 +0200)]
radv: determine as_ls earlier by using the next stage

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>

11 months agoradv: determine ES info for VS/TES with GS earlier
Samuel Pitoiset [Fri, 21 Jul 2023 08:54:40 +0000 (10:54 +0200)]
radv: determine ES info for VS/TES with GS earlier

By using the next stage, it's possible to compute these information
earlier without having to link shaders info.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>

11 months agoradv: use the number of GS linked inputs to compute the ESGS itemsize
Samuel Pitoiset [Fri, 21 Jul 2023 08:40:28 +0000 (10:40 +0200)]
radv: use the number of GS linked inputs to compute the ESGS itemsize

It's similar.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>

11 months agoradv: add a helper to compute the ESGS itemsize
Samuel Pitoiset [Fri, 21 Jul 2023 08:39:39 +0000 (10:39 +0200)]
radv: add a helper to compute the ESGS itemsize

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>

11 months agoradv: remove the pipeline dependency for creating a GS copy shader
Samuel Pitoiset [Fri, 21 Jul 2023 06:44:39 +0000 (08:44 +0200)]
radv: remove the pipeline dependency for creating a GS copy shader

This is unnecessary. While we are at it, stop passing the array of
shaders and use the GS stage only.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24273>

11 months agointel/common: Only set op mask on instructions in decoder
Jianxun Zhang [Fri, 21 Jul 2023 03:33:34 +0000 (20:33 -0700)]
intel/common: Only set op mask on instructions in decoder

When a default value of a struct's field, which is in the
higher half of the first dword, is specified in a gen xml
file, setting op mask makes decoder treat the field as a
header (intel_field_is_header()). As a result, it won't
output the field in batch dump. This is not a common case
but can happen once a gen xml file includes such fields.

The op mask is only meaningful to instructions, so we fix
the above issue by not setting op mask of structs (also
registers).

Signed-off-by: Jianxun Zhang <jianxun.zhang@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24268>

11 months agoiris: Handle clear color compatibility in prepare_render
Nanley Chery [Fri, 21 Apr 2023 21:34:48 +0000 (14:34 -0700)]
iris: Handle clear color compatibility in prepare_render

Before this patch, iris_resource_render_aux_usage would disable
compression when the clear color did not support format
reinterpretation.

With this patch, iris now replaces the clear color with zero and keeps
compression enabled. Disabling fast clears would be enough for most aux
usages, but replacement is also done to handle ISL_AUX_USAGE_FCV_CCS_E.

Note that this also fixes a bug. Format reinterpretation with
incompatible clear colors previously was not handled for the MCS aux
usages.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23676>

11 months agoiris: Create BLORP surfaces after resource preparation
Nanley Chery [Wed, 7 Jun 2023 19:49:31 +0000 (15:49 -0400)]
iris: Create BLORP surfaces after resource preparation

iris_resource_prepare_render will soon gain the ability to change a
resource's clear color. iris_blorp_surf_for_resource will keep a copy of
that clear color, so make sure calls to it happen after the render
preparation helper. At the moment, this shouldn't have an impact besides
improving debugging.

While we're here, do the same for the generic access preparation helper.
We may convert those to more specific helpers at a later time.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23676>

11 months agoiris: Pass the render format to prepare_render
Nanley Chery [Wed, 7 Jun 2023 18:47:10 +0000 (14:47 -0400)]
iris: Pass the render format to prepare_render

This will be used in an upcoming patch.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23676>

11 months agoiris: Reorder render_aux_usage parameters
Nanley Chery [Wed, 7 Jun 2023 19:39:27 +0000 (15:39 -0400)]
iris: Reorder render_aux_usage parameters

Match the order of the parameters for iris_resource_texture_aux_usage.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23676>

11 months agointel/blorp: Ambiguate after CCS resolves on gfx7-8
Nanley Chery [Tue, 13 Jun 2023 12:02:39 +0000 (08:02 -0400)]
intel/blorp: Ambiguate after CCS resolves on gfx7-8

ISL's state-machine of CCS_D describes full resolves as leaving the aux
buffer in the pass-through state. Hardware doesn't behave this way on
gfx8 however. On that platform, full resolves transition the aux buffer
to the resolved state. This was verified by dumping the CCS before and
after a full resolve on BDW (gfx7 is simply assumed to behave the same).
Ambiguate after resolving to match driver expectations.

Prevents iris from failing piglit's fcc-write-after-clear on BDW with a
future patch which relies on fast-clear encodings being removed after a
resolve. The avoided failure is:

   Testing implicit read of partial block UNORM -> SNORM
   Probe color at (0,1,0)
     Expected:  1.000000 1.000000 1.000000 1.000000
     Observed:  0.000000 0.000000 0.000000 0.000000

Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23676>

11 months agointel/fs: don't try to rebuild sequences of non ssa values
Lionel Landwerlin [Wed, 19 Jul 2023 06:22:59 +0000 (09:22 +0300)]
intel/fs: don't try to rebuild sequences of non ssa values

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 04777171e0 ("intel/fs: try to rematerialize surface computation code")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9378
Reviewed-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24228>

11 months agomeson: Ensure that LLVMSPIRVLib is not required for Clover
Caio Oliveira [Wed, 19 Jul 2023 21:57:03 +0000 (14:57 -0700)]
meson: Ensure that LLVMSPIRVLib is not required for Clover

Fixes: cb588d5d6ee ("compiler/clc: Move related NIR passes to the common mesa clc")
Closes: #9391
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24244>

11 months agoci/tgl: Improve the info for ANGLE's MSAA regression on TGL.
Emma Anholt [Tue, 18 Jul 2023 23:34:14 +0000 (16:34 -0700)]
ci/tgl: Improve the info for ANGLE's MSAA regression on TGL.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24200>

11 months agoci: Uprev ANGLE to 0518a3ff4d4e ("Android: Simplify power metrics collection")
Emma Anholt [Mon, 17 Jul 2023 19:26:09 +0000 (12:26 -0700)]
ci: Uprev ANGLE to 0518a3ff4d4e ("Android: Simplify power metrics collection")

There have been some fixes for our drivers that we'd like to bring in.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24200>

11 months agoci/radv: Clarify when the ANGLE GS failures started happening.
Emma Anholt [Mon, 17 Jul 2023 21:57:01 +0000 (14:57 -0700)]
ci/radv: Clarify when the ANGLE GS failures started happening.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24200>

11 months agoanv,hasvk,iris: sampler_prog_key::swizzles is only used on crocus
Faith Ekstrand [Fri, 21 Jul 2023 19:52:41 +0000 (14:52 -0500)]
anv,hasvk,iris: sampler_prog_key::swizzles is only used on crocus

The field is no longer consumed by brw_complie_* and is instead handled
directly by the crocus driver.  Therefore, it's safe to leave it zero
and not even bother setting it.  This removes our reliance on the
SWIZZLE_* macros in prog_instructions.h.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24288>

11 months agoetnaviv: nir: convert to new-style NIR registers
Christian Gmeiner [Tue, 18 Jul 2023 08:55:18 +0000 (10:55 +0200)]
etnaviv: nir: convert to new-style NIR registers

The initial plan was to use 'nir_legacy' helpers but it turns out
that our RA pass is hard to confince to be happy with it. So we are
useing the 'chasing' helpers now.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: nir: switch to etna_nir_lower_to_source_mods(..)
Christian Gmeiner [Tue, 18 Jul 2023 09:36:08 +0000 (11:36 +0200)]
etnaviv: nir: switch to etna_nir_lower_to_source_mods(..)

nir's source modifiers are going away soon and with it also the lowering
pass. Lets switch to our own lowering pass. We need to run our own
lowering pass almost at the end else opc_cse(..) etc. might do some
wrong needed opts as nir does not see our modifiers.

Also we need to remove the last nir_opt_dce(..) as it will remove not dead
code caused by the used load_const hack.

32    %15 = load_const (0x00000000 = 0.000000)
32     %4 = fabs %15 (0.000000)

nir_opt_dce is correct when it removes the two instructions. But in reality
the load_const is a uniform that should not be removed.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: nir: add etna_nir_lower_to_source_mods(..)
Christian Gmeiner [Wed, 19 Jul 2023 08:41:16 +0000 (10:41 +0200)]
etnaviv: nir: add etna_nir_lower_to_source_mods(..)

This is more or less a copy of nir_lower_to_source_mods(..) with
the following differences:

 - we store the source mods in pass_flags
 - we do not try to saturate the destination

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: nir: look at parent instr in lower_alu(..)
Christian Gmeiner [Wed, 19 Jul 2023 15:26:16 +0000 (17:26 +0200)]
etnaviv: nir: look at parent instr in lower_alu(..)

When we switch to our own lower_to_source_mods pass we will start
to see such patterns:

32x4  %18 = fneg %5 (-5.125000, -30.000000, 5.500000, -6.500000)
32x4  %19 = ffma %18, %8, %4 (-6.500000, -7.750000, 6.500000, 6.000000)

This is a problem as we will generate instruction that accesses two
different uniforms, which is a problem on GPUs where has_no_oneconst_limit
is false.

Make lower_alu(..) smarter by looking in the parent for for the constant
value.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: do not clear all pass_flags before RA
Christian Gmeiner [Wed, 19 Jul 2023 08:45:59 +0000 (10:45 +0200)]
etnaviv: do not clear all pass_flags before RA

We only need to clear the 'dead' bits. The others are
used for source mods.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: extend etna_pass_flags with source modifiers
Christian Gmeiner [Wed, 19 Jul 2023 08:35:39 +0000 (10:35 +0200)]
etnaviv: extend etna_pass_flags with source modifiers

As nir_lower_to_source_mods(..) will be deleted and with it the modifier storage
in nir's core we need to find an other way store the information.

We have have 6 bits left in nir's pass_flags - so lets go that route.

This also adds some small helpers that will be used later.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: add is_dead_instruction(..) helper
Christian Gmeiner [Wed, 19 Jul 2023 07:57:10 +0000 (09:57 +0200)]
etnaviv: add is_dead_instruction(..) helper

As we are going to extend the enum etna_pass_flags it makes sense
to add a small helper to test if an instruction is dead. An instruction
is dead if BYPASS_DST or BYPASS_SRC is set.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: name the enum used for pass_flags
Christian Gmeiner [Wed, 19 Jul 2023 07:52:27 +0000 (09:52 +0200)]
etnaviv: name the enum used for pass_flags

This enum is used for the pass_flags that can be set on a
nir_instr. Name it to make the intention of its usage clear.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agoetnaviv: make use of BITFIELD_BIT(..) macro
Christian Gmeiner [Wed, 19 Jul 2023 07:46:03 +0000 (09:46 +0200)]
etnaviv: make use of BITFIELD_BIT(..) macro

It helps to make the code easier to read.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24216>

11 months agofrontends/va: Add YUV420 to NV12 postproc conversion
David Rosca [Fri, 21 Jul 2023 09:05:35 +0000 (11:05 +0200)]
frontends/va: Add YUV420 to NV12 postproc conversion

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7853
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24272>

11 months agogallium/auxiliary/vl: Fix blurry output of compute_shader_yuv
David Rosca [Thu, 20 Jul 2023 19:40:27 +0000 (21:40 +0200)]
gallium/auxiliary/vl: Fix blurry output of compute_shader_yuv

There is a linear sampler used, so add half texel offset
to avoid undesirable blur when input and output resolutions
are the same.

Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24272>

11 months agogallium/auxiliary/vl: Handle UV subsampling in compute_shader_yuv
David Rosca [Thu, 20 Jul 2023 16:02:08 +0000 (18:02 +0200)]
gallium/auxiliary/vl: Handle UV subsampling in compute_shader_yuv

Also remove the 1px vertical shift as it results
in a black line at the bottom of the picture.

Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24272>

11 months agoaco: improve get_gfx11_true16_mask description
Georg Lehmann [Mon, 24 Jul 2023 11:57:16 +0000 (13:57 +0200)]
aco: improve get_gfx11_true16_mask description

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24294>

11 months agoaco/gfx11: fix get_gfx11_true16_mask with v_cmp_class_f16
Georg Lehmann [Sat, 22 Jul 2023 21:17:45 +0000 (23:17 +0200)]
aco/gfx11: fix get_gfx11_true16_mask with v_cmp_class_f16

The second operand is 16bit, so the we need to use VOP3 to address v128-v255.

Closes: #9413
Fixes: 6872f8d861b ("aco/gfx11: allow true 16-bit instructions to access v128+")
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24294>

11 months agonir/tests: add nir_opt_dead_cf_test.jump_before_constant_if
Rhys Perry [Mon, 24 Jul 2023 11:02:48 +0000 (12:02 +0100)]
nir/tests: add nir_opt_dead_cf_test.jump_before_constant_if

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24235>

11 months agonir/opt_dead_cf: remove nodes after a jump earlier
Rhys Perry [Wed, 19 Jul 2023 13:05:11 +0000 (14:05 +0100)]
nir/opt_dead_cf: remove nodes after a jump earlier

In the case of:
   halt
   // succs: b9
   if %618 {
       block b3:// preds:
       break
       // succs: b6
   } else {
       block b4:  // preds: , succs: b5
   }
   block b5:    // preds: b4
   32    %556 = iadd %617, %2 (0x1)
opt_constant_if() doesn't work because stitch_blocks() can't join blocks if the
before ends in a jump and the after isn't empty.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24235>

11 months agonir/tests: Use a single binary
Konstantin Seurer [Thu, 20 Jul 2023 08:35:09 +0000 (10:35 +0200)]
nir/tests: Use a single binary

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24249>

11 months agonir/tests: Refactor boilerplate into a common header
Konstantin Seurer [Thu, 20 Jul 2023 08:33:52 +0000 (10:33 +0200)]
nir/tests: Refactor boilerplate into a common header

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24249>

11 months agotu,freedreno: Forbid blit event for R8G8_SRGB due to gpu faults
Danylo Piliaiev [Fri, 21 Jul 2023 11:27:38 +0000 (13:27 +0200)]
tu,freedreno: Forbid blit event for R8G8_SRGB due to gpu faults

Same cause as for other R8G8 formats - msaa resolve via
blit event causes gpu fault.

Fixes:
 dEQP-VK.api.image_clearing.*.clear_color_attachment.*.r8g8_srgb_*

Fixes: 029919f3c83f379065515708188d5c439c3fa6bc
("tu: allow using resolve engine for SRGB MSAA resolves")

Cc: mesa-stable
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24277>

11 months agopanvk: Use 1.0 in ICD Manifest json
Charles Giessen [Fri, 21 Jul 2023 20:28:13 +0000 (20:28 +0000)]
panvk: Use 1.0 in ICD Manifest json

PanVK downgraded from supporting Vulkan 1.1 to 1.0, but did not change
their ICD Manifest api_version to reflect that. This cause the Vulkan-Loader
to interpret the ICD as a 1.1 driver erroneously. Originally discussed in this
issue https://github.com/KhronosGroup/Vulkan-Loader/issues/1242

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24289>

11 months agointel/compiler: load debug mesh compaction options once
Marcin Ślusarz [Fri, 21 Jul 2023 09:50:51 +0000 (11:50 +0200)]
intel/compiler: load debug mesh compaction options once

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20407>

11 months agointel/compiler,anv: put some vertex and primitive data in headers
Marcin Ślusarz [Wed, 21 Dec 2022 14:42:55 +0000 (15:42 +0100)]
intel/compiler,anv: put some vertex and primitive data in headers

Both per-primitive and per-vertex space is allocated in MUE in 8 dword
chunks and those 8-dword chunks (granularity of
3DSTATE_SBE_MESH.Per[Primitive|Vertex]URBEntryOutputReadLength)
are passed to fragment shaders as inputs (either non-interpolated
for per-primitive and flat vertex attributes or interpolated
for non-flat vertex attributes).

Some attributes have a special meaning and must be placed in separate
8/16-dword slot called Primitive Header or Vertex Header.

Primitive Header contains 4 such attributes (Cull Primitive,
ViewportIndex, RTAIndex, CPS), leaving 4 dwords (the rest of 8-dword
slot) potentially unused.

Vertex Header is similar - it starts with 3 unused dwords, 1 dword for
Point Size (but if we declare that shader doesn't produce Point Size
then we can reuse it), followed by 4 dwords for Position and optionally
8 dwords for clip distances.

This means we have an interesting optimization problem - we can put
some user attributes into holes in Primitive and Vertex Headers, which
may lead to smaller MUE size and potentially more mesh threads running
in parallel, but we have to be careful to use those holes only when
we need it, otherwise we could force HW to pass too much data to
fragment shader.

Example 1:
Let's assume that Primitive Header is enabled and user defined
12 dwords of per-primitive attributes.

Without packing we would consume 8 + ALIGN(12, 8) = 24 dwords of
MUE space and pass ALIGN(12, 8) = 16 dwords to fragment shader.

With packing, we'll consume 4 + 4 + ALIGN(12 - 4, 8) = 16 dwords of
MUE space and pass ALIGN(4, 8) + ALIGN(12 - 4, 8) = 16 dwords to
fragment shader.

16/16 is better than 24/16, so packing makes sense.

Example 2:
Now let's assume that Primitive Header is enabled and user defined
16 dwords of per-primitive attributes.

Without packing we would consume 8 + ALIGN(16, 8) = 24 dwords of
MUE space and pass ALIGN(16, 16) = 16 dwords to fragment shader.

With packing, we'll consume 4 + 4 + ALIGN(16 - 4, 8) = 24 dwords of
MUE space and pass ALIGN(4, 8) + ALIGN(16 - 4, 8) = 24 dwords to
fragment shader.

24/24 is worse than 24/16, so packing doesn't make sense.

This change doesn't affect vk_meshlet_cadscene in default configuration,
but it speeds it up by up to 25% with "-extraattributes N", where
N is some small value divisible by 2 (by default N == 1) and we
are bound by URB size.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20407>

11 months agointel/compiler/mesh: compactify MUE layout
Marcin Ślusarz [Wed, 21 Dec 2022 14:40:07 +0000 (15:40 +0100)]
intel/compiler/mesh: compactify MUE layout

Instead of using 4 dwords for each output slot, use only the amount
of memory actually needed by each variable.

There are some complications from this "obvious" idea:
- flat and non-flat variables can't be merged into the same vec4 slot,
  because flat inputs mask has vec4 stride
- multi-slot variables can have different layout:
   float[N] requires N 1-dword slots, but
   i64vec3 requires 1 fully occupied 4-dword slot followed by 2-dword slot
- some output variables occur both in single-channel/component split
  and combined variants
- crossing vec4 boundary requires generating more writes, so avoiding them
  if possible is beneficial

This patch fixes some issues with arrays in per-vertex and per-primitive data
(func.mesh.ext.outputs.*.indirect_array.q0 in crucible)
and by reduction in single MUE size it allows spawning more threads at
the same time.

Note: this patch doesn't improve vk_meshlet_cadscene performance because
default layout is already optimal enough.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20407>

11 months agoradv: add radv_compile_cs() to compile a compute shader
Samuel Pitoiset [Fri, 21 Jul 2023 12:19:28 +0000 (14:19 +0200)]
radv: add radv_compile_cs() to compile a compute shader

This doesn't rely on the pipeline.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24280>

11 months agoradv: stop using an array of binaries when compiling a compute shader
Samuel Pitoiset [Fri, 21 Jul 2023 12:28:06 +0000 (14:28 +0200)]
radv: stop using an array of binaries when compiling a compute shader

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24280>

11 months agoRevert "intel/ci: disable iris-jsl-deqp because it always fails for an AMD MR"
Zhang Ning [Sun, 18 Jun 2023 01:12:16 +0000 (09:12 +0800)]
Revert "intel/ci: disable iris-jsl-deqp because it always fails for an AMD MR"

This reverts commit da4b5b4a47ca727a7c8892d2bea50739df3b94ed.

Signed-off-by: Zhang Ning <zhangn1985@outlook.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23815>

11 months agonir/opt_copy_prop_vars: drop reuse of dynamic arrays
Timothy Arceri [Tue, 18 Jul 2023 06:28:30 +0000 (16:28 +1000)]
nir/opt_copy_prop_vars: drop reuse of dynamic arrays

After the previous commit there are so few to reuse that this is no
longer worth doing and actually causes compilation to slow down.

The Blender shader compile time in issue #9326 improves as folows:
21.11 seconds -> 9.90 seconds

The CTS test dEQP-GLES31.functional.ubo.random.all_per_block_buffers.20
improves as follows:

0.92 seconds -> 0.68 seconds

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9326

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24227>

11 months agonir/opt_copy_prop_vars: skip cloning of copies arrays until needed
Timothy Arceri [Thu, 13 Jul 2023 11:12:32 +0000 (21:12 +1000)]
nir/opt_copy_prop_vars: skip cloning of copies arrays until needed

Most of the variables in the hash table will never actually be looked up
for any given block so cloning every possible value just creates a bunch
of unrequired memcpy calls.

Here we change the code to only clone the copies array once it is
actually looked up for the first time.

The Blender shader compile time in issue #9326 improves as folows:
151.09 seconds -> 21.11 seconds

The CTS test dEQP-GLES31.functional.ubo.random.all_per_block_buffers.20
improves as follows:

1.67 seconds -> 0.92 seconds

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24227>

11 months agonir/opt_copy_prop_vars: remove var hash entry on kill alias
Timothy Arceri [Wed, 12 Jul 2023 06:15:29 +0000 (16:15 +1000)]
nir/opt_copy_prop_vars: remove var hash entry on kill alias

If kill alias results in the hash table entry holding an empty
copies array then remove the hash entry and return the dynamic array
to the unused pool.

This helps avoid hash table size getting out of control in very large
shaders.

151.09 seconds -> 118.60 seconds

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24227>

11 months agonir/opt_copy_prop_vars: speedup cloning of copy tables
Timothy Arceri [Wed, 12 Jul 2023 06:34:11 +0000 (16:34 +1000)]
nir/opt_copy_prop_vars: speedup cloning of copy tables

Here we change things to simply clone the entire hash table. This
is much faster than trying to rebuild it and is needed to avoid
slow compilation of very large shaders.

The Blender shader compile time in issue #9326 improves as folows:
251.29 seconds -> 151.09 seconds

The CTS test dEQP-GLES31.functional.ubo.random.all_per_block_buffers.20
improves as follows:

2.38 seconds -> 1.67 seconds

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24227>

11 months agonir/opt_copy_prop_vars: don't clone copies if branch empty
Timothy Arceri [Tue, 11 Jul 2023 03:21:57 +0000 (13:21 +1000)]
nir/opt_copy_prop_vars: don't clone copies if branch empty

There is no point doing an expensive clone of the copies if the
if-branch is empty.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24227>

11 months agoradeonsi: enable aco compile for mono merged ES/GS
Qiang Yu [Thu, 6 Jul 2023 02:39:33 +0000 (10:39 +0800)]
radeonsi: enable aco compile for mono merged ES/GS

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/24204>

11 months agoradeonsi: enable aco compile for mono merged LS/HS
Qiang Yu [Thu, 6 Jul 2023 02:36:48 +0000 (10:36 +0800)]
radeonsi: enable aco compile for mono merged LS/HS

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/24204>

11 months agoradeonsi: calculate lds size for merged shaders
Qiang Yu [Mon, 17 Jul 2023 14:27:35 +0000 (22:27 +0800)]
radeonsi: calculate lds size for merged shaders

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/24204>

11 months agoradeonsi: aco compile support merged mono shader
Qiang Yu [Thu, 6 Jul 2023 02:27:02 +0000 (10:27 +0800)]
radeonsi: aco compile support merged mono shader

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/24204>

11 months agoradeonsi: refine si_llvm_es_build_end
Qiang Yu [Wed, 12 Jul 2023 07:34:03 +0000 (15:34 +0800)]
radeonsi: refine si_llvm_es_build_end

1. merge si_set_es_return_value_for_gs into si_llvm_es_build_end
2. stop return value when mono mode in which case GS use ES input as
   input instead of ES output

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/24204>

11 months agoradeonsi: refine si_llvm_ls_build_end
Qiang Yu [Wed, 12 Jul 2023 07:21:43 +0000 (15:21 +0800)]
radeonsi: refine si_llvm_ls_build_end

1. merge si_set_ls_return_value_for_tcs into si_llvm_ls_build_end because they
   do the same job to return value
2. stop return value when mono mode with different thread count, in which case
   TCS use LS input as its input instead of LS output
3. use si_insert_input_ret_float

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/24204>

11 months agoradeonsi: remove param type check in wrapper function
Qiang Yu [Tue, 11 Jul 2023 10:08:19 +0000 (18:08 +0800)]
radeonsi: remove param type check in wrapper function

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/24204>

11 months agoradeonsi: move vertex shader vb desc input sgpr args to last
Qiang Yu [Thu, 6 Jul 2023 13:35:05 +0000 (21:35 +0800)]
radeonsi: move vertex shader vb desc input sgpr args to last

ACO use same args for merged shader stages, but vb desc input sgpr args
is not present when second stage of merged shader. In order to share
same shaders args, move it to last so other args have same index.

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/24204>

11 months agoradeonsi: simplify si_build_wrapper_function
Qiang Yu [Tue, 11 Jul 2023 09:56:29 +0000 (17:56 +0800)]
radeonsi: simplify si_build_wrapper_function

We only need it to merge LS/HS or ES/GS now, prolog and epilog have
been lowered in nir already. So we just need to handle two parts and
they are sure to be first and second stage of a merged shader.

This also remove the needs SGPRs must be before VGPRs, which is required
by following commits to move some SGPRs after VGPRs.

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/24204>

11 months agoradeonsi: init aco shader info for merged LS/HS
Qiang Yu [Thu, 6 Jul 2023 07:11:57 +0000 (15:11 +0800)]
radeonsi: init aco shader info for merged LS/HS

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/24204>