platform/upstream/mesa.git
21 months agogallivm: Fix LLVMAtomicRMWBinOpFMax spelling
Michel Dänzer [Tue, 20 Sep 2022 12:24:51 +0000 (14:24 +0200)]
gallivm: Fix LLVMAtomicRMWBinOpFMax spelling

Fixes build with LLVM >= 15.

Fixes: 203920d4c693 ("gallivm: add atomic 32-bit float support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18701>

21 months agoci/nouveau: Update gm20b xfails.
Emma Anholt [Sun, 18 Sep 2022 20:55:19 +0000 (13:55 -0700)]
ci/nouveau: Update gm20b xfails.

Similar set of skips as gk20a, so we can find any remaining flakes given
the firehose of SSBOs and geom/tess flakes.

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

21 months agoci/nouveau: fix up Jetson Nano
Emma Anholt [Sat, 17 Sep 2022 04:40:46 +0000 (21:40 -0700)]
ci/nouveau: fix up Jetson Nano

The updated board has a stabilized GPU and now I just need to decide if
I'm building a farm of them or not.  The new firmware flash needs a
reminder to the kernel of how to do NFS (no v2, thanks).  Also, the full
run is long and we need the TEST_PHASE_TIMEOUT variable to go past 20
minutes now.

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

21 months agoci/nouveau: Rearrange job setup variables.
Emma Anholt [Sun, 18 Sep 2022 18:10:40 +0000 (11:10 -0700)]
ci/nouveau: Rearrange job setup variables.

Now there's "generic stuff for nouveau with bare metal", "the two board
types and how to use them", and "the specific jobs for those boards."

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

21 months agoci/nouveau: Drop BM_POE_TIMEOUT.
Emma Anholt [Sun, 18 Sep 2022 18:05:01 +0000 (11:05 -0700)]
ci/nouveau: Drop BM_POE_TIMEOUT.

Unused since 5f09b1ebe988 ("ci/bare-metal: Add test phase timeouts to all
boards.").

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

21 months agoegl: Return EGL_BAD_MATCH for invalid share_list
Michael Skorokhodov [Fri, 6 May 2022 09:28:21 +0000 (12:28 +0300)]
egl: Return EGL_BAD_MATCH for invalid share_list

From the eglspec.1.5: "An EGL_BAD_MATCH is generated if [...]
share context was created on a different display than
the one referenced by config."

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6414
Signed-off-by: Mykhailo Skorokhodov<mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16368>

21 months agoradv: Correct accel struct header size
Friedrich Vock [Mon, 19 Sep 2022 17:42:37 +0000 (19:42 +0200)]
radv: Correct accel struct header size

The size was changed when adding metadata but not updated here.

Fixes: 07eceb4f ("radv: Add metadata to acceleration structures")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18680>

21 months agor300: reduce CPU overhead in IF transformation pass
Pavel Ondračka [Mon, 19 Sep 2022 12:34:28 +0000 (14:34 +0200)]
r300: reduce CPU overhead in IF transformation pass

Right now there is a call to rc_get_variables, which performs a global
analysis of the whole shader, for every IF encountered. As a result,
shaders with a lot of IFs are compiled very slowly. The patological
cases are shaders using relative adressing, where the lowered array
access can result in tens of IFs.

This patch restructures the pass to call the rc_get_variables just once
at the beginning and later reuse the gathered info. We can do this,
because even though we transform the shader in the meantime (like for
example adding extra MOVs) the transformations are not siginificant
enough to influence the relevant variable info we are using.

This reduces CPU time for my shader-db by more than a half. I also
checked that the generated code for all shaders in shader-db is
identical.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18678>

21 months agoradv,aco: do not compact MRTs if the pipeline uses a PS epilog
Samuel Pitoiset [Tue, 13 Sep 2022 12:54:46 +0000 (14:54 +0200)]
radv,aco: do not compact MRTs if the pipeline uses a PS epilog

We can't detect color attachment without exports when compiling a PS
epilog, so we can't compact MRTs.

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

21 months agov3dv: fix VK_EXT_texel_buffer_alignment
Iago Toral Quiroga [Tue, 20 Sep 2022 08:48:19 +0000 (10:48 +0200)]
v3dv: fix VK_EXT_texel_buffer_alignment

This extension was promoted to Vulkan 1.3 so we should be setting its
properties directly in the VkPhysicalDeviceVulkan13Properties struct
which the common mesa code will use to populate outgoing properties.

Apparently, only the properties struct was promoted and not the features
struct.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Tested-by: Eric Engestrom <eric@igalia.com>
Fixes: ee62a4c751c ('v3dv: implement VK_EXT_texel_buffer_alignment')
Fixes: dEQP-VK.api.info.get_physical_device_properties2.properties.basic
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18697>

21 months agoaco: DCE ra_ctx::defs_done
Rhys Perry [Mon, 12 Sep 2022 11:11:09 +0000 (12:11 +0100)]
aco: DCE ra_ctx::defs_done

This was used to distinguish definitions fixed before and during RA, but
it seems it isn't used anymore.

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

21 months agoradv: allow to build the main FS in a graphics pipeline library
Samuel Pitoiset [Fri, 9 Sep 2022 09:35:55 +0000 (11:35 +0200)]
radv: allow to build the main FS in a graphics pipeline library

Corner cases like implicit gl_PrimitiveID are currently broken and
will be fixed later, but the general case should work.

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

21 months agoradv: do not link shaders when the next stage is unknown
Samuel Pitoiset [Thu, 1 Sep 2022 08:16:11 +0000 (10:16 +0200)]
radv: do not link shaders when the next stage is unknown

With GPL, it's possible to build the pre-rasterization stages separately
from the fragment stage. Implicit IO (like gl_PrimitiveID) between the
last pre-rast stage and the FS will be addressed later.

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

21 months agonir, anv, hasvk, radv: pull uses_wide_subgroup_intrinsics into shader_info
Marcin Ślusarz [Mon, 19 Sep 2022 10:55:19 +0000 (12:55 +0200)]
nir, anv, hasvk, radv: pull uses_wide_subgroup_intrinsics into shader_info

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18504>

21 months agoanv: small cleanup of anv_graphics_pipeline_compile
Marcin Ślusarz [Mon, 19 Sep 2022 10:41:09 +0000 (12:41 +0200)]
anv: small cleanup of anv_graphics_pipeline_compile

Extract variables for things that are computed multiple times.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18504>

21 months agoanv: add support for anv_assume_full_subgroups to task & mesh stages
Marcin Ślusarz [Wed, 31 Aug 2022 12:28:04 +0000 (14:28 +0200)]
anv: add support for anv_assume_full_subgroups to task & mesh stages

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18504>

21 months agonir: add uses_wide_subgroup_intrinsics to task/mesh shader_info
Marcin Ślusarz [Wed, 31 Aug 2022 12:26:58 +0000 (14:26 +0200)]
nir: add uses_wide_subgroup_intrinsics to task/mesh shader_info

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18504>

21 months agoradv,aco: lower barycentric_at_sample in NIR
Samuel Pitoiset [Thu, 15 Sep 2022 12:58:51 +0000 (14:58 +0200)]
radv,aco: lower barycentric_at_sample in NIR

fossils-db (NAVI21):
Totals from 158 (0.12% of 134913) affected shaders:
CodeSize: 569456 -> 568824 (-0.11%)

Only Control seems affected.

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

21 months agoradv: run nir_opt_cse before lowering FS intrinsics
Samuel Pitoiset [Thu, 15 Sep 2022 12:56:28 +0000 (14:56 +0200)]
radv: run nir_opt_cse before lowering FS intrinsics

Otherwise, there might be redundant barycentric_at_sample intrinsics
that will be lowered and this will increase code size.

No fossils-db changes.

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

21 months agoradv: add nir_intrinsic_load_sample_positions_amd in the ABI
Samuel Pitoiset [Thu, 15 Sep 2022 12:55:59 +0000 (14:55 +0200)]
radv: add nir_intrinsic_load_sample_positions_amd in the ABI

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

21 months agonir: add nir_intrinsic_load_sample_positions_amd
Samuel Pitoiset [Thu, 15 Sep 2022 12:55:10 +0000 (14:55 +0200)]
nir: add nir_intrinsic_load_sample_positions_amd

This will be used to lower barycentric_at_sample in NIR for RADV.

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

21 months agoac/surface: Fix some warnings.
Bas Nieuwenhuizen [Tue, 20 Sep 2022 00:37:39 +0000 (02:37 +0200)]
ac/surface: Fix some warnings.

../mesa/src/amd/common/ac_surface.c:2324:48: warning: implicit conversion from enumeration type 'AddrResourceType' (aka 'enum _AddrResourceType') to different enumeration type 'enum gfx9_resource_type' [-Wenum-conversion]
   surf->u.gfx9.resource_type = AddrSurfInfoIn.resourceType;
                              ~ ~~~~~~~~~~~~~~~^~~~~~~~~~~~
../mesa/src/amd/common/ac_surface.c:3046:38: warning: implicit conversion from enumeration type 'const enum gfx9_resource_type' to different enumeration type 'AddrResourceType' (aka 'enum _AddrResourceType') [-Wenum-conversion]
   input.resourceType = surf->u.gfx9.resource_type;
                      ~ ~~~~~~~~~~~~~^~~~~~~~~~~~~
../mesa/src/amd/common/ac_surface.c:3069:38: warning: implicit conversion from enumeration type 'const enum gfx9_resource_type' to different enumeration type 'AddrResourceType' (aka 'enum _AddrResourceType') [-Wenum-conversion]
   input.resourceType = surf->u.gfx9.resource_type;

The enums are compatible so lets just add some casts.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18694>

21 months agoclover: Fixes use of designated initializers requires in c++ that doesn't support...
Yonggang Luo [Mon, 19 Sep 2022 18:44:30 +0000 (02:44 +0800)]
clover: Fixes use of designated initializers requires in c++ that doesn't support by MSVC

../src/gallium/frontends/clover/nir/invocation.cpp(400): error C7555: use of designated initializers requires at least '/std:c++20'

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18683>

21 months agov3dv: optimize ldunif load into unifa write
Iago Toral Quiroga [Fri, 16 Sep 2022 09:44:25 +0000 (11:44 +0200)]
v3dv: optimize ldunif load into unifa write

If we emit a ldunif to load the ubo/ssbo base address and
then we are immediately moving it to the unifa register we
can have the ldunif write directly to unifa and avoid the mov
in between, which won't be done by copy propagation because that
only works with temp registers.

Also, since we can't read from unifa we must be careful to disallow
reuse of the ldunif result for a future ldunif of the same base address.
We do that by only reusing ldunif results from temp registers.

total instructions in shared programs: 12468943 -> 12455139 (-0.11%)
instructions in affected programs: 1661233 -> 1647429 (-0.83%)
helped: 8307
HURT: 3994

total uniforms in shared programs: 3704532 -> 3704522 (<.01%)
uniforms in affected programs: 339 -> 329 (-2.95%)
helped: 7
HURT: 0

total max-temps in shared programs: 2148158 -> 2148290 (<.01%)
max-temps in affected programs: 9320 -> 9452 (1.42%)
helped: 175
HURT: 295

total spills in shared programs: 2202 -> 2202 (0.00%)
spills in affected programs: 0 -> 0
helped: 0
HURT: 0

total fills in shared programs: 3059 -> 3057 (-0.07%)
fills in affected programs: 27 -> 25 (-7.41%)
helped: 1
HURT: 0

total sfu-stalls in shared programs: 21167 -> 21056 (-0.52%)
sfu-stalls in affected programs: 497 -> 386 (-22.33%)
helped: 209
HURT: 127

total inst-and-stalls in shared programs: 12490110 -> 12476195 (-0.11%)
inst-and-stalls in affected programs: 1662875 -> 1648960 (-0.84%)
helped: 8312
HURT: 3987

total nops in shared programs: 316563 -> 313553 (-0.95%)
nops in affected programs: 24269 -> 21259 (-12.40%)
helped: 2158
HURT: 1006

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18667>

21 months agobroadcom/compiler: check signal writes to magic regs when updating scoreboard
Iago Toral Quiroga [Fri, 16 Sep 2022 09:42:50 +0000 (11:42 +0200)]
broadcom/compiler: check signal writes to magic regs when updating scoreboard

We have only been checking magic writes from ADD and MUL ports, but signals
can potentially write to magic registers too.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18667>

21 months agobroadcom/compiler: detect unifa write from signal
Iago Toral Quiroga [Mon, 19 Sep 2022 06:54:04 +0000 (08:54 +0200)]
broadcom/compiler: detect unifa write from signal

It is possible for some signals to write to unifa directly. We will
enable this from ldunif shortly so we should check for it here.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18667>

21 months agoradv: Use count_tes_user_sgprs return value.
Vinson Lee [Sun, 18 Sep 2022 22:39:37 +0000 (15:39 -0700)]
radv: Use count_tes_user_sgprs return value.

Fix defect reported by Coverity Scan.

Useless call (USELESS_CALL)
side_effect_free: Calling count_tes_user_sgprs(key) is only useful for
its return value, which is ignored.

Fixes: 8253ec3855a ("radv: add shader arguments for dynamic patch control points")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18659>

21 months agoradeonsi: print out remove_streamout shader key
Qiang Yu [Fri, 29 Jul 2022 03:23:22 +0000 (11:23 +0800)]
radeonsi: print out remove_streamout shader key

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17456>

21 months agoradeonsi: implement nir_intrinsic_load_streamout_buffer_amd
Qiang Yu [Thu, 30 Jun 2022 09:50:47 +0000 (17:50 +0800)]
radeonsi: implement nir_intrinsic_load_streamout_buffer_amd

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17456>

21 months agoradeonsi: implement nir_intrinsic_load_num_vertices_per_primitive_amd
Qiang Yu [Thu, 30 Jun 2022 09:28:46 +0000 (17:28 +0800)]
radeonsi: implement nir_intrinsic_load_num_vertices_per_primitive_amd

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17456>

21 months agoradeonsi: set VS_OUT_MISC_SIDE_BUS_ENA=1 for clip distance exports on gfx10.3
Marek Olšák [Mon, 12 Sep 2022 16:48:28 +0000 (12:48 -0400)]
radeonsi: set VS_OUT_MISC_SIDE_BUS_ENA=1 for clip distance exports on gfx10.3

This should improve performance of clip distances.

Reviewed-by: Pierre-eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18639>

21 months agoanv: remove vk_sample_locations_state from emit_multisample
Tapani Pälli [Mon, 19 Sep 2022 12:52:38 +0000 (15:52 +0300)]
anv: remove vk_sample_locations_state from emit_multisample

State for sample locations is not used within this function.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18669>

21 months agofrontends/va: enable sao in hevc encoding
Ruijing Dong [Fri, 16 Sep 2022 00:57:52 +0000 (20:57 -0400)]
frontends/va: enable sao in hevc encoding

enable sao feature from config attribute. by default
from vcn2, hevc encoding enables sao.

Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18626>

21 months agofreedreno/a6xx: Simplify fd6_build_user_consts()
Rob Clark [Sun, 18 Sep 2022 18:42:11 +0000 (11:42 -0700)]
freedreno/a6xx: Simplify fd6_build_user_consts()

Get rid of the table indirects.  Cuts in half the time spent in this fxn
in drawoverhead test 31 ("many uniforms / 1 changemany uniforms / 1
change")

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/a6xx: Move user const upload to bind
Rob Clark [Sun, 18 Sep 2022 18:34:33 +0000 (11:34 -0700)]
freedreno/a6xx: Move user const upload to bind

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno: Drop unused arg
Rob Clark [Sun, 18 Sep 2022 18:17:17 +0000 (11:17 -0700)]
freedreno: Drop unused arg

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/a6xx: Pre-calculate user const state size
Rob Clark [Sun, 18 Sep 2022 17:28:36 +0000 (10:28 -0700)]
freedreno/a6xx: Pre-calculate user const state size

We can do this when we construct the program state object, rather than
at draw time.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/a6xx: Skip IBO state when unused
Rob Clark [Sun, 18 Sep 2022 17:07:34 +0000 (10:07 -0700)]
freedreno/a6xx: Skip IBO state when unused

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/drm: Simplify emit_reloc_common
Rob Clark [Sat, 17 Sep 2022 20:05:18 +0000 (13:05 -0700)]
freedreno/drm: Simplify emit_reloc_common

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/a6xx: Drop "hardpin" support
Rob Clark [Thu, 4 Aug 2022 22:58:15 +0000 (15:58 -0700)]
freedreno/a6xx: Drop "hardpin" support

The upstream kernel supported everything needed to stop doing
kernel-side relocs before the first things with a6xx were fully
supported in upstream kernel.  Take advantage to drop some extra
overhead in OUT_RELOC() and equiv in the pack macros.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/drm: Add fd_ringbuffer_attach_bo()
Rob Clark [Thu, 4 Aug 2022 22:41:53 +0000 (15:41 -0700)]
freedreno/drm: Add fd_ringbuffer_attach_bo()

Which does only the bo bookkeeping and skips all the extra legacy reloc
related overhead.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/drm: Inline fd_bo_get_iova()
Rob Clark [Thu, 4 Aug 2022 22:29:33 +0000 (15:29 -0700)]
freedreno/drm: Inline fd_bo_get_iova()

The struct body was originally hidden to avoid it being part of the ABI
between libdrm_freedreno and mesa.  But that is no longer a problem.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno/ir3: GC unused macro
Rob Clark [Fri, 5 Aug 2022 16:40:31 +0000 (09:40 -0700)]
freedreno/ir3: GC unused macro

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agofreedreno: Update github wiki links
Rob Clark [Sat, 17 Sep 2022 17:45:38 +0000 (10:45 -0700)]
freedreno: Update github wiki links

The github wiki isn't really maintained anymore.  Update references to
point to the gitlab wiki instead.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18646>

21 months agoradv: Add scratch stack to reduce LDS stack in RT traversal.
Bas Nieuwenhuizen [Sun, 11 Sep 2022 21:31:58 +0000 (23:31 +0200)]
radv: Add scratch stack to reduce LDS stack in RT traversal.

The current stack size is a significant limiter for occupancy, and
hence we need smaller stacks in LDS.

Rhys earlier had a patch that just put the N entries closest to the
root in LDS and the rest in scratch. However, this is not ideal for
performance as most of the activity is happening away from the root,
near the leaves. Of course we can't just switch it around, as the
leaf activity likely isn't happening all the way at the end of the
stack.

So what we do is make the LDS stack kinda a ringbuffer by always
accessing it using the stack index modulo the buffer size (always
a power of two so we can efficiently mask). If we then do not have
free space in this buffer we evict the entries closest to the root
to scratch and if we hit the "bottom" of the LDS space we load from
scratch.

Some rough perf numbers for indication with Q2RTX:

| evicting | LDS entries | perf |
|----------|-------------|------|
|       no |          76 |  55% |
|       no |          32 | 100% |
|       no |          24 | 105% |
|      yes |          32 |  95% |
|      yes |          16 | 100% |
|      yes |           8 |  90% |
|      yes |           4 |  75% |

(For the case with 4 entries we need to do some extra accounting as
 a full batch may not be available to evict)

So an obvious choice is to use a stack of 16 entries.

One might wonder if Q2RTX perf is mainly good due to BVHs with very
little geometry and hence low depth, so I also did some profiling
with control. This is done with RGP instruction timing, so this is
instructions executed not weighted for enabled masks, i.e. divergence
effects included.

| game    | LDS entries | scratch action | fraction of iterations |
|---------|-------------|----------------|------------------------|
| Control |           8 |          store |                  10.3% |
| Control |           8 |          load  |                  34.8% |
| Control |          16 |          store |                  0.58% |
| Control |          16 |          load  |                  2.62% |
| Q2RTX   |          16 |          store |                  1.00% |
| Q2RTX   |          16 |          load  |                  3.07% |

So Q2RTX doesn't seem like an unreasonably good case for this
algorithm.

On the implementation side, we can always place the scratch stack at
address 0 by just reserving the scratch space, and in the case of fixed
callstack size moving that up. In the dynamic case the dynamic stack
base already takes any reserved scratch space into account.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18541>

21 months agoradv: fix dynamic RT stack size with VGPR spilling
Rhys Perry [Mon, 14 Feb 2022 19:23:15 +0000 (19:23 +0000)]
radv: fix dynamic RT stack size with VGPR spilling

VGPR spilling might cause VGPRs to be spilled at scratch offset 0, so we
can't use that.

fossil-db (Sienna Cichlid, Q2RTX and Control):
Totals from 4 (0.26% of 1524) affected shaders:
Instrs: 8734 -> 8737 (+0.03%)
CodeSize: 48492 -> 48504 (+0.02%)
Latency: 384375 -> 384369 (-0.00%)
InvThroughput: 256250 -> 256246 (-0.00%)
Copies: 1312 -> 1313 (+0.08%)
Branches: 256 -> 258 (+0.78%)

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

21 months agodocs: add new llvmpipe/lavapipe atomic float extensions
Dave Airlie [Mon, 19 Sep 2022 20:57:20 +0000 (06:57 +1000)]
docs: add new llvmpipe/lavapipe atomic float extensions

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

21 months agolavapipe: export VK_KHR_shader_atomic_float
Dave Airlie [Fri, 16 Sep 2022 15:03:13 +0000 (01:03 +1000)]
lavapipe: export VK_KHR_shader_atomic_float

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

21 months agollvmpipe: export GL_NV_shader_atomic_float
Dave Airlie [Fri, 16 Sep 2022 15:02:50 +0000 (01:02 +1000)]
llvmpipe: export GL_NV_shader_atomic_float

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

21 months agogallivm: add atomic 32-bit float support
Dave Airlie [Fri, 16 Sep 2022 09:58:59 +0000 (19:58 +1000)]
gallivm: add atomic 32-bit float support

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

21 months agozink: disable GPL when sample shading is in use
Mike Blumenkrantz [Mon, 19 Sep 2022 14:31:36 +0000 (10:31 -0400)]
zink: disable GPL when sample shading is in use

this seems impossible to handle as near as I can tell

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

21 months agoradv: Use nested ifs for pushing child nodes in traversal loop.
Bas Nieuwenhuizen [Sun, 11 Sep 2022 15:59:15 +0000 (17:59 +0200)]
radv: Use nested ifs for pushing child nodes in traversal loop.

Avoids a bunch of overhead costs if the previous child was empty
already.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18538>

21 months agoradv: Use constant for ray traversal exit condition.
Bas Nieuwenhuizen [Sun, 11 Sep 2022 14:48:58 +0000 (16:48 +0200)]
radv: Use constant for ray traversal exit condition.

Make the stack base ssa def dead in the loop, can save a register.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18538>

21 months agoRevert "radv/rt: use derefs for the traversal stack"
Bas Nieuwenhuizen [Sun, 11 Sep 2022 14:18:14 +0000 (16:18 +0200)]
Revert "radv/rt: use derefs for the traversal stack"

This reverts commit 3750663c72b01d8668c13eed44f40863af588ba4.

Doing things with derefs adds extra instructions for multiplying the
index with the element size, e.g.

BBF0_13:
   s_waitcnt vmcnt(0)
   v_mov_b32_e32 v27, v55
   s_mov_b32 s23, exec_lo
   v_cmpx_ne_i32_e32 -1, v27
   s_cbranch_execz _L14
BBF0_14:
   v_lshlrev_b32_e32 v48, 2, v46  <--
   ds_write_b32 v48, v27
   v_add_nc_u32_e32 v46, 32, v46
_L14:
   s_mov_b32 exec_lo, s23
   v_mov_b32_e32 v27, v54
   s_mov_b32 s23, exec_lo
   v_cmpx_ne_i32_e32 -1, v27
   s_cbranch_execz _L15
BBF0_15:
   v_lshlrev_b32_e32 v48, 2, v46 <--
   ds_write_b32 v48, v27
   v_add_nc_u32_e32 v46, 32, v46

On Q2RTC indirect lighting this saves about 2.3 VALU instructions
per loop iteration, which is ~4% of VALU instructions (we're at
58 per iteration now according to RGP).

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18538>

21 months agoradv: Store top of stack in a register.
Bas Nieuwenhuizen [Sat, 10 Sep 2022 01:23:15 +0000 (03:23 +0200)]
radv: Store top of stack in a register.

Saves a bunch of processing and a lot of LDS traffic.

Improves perf of the indirect lighting RT pass in Q2RTX by ~3%. This
is mostly due to the -5% VALU instructions and -25% LDS instructions.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18538>

21 months agoradv: Don't flatten bottom AS exit if statement.
Bas Nieuwenhuizen [Sat, 10 Sep 2022 00:34:35 +0000 (02:34 +0200)]
radv: Don't flatten bottom AS exit if statement.

The flattening by ACO is more efficient than the nir condmask.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18538>

21 months agofix: frontends/va: unused variable ‘max_pipe_hevc_slices’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:42:44 +0000 (18:42 +0200)]
fix: frontends/va: unused variable ‘max_pipe_hevc_slices’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: zink: unused variable ‘intr’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:37:05 +0000 (18:37 +0200)]
fix: zink: unused variable ‘intr’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: iris: unused variable ‘devinfo’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:35:44 +0000 (18:35 +0200)]
fix: iris: unused variable ‘devinfo’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sfn: unused variable ‘spi_sid’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:33:10 +0000 (18:33 +0200)]
fix: r600/sfn: unused variable ‘spi_sid’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sfn: variable ‘fail’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:13:58 +0000 (18:13 +0200)]
fix: r600/sfn: variable ‘fail’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sfn: unused variable ‘{splitpos,param}’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:12:37 +0000 (18:12 +0200)]
fix: r600/sfn: unused variable ‘{splitpos,param}’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sfn: unused variable ‘splitpos’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:10:13 +0000 (18:10 +0200)]
fix: r600/sfn: unused variable ‘splitpos’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sb: warning: unused variable ‘{b,nl}’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:08:43 +0000 (18:08 +0200)]
fix: r600/sb: warning: unused variable ‘{b,nl}’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sfn: variable ‘opinfo’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:50:21 +0000 (13:50 +0200)]
fix: r600/sfn: variable ‘opinfo’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sb: unused variable ‘r’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:48:13 +0000 (13:48 +0200)]
fix: r600/sb: unused variable ‘r’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sb: unused variable ‘fop’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:46:07 +0000 (13:46 +0200)]
fix: r600/sb: unused variable ‘fop’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: r600/sb: unused variable ‘repdep2’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:43:53 +0000 (13:43 +0200)]
fix: r600/sb: unused variable ‘repdep2’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: gallivm: variable ‘type_kind’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:39:19 +0000 (13:39 +0200)]
fix: gallivm: variable ‘type_kind’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: mesa/st: unused variable ‘src’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:37:36 +0000 (13:37 +0200)]
fix: mesa/st: unused variable ‘src’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: mesa/st: variable ‘texobj’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:35:59 +0000 (13:35 +0200)]
fix: mesa/st: variable ‘texobj’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: mesa: unused variable ‘ret’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:33:34 +0000 (13:33 +0200)]
fix: mesa: unused variable ‘ret’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: ac/llvm: unused variable ‘offset’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:31:35 +0000 (13:31 +0200)]
fix: ac/llvm: unused variable ‘offset’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: nir: unused variable ‘else_block’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:28:43 +0000 (13:28 +0200)]
fix: nir: unused variable ‘else_block’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agofix: util/format: unused variable ‘desc’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:25:53 +0000 (13:25 +0200)]
fix: util/format: unused variable ‘desc’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

21 months agost/drawpixels: use normalized coords in samplers with lowered rects
Mike Blumenkrantz [Thu, 15 Sep 2022 13:31:09 +0000 (09:31 -0400)]
st/drawpixels: use normalized coords in samplers with lowered rects

cc: mesa-stable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18614>

21 months agost/bitmap: use normalized coords in samplers with lowered rects
Mike Blumenkrantz [Thu, 15 Sep 2022 13:31:09 +0000 (09:31 -0400)]
st/bitmap: use normalized coords in samplers with lowered rects

cc: mesa-stable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18614>

21 months agozink: fix atomic ssbo fadd offsets
Mike Blumenkrantz [Mon, 19 Sep 2022 19:54:37 +0000 (15:54 -0400)]
zink: fix atomic ssbo fadd offsets

Fixes: 99a4a9c6ff0 ("zink: fix atomic ssbo indexing with non-32bit values")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18684>

21 months agozink: defer acquire semaphore destruction
Mike Blumenkrantz [Mon, 29 Aug 2022 15:40:50 +0000 (11:40 -0400)]
zink: defer acquire semaphore destruction

these have noticeable overhead, so handle them in the submit thread

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18364>

21 months agozink: fix/relax resolve geometry check
Mike Blumenkrantz [Mon, 29 Aug 2022 15:17:43 +0000 (11:17 -0400)]
zink: fix/relax resolve geometry check

there's no requirement in the spec that the geometry for resolves must match,
only that the geometry must be positive (i.e., no flipped extents)

this avoids major perf issues for scaled resolves

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18364>

21 months agoradeonsi/vcn: Add ability to encode with ltr
Kuixi Ren [Tue, 23 Aug 2022 20:22:40 +0000 (20:22 +0000)]
radeonsi/vcn: Add ability to encode with ltr

reads flags field from CurrPic struct in pps for VA_PICTURE_H264_LONG_TERM_REFERENCE. If found, Curr_pic.frame_idx wil be used for the long term reference index
In get_picture_storage, check if current frame is ltr, and whether its ref frame is ltr.
In radeon_enc_slice_header, adds the ref_pic_list_modification_flag_l0 and long_term_reference_flag for ltr

v2: fix code formatting issues

Reviewed-by: Ruijing Dong ruijing.dong@amd.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18219>

21 months agopan/bi: Implement unpack_64_2x32
Alyssa Rosenzweig [Fri, 24 Jun 2022 20:32:20 +0000 (16:32 -0400)]
pan/bi: Implement unpack_64_2x32

This duplicates the lowering from nir_lower_packing. However, nir_lower_packing
also lowers a pile of other instructions that we do implement natively, and this
is easier than adding a bunch of knobs to nir_lower_packing to get just what we
need.

Fixes test-printf address_space_4.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Stub out scoped_barrier
Alyssa Rosenzweig [Mon, 19 Sep 2022 02:26:39 +0000 (22:26 -0400)]
pan/bi: Stub out scoped_barrier

Implement like other workgroup barriers. No subgroup barriers yet, but that
doesn't seem needed yet.

Fixes test_basic.async_copy_global_to_local and a pile of other OpenCL tests.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Fix 1D array indexing on Valhall
Alyssa Rosenzweig [Fri, 24 Jun 2022 21:26:49 +0000 (17:26 -0400)]
pan/bi: Fix 1D array indexing on Valhall

Array index always goes in the fourth 16-bit component on Valhall. I'm unsure
whether that should also apply to Bifrost. f256ec2a881 ("pan/bi: Fix 1DArray
image coordinate retrieval") says that it should be in the third component on
Bifrost, but I can't remember why that would be the case.

Fixes OpenCL test image_streams.write.1darray on Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Use .auto for image stores
Alyssa Rosenzweig [Fri, 24 Jun 2022 21:12:43 +0000 (17:12 -0400)]
pan/bi: Use .auto for image stores

Works around LLVM/SPIR-V stupidity. In effect this means we always use typeless
image stores, which is good enough for both CL and GL.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Call nir_lower_64bit_phis
Alyssa Rosenzweig [Sun, 18 Sep 2022 20:22:08 +0000 (16:22 -0400)]
pan/bi: Call nir_lower_64bit_phis

Fixes test_basic.local_kernel_scope

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Scalarize phis before the opt loop
Alyssa Rosenzweig [Thu, 7 Jul 2022 20:22:29 +0000 (16:22 -0400)]
pan/bi: Scalarize phis before the opt loop

Scalarizing phis results in vector constructions (nir_op_vec) of the same size
as the phi, so a wide phi (>128-bit) will result in a wide vector op that the
backend can't handle. These wide vector ops can always be copypropped away, but
that relies on running NIR copy/prop after scalarizing phis, which was not
always happening before. By scalarizing phis before the opt loop instead of
after, we guarantee that copyprop and DCE run to completion and we get
appropriately lowered code in the backend.

Fixes parts of integer_ops.integer_divideAssign with longs.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Lower fisnormal
Alyssa Rosenzweig [Wed, 6 Jul 2022 20:46:55 +0000 (16:46 -0400)]
pan/bi: Lower fisnormal

Fixes test_bruteforce.isnormal. We don't implement fisnormal in the backend, but
actually lower_bool_to_bitsize was failing earlier since there's no fisnormal32
to lower to either.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Lower <32-bit bit_count
Alyssa Rosenzweig [Wed, 6 Jul 2022 20:28:09 +0000 (16:28 -0400)]
pan/bi: Lower <32-bit bit_count

While we have a POPCOUNT.i32 instruction, we do not have v2i16/v4i8 variants.
The code generated by lower_to_bitsize doesn't seem any better than what we
could do ourselves, so let's use that.

While we're at it, give bitfield_reverse the same treatment as we have only
BITREV.i32. I don't think we can get <32-bit bitfield_reverse in either GL or
CL, but that seems likely to change in the future. (It looks to be valid SPIR-V,
at least.)

Fixes integer_ops.popcount.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Handle swizzles in unpack_64_2x32_split_{x,y}
Alyssa Rosenzweig [Fri, 24 Jun 2022 20:30:24 +0000 (16:30 -0400)]
pan/bi: Handle swizzles in unpack_64_2x32_split_{x,y}

No known fixes but this would still be wrong for OpenCL.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Allow selecting from an 8-bit vec8
Alyssa Rosenzweig [Fri, 24 Jun 2022 18:53:48 +0000 (14:53 -0400)]
pan/bi: Allow selecting from an 8-bit vec8

The word offset is already handled by the above code, there's no need to
restrict the further restrict the swizzle. This pattern can come up with OpenCL.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Remove bogus assert for pack_32_2x16
Alyssa Rosenzweig [Fri, 24 Jun 2022 15:53:16 +0000 (11:53 -0400)]
pan/bi: Remove bogus assert for pack_32_2x16

The following IR is valid NIR:

   vec1 16 ssa_0 = ...
   vec1 32 ssa_1 = pack_32_2x16 ssa_0.xx

In this case, pack_32_2x16 takes in a two component vector, but the source
itself ssa_0 has only a single component. This is fine due to the shuffle, but
will fail the assert. Remove the assert and all is well.

Fixes test_relational.shuffle_copy.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Lower f2i8, f2u8
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:34:17 +0000 (09:34 -0400)]
pan/bi: Lower f2i8, f2u8

These need a simple two-instruction lowering regardless of the size of float
involved. Fixes integer_ops.integer_divideAssign

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Lower 8-bit min/max to bcsel+comparison
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:30:04 +0000 (09:30 -0400)]
pan/bi: Lower 8-bit min/max to bcsel+comparison

We don't have an 8-bit CSEL, so this is the best we can do. It's easier to write
the lowering as an algebraic rule since we don't need to do anything clever.
Fixes integer_ops.integer_clamp.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/va: Add 8-bit integer max assembler case
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:19:08 +0000 (09:19 -0400)]
pan/va: Add 8-bit integer max assembler case

This needs to be lowered to a two instruction sequence because there is no
CSEL.v4s8.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Add HADD.v4s8.rhadd packing test cases
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:11:33 +0000 (09:11 -0400)]
pan/bi: Add HADD.v4s8.rhadd packing test cases

To confirm the XML is right.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/va: Pack .rhadd bit
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:16:58 +0000 (09:16 -0400)]
pan/va: Pack .rhadd bit

Fixes integer_ops.integer_rhadd.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/bi: Handle uhadd, urhadd opcodes
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:09:06 +0000 (09:09 -0400)]
pan/bi: Handle uhadd, urhadd opcodes

Fixes integer_ops.integer_hadd.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/va: Fix v4s8 form of R2 opcodes
Alyssa Rosenzweig [Thu, 23 Jun 2022 22:33:37 +0000 (18:33 -0400)]
pan/va: Fix v4s8 form of R2 opcodes

The XML had a typo which was copypasted (incorrectly) into various instructions.
Fixes a pile of integer_ops subtests.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>

21 months agopan/va: Pack IADD.sat bit
Alyssa Rosenzweig [Thu, 23 Jun 2022 22:21:59 +0000 (18:21 -0400)]
pan/va: Pack IADD.sat bit

Fixes 32-bit portion of integer_ops integer_add_sat.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>