Alyssa Rosenzweig [Thu, 6 Apr 2023 17:19:31 +0000 (13:19 -0400)]
nir: Combine if_uses with instruction uses
Every nir_ssa_def is part of a chain of uses, implemented with doubly linked
lists. That means each requires 2 * 64-bit = 16 bytes per def, which is
memory intensive. Together they require 32 bytes per def. Not cool.
To cut that memory use in half, we can combine the two linked lists into a
single use list that contains both regular instruction uses and if-uses. To do
this, we augment the nir_src with a boolean "is_if", and reimplement the
abstract if-uses operations on top of that list. That boolean should fit into
the padding already in nir_src so should not actually affect memory use, and in
the future we sneak it into the bottom bit of a pointer.
However, this creates a new inefficiency: now iterating over regular uses
separate from if-uses is (nominally) more expensive. It turns out virtually
every caller of nir_foreach_if_use(_safe) also calls nir_foreach_use(_safe)
immediately before, so we rewrite most of the callers to instead call a new
single `nir_foreach_use_including_if(_safe)` which predicates the logic based on
`src->is_if`. This should mitigate the performance difference.
There's a bit of churn, but this is largely a mechanical set of changes.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22343>
Alyssa Rosenzweig [Thu, 30 Mar 2023 15:56:57 +0000 (11:56 -0400)]
tu: Use vk_features2_to_features
Sanitizes properties returned through GetPhysicalDeviceFormatProperties2.
Bit-31 is not valid to return in the original
vkGetPhysicalDeviceFormatProperties{2,}. Sanitize the bit returned from the
internal to ensure invalid bits aren't return to the application.
Falls in line with the other vulkan drivers.
Based on original commit by Ryan Houdek.
Closes: #8733
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>
Alyssa Rosenzweig [Thu, 30 Mar 2023 15:55:31 +0000 (11:55 -0400)]
anv,hasvk: Use vk_features2_to_features
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>
Alyssa Rosenzweig [Thu, 30 Mar 2023 15:55:18 +0000 (11:55 -0400)]
pvr: Use vk_features2_to_features
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>
Alyssa Rosenzweig [Thu, 30 Mar 2023 15:55:10 +0000 (11:55 -0400)]
lavapipe: Use vk_features2_to_features
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>
Alyssa Rosenzweig [Thu, 30 Mar 2023 15:55:02 +0000 (11:55 -0400)]
v3dv: Use vk_features2_to_features
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>
Alyssa Rosenzweig [Thu, 30 Mar 2023 15:54:48 +0000 (11:54 -0400)]
radv: Use vk_features2_to_features
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>
Alyssa Rosenzweig [Thu, 30 Mar 2023 15:48:56 +0000 (11:48 -0400)]
vulkan: Add common features2_to_features
Needed to correctly implement GetPhysicalDeviceFormatProperties2.
Cc stable so the turnip patch can get backported cleanly.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22217>
Mike Blumenkrantz [Fri, 7 Apr 2023 19:46:57 +0000 (15:46 -0400)]
Revert "zink: don't trigger shader variants on pcp change if driver supports dynamic pcp"
This reverts commit
472fcf74e250a72053d837f7730fb991c1c3cb7e.
this is sort of right but then also sort of broken, going to rework a little
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22368>
Samuel Pitoiset [Fri, 7 Apr 2023 12:20:15 +0000 (14:20 +0200)]
radv: copy stages instead of serializing NIR for GPL with the RETAIN flag
When the driver gets a cache hit for the binary, we still have to
retain shaders because we can't know if the LTO pipeline will be a
cache hit as well.
Though, serializing the NIR is too costly and most of the libraries
took more than 10ms to be created, which isn't acceptable. To fix this,
keep track of the shaders stage info for libs with the RETAIN flag.
This might be replaced by NIR caching later if it's worth a try.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22327>
Samuel Pitoiset [Fri, 7 Apr 2023 12:20:06 +0000 (14:20 +0200)]
radv: create a helper for copying VkPipelineShaderStageCreateInfo
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22327>
Samuel Pitoiset [Thu, 6 Apr 2023 14:52:25 +0000 (16:52 +0200)]
radv/rt: stop storing unused hashes/identifiers
This is never used.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22327>
antonino [Fri, 7 Apr 2023 12:41:27 +0000 (14:41 +0200)]
zink: fix sampler array collision in `nir_to_spirv`
`nir_to_spirv` has flat arrays to map driver_location to sampler
variables.
Now when bindless textures are used together with non binless textures
the sampler vars are in different descriptor sets and the binding can be
the same between different descriptor sets, this causes a collision in
arrays.
This patches chamges `nir_to_spirv` to also index the array by whether
the texture is bindless.
Fixes:
bc202553e9b ("zink: implement bindless textures")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22358>
antonino [Fri, 7 Apr 2023 15:57:15 +0000 (17:57 +0200)]
zink: add `descriptor_bindless_id` to `zink_shader_info`
This field stores the id of the descriptor set used for bindless
textures.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22358>
Jesse Natalie [Thu, 6 Apr 2023 20:50:38 +0000 (13:50 -0700)]
dzn: Remove xfail for test that passes (if run)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22346>
Jesse Natalie [Thu, 6 Apr 2023 20:45:08 +0000 (13:45 -0700)]
dzn: Support >2K samplers with bindless
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22346>
Jesse Natalie [Thu, 6 Apr 2023 20:15:21 +0000 (13:15 -0700)]
dzn: Remove skips now that WARP is faster
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22346>
Jesse Natalie [Fri, 7 Apr 2023 15:55:13 +0000 (08:55 -0700)]
dzn: Don't leave deleted physical devices in the instance pdev list
Fixes:
cfa260cd ("dzn: Use common physical device list/enumeration helpers")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22346>
Jesse Natalie [Thu, 6 Apr 2023 19:57:53 +0000 (12:57 -0700)]
dzn: Use GetResourceAllocationInfo3 for castable formats
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22346>
Jesse Natalie [Thu, 6 Apr 2023 19:57:15 +0000 (12:57 -0700)]
dzn: Clean up ABI helpers now that we require DirectX-Headers 606
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22346>
Jesse Natalie [Thu, 6 Apr 2023 19:39:08 +0000 (12:39 -0700)]
dzn: Early-out on no-op barriers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22346>
Mike Blumenkrantz [Fri, 7 Apr 2023 16:01:09 +0000 (12:01 -0400)]
zink: don't trigger shader variants on pcp change if driver supports dynamic pcp
this otherwise pointlessly creates and binds shader variants that do nothing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22365>
Mike Blumenkrantz [Fri, 7 Apr 2023 14:17:45 +0000 (10:17 -0400)]
zink: reuse copy_vars for generated tcs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22364>
Mike Blumenkrantz [Fri, 7 Apr 2023 14:14:09 +0000 (10:14 -0400)]
zink: reuse d3d12 variable copying to make passthrough gs more robust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22364>
Felix DeGrood [Wed, 22 Mar 2023 22:08:09 +0000 (22:08 +0000)]
anv: reset query pools using blorp
Previously we used PC to set query data to 0 during
CmdResetQueryPool. This was slow when clearing large query pools.
Switching to blorp to clear pools is faster for large query pools.
Red Dead Redemption 2: +1.5% speedup
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22178>
Lionel Landwerlin [Fri, 31 Mar 2023 08:32:18 +0000 (11:32 +0300)]
anv: replace query flush before gpu copy by semaphore wait
All the flushes should already have happened, we just need CS to wait
for the operations to complete. Just use a MI_SEMAPHORE_WAIT to check
the availability bit is set.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22178>
Lionel Landwerlin [Thu, 30 Mar 2023 16:10:19 +0000 (19:10 +0300)]
anv: pass steam output as argument for anv_dump_pipe_bits
Just if you need to change it at some point ;)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22178>
Felix DeGrood [Tue, 28 Mar 2023 23:44:19 +0000 (23:44 +0000)]
anv/blorp: add flush reasons to RT flushes
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22178>
Felix DeGrood [Wed, 22 Mar 2023 22:04:22 +0000 (22:04 +0000)]
anv/blorp: implement anv_cmd_buffer_fill_area
Implemented function to fill an area at an address.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22178>
Felix DeGrood [Wed, 22 Mar 2023 18:04:42 +0000 (18:04 +0000)]
anv/blorp: support surf generation for addresses
Already have support for anv_buff. Extended to support addresses.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22178>
Raun [Thu, 6 Apr 2023 19:31:43 +0000 (14:31 -0500)]
dzn: Enable VK_KHR_get_memory_requirements2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22349>
Raun [Thu, 6 Apr 2023 19:23:42 +0000 (14:23 -0500)]
dzn: Enable VK_KHR_bind_memory2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22349>
Samuel Pitoiset [Fri, 7 Apr 2023 09:36:08 +0000 (11:36 +0200)]
radv: import retained NIR shaders later in the compilation process
This allows us to remove the intermediate NIR shader pointer.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22356>
Samuel Pitoiset [Fri, 7 Apr 2023 09:05:57 +0000 (11:05 +0200)]
radv: do not retain noop FS for libs when a cache hit happened
Determine if the graphics pipeline needs a noop FS later instead of
retaining it. This was also suboptimal.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22356>
Samuel Pitoiset [Fri, 7 Apr 2023 08:55:24 +0000 (10:55 +0200)]
radv: simplify a check when retaining NIR shaders
The RETAIN flag is only allowed with graphics libs.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22356>
Samuel Pitoiset [Fri, 7 Apr 2023 08:53:38 +0000 (10:53 +0200)]
radv: move the serialized NIR to radv_graphics_lib_pipeline
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22356>
Samuel Pitoiset [Fri, 7 Apr 2023 08:44:55 +0000 (10:44 +0200)]
radv: add a helper for retaining NIR shaders
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22356>
Mike Blumenkrantz [Thu, 6 Apr 2023 18:49:31 +0000 (14:49 -0400)]
zink: don't access non_fs part of zink_shader from fs
Fixes:
a6de15eff56 ("zink: add flags to `zink_gfx_program` and `zink_context`")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22347>
Mike Blumenkrantz [Wed, 5 Apr 2023 15:35:53 +0000 (11:35 -0400)]
zink: more explicitly track/check rp optimizing per-context
if tc creation fails for whatever reason, rp optimizing must be
marked as disabled for that context to avoid erroneous assumptions
about rp operation
fixes #8787
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22319>
Qiang Yu [Wed, 5 Apr 2023 02:09:28 +0000 (10:09 +0800)]
ac/llvm: remove some unused code replaced by nir
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/22304>
Qiang Yu [Wed, 5 Apr 2023 01:52:01 +0000 (09:52 +0800)]
ac/nir/ngg: fix store shared alignment
For stream!=0, this align_mul=4 is not true. Not observe any
problem yet, just for correctness.
Fixes:
60ac5dda82e ("ac: Add NIR lowering for NGG GS.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22304>
Qiang Yu [Wed, 5 Apr 2023 01:27:50 +0000 (09:27 +0800)]
ac/nir/ngg: fix gs culling vertex liveness check for odd vertices
If vertex does not complete a primitive, it should not set the odd
flag which miss lead liveness check when culling is enabled.
For example, if odd flag is set regardless of complete flag, when
culling is enabled, 3 vertices of a triangle's init prim flag:
[0x00 0x04 0x01]
then after culling, this triangle has been culled, their prim flag:
[0x00 0x04 0x00]
the second vertex is miss treat as live because its odd flag (code
check prim_flag!=0 for liveness).
Fixes:
1bdeb961bd8 ("ac/nir/ngg: add gs culling")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8725
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22304>
Qiang Yu [Tue, 4 Apr 2023 01:42:24 +0000 (09:42 +0800)]
radeonsi: fix max scrach lds size calculation when ngg
Fixes:
028d0590f85 ("radeonsi: replace llvm ngg vs/tes with nir lowering")
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/22304>
Asahi Lina [Wed, 5 Apr 2023 12:42:14 +0000 (21:42 +0900)]
asahi: Allow explicit non-LINEAR modifiers for scanout
The compositor is responsible for picking the right supported modifiers
for scanout. If we get no modifiers, we have to assume linear, but if we
do, just roll with it and don't attempt to force things.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 12:41:27 +0000 (21:41 +0900)]
asahi: Flip kmsro around to allocate on the GPU
Our display controller can handle arbitrary GPU imports, so there is no
reason to use dumb KMS buffers. Allocate everything on the GPU instead.
This also allows us to be lazy about mapping things to the KMS side, so
only clients that really want a KMS handle actually do that, which stops
us from ending up with a bunch of junk mapped to DCP (e.g. X11 clients
always request SCANOUT even under XWayland).
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 16:42:51 +0000 (01:42 +0900)]
asahi: Fix compressed ZS support
Depth/stencil formats are "not renderable" but do support compression.
I swear I already fixed this at some point and the commit must've fallen
through the cracks...
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 07:17:50 +0000 (16:17 +0900)]
asahi: Print reasons why compression is disabled
For resource debug. Found a regression in compressed depth this way.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 06:54:04 +0000 (15:54 +0900)]
asahi: Add resource debugging
I keep re-implementing this every time I look at resource-related
issues. Let's just make it official so we can turn it on with a flag
instead of having to add printfs every time ^^
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 06:39:46 +0000 (15:39 +0900)]
asahi: Add a helper macro for debug/error messages
This includes the program short name in the message, which is useful
when running entire desktop sessions with a single log to figure out who
is doing what.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 29 Mar 2023 09:48:53 +0000 (18:48 +0900)]
asahi: Make BO import path failures more robust
These operations can fail for complex reasons through no fault of mesa,
so we should have proper runtime checks for them even in release builds.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 29 Mar 2023 10:20:12 +0000 (19:20 +0900)]
asahi: Implement valid buffer range tracking
A common pattern is to allocate a vertex/etc buffer and write to it in
subsets. Some games interleave this with draw calls using the buffer.
This causes very expensive flushing for every draw call.
Fix this by tracking which range of a buffer has been written to, and
elide syncs when the range was previously uninitialized.
Fixes Source engine game performance and probably helps a bunch of
others.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 10:48:12 +0000 (19:48 +0900)]
asahi: Fix style nits
Found with a grep abomination which is probably too broken/silly to
actually implement in CI... but hey, at least it found some.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 14:48:42 +0000 (23:48 +0900)]
asahi: Locate low VA BOs correctly
These need the shader_base added to them.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 29 Mar 2023 09:45:45 +0000 (18:45 +0900)]
asahi: Enable glthread
This helps a lot with FEX, since the GPU driver runs emulated (and only
64bit supports thunking).
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 11:17:51 +0000 (20:17 +0900)]
asahi: Make agx_alloc_staging() take a screen instead of a context
This makes it clear that it is thread-safe.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Asahi Lina [Wed, 5 Apr 2023 11:59:50 +0000 (20:59 +0900)]
Revert "asahi: Advertise dual-source blending"
This reverts commit
f4e2b2264663482f76681dbc0a8e9fc1574a3ce7.
This is broken until GL3 is enabled, possibly due to a core Mesa bug,
but it's a corner case not worth fixing.
Fixes Chromium.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Thu, 30 Mar 2023 02:17:18 +0000 (22:17 -0400)]
agx: Make signal_pix instructions explicit
Rather than implicitly packing them with the sample_mask. Again, this is just
changing where they're emitted, no functional changes yet. Bug for bug
compatibility with the old behaviour.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Thu, 30 Mar 2023 02:08:47 +0000 (22:08 -0400)]
agx: Rename writeout to wait_pix
This is the name applegpu is currently using, to capture the semantics of a
pixel fence. I'm not sure what Apple calls this but wait_pix is closer than
writeout for sure.
This commit just does the rename. It doesn't fix the broken semantics we've had,
this is to ease review and bisection.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Thu, 30 Mar 2023 01:58:59 +0000 (21:58 -0400)]
agx: Tease apart some sample_mask packing magic
There's a second instruction here, and a second source in the first instruction.
applegpu has known about the encodings for a while but I never updated the
packing code. We will need to stop hardcoding this for multisampling support, as
preparation tease apart the magic pieces.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 18 Mar 2023 21:34:17 +0000 (17:34 -0400)]
asahi: Clamp texture buffer sizes
Per the spec / freedreno. Fixes
arb_texture_buffer_object-texture-buffer-size-clamp
Fixes:
6b22a02f908 ("asahi,agx: Implement buffer textures with gnarly NIR")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sun, 26 Mar 2023 21:12:21 +0000 (17:12 -0400)]
asahi: Dirty track depth bias uploads
Reduces how much we upload in SuperTuxKart.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 18 Mar 2023 20:42:35 +0000 (16:42 -0400)]
asahi: Lower 1D to 2D
Khronos APIs require that we support mipmapping even for 1D textures. However,
it isn't clear if this is supported in the hardware, and how it would work even
if it is. But 1D textures are pretty useless, so we just lower 1D textures to 2D
textures instead of worrying about that.
Fixes piles of Piglits relating to 1D textures.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 18 Mar 2023 20:58:22 +0000 (16:58 -0400)]
asahi: Implement null textures
Use the same silly workaround that Metal does, to fill in texture descriptors
when there's nothing bound in the interest of robust behaviour.
Fixes null pointer dereference in
arb_shading_language_420pack-active-sampler-conflict.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Tue, 28 Mar 2023 04:05:07 +0000 (00:05 -0400)]
asahi: Honour sampler count
It may not be equal to the texture count. Prevents a regression from the next
commit.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Tue, 7 Mar 2023 04:09:38 +0000 (23:09 -0500)]
agx: Don't overallocate registers
We need to account for the full vector lengths. Especially important once we
start restricting the reg file.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Tue, 28 Feb 2023 21:44:12 +0000 (16:44 -0500)]
agx: Coalesce more collects
Try harder to coalesce collects, by trying to allocate collects only to regions
of the register file where we actually have a full vector worth of registers
free. If we already know that the vector will be blocked later, it's not a good
base register to pick since we'd be force to shuffle later. So, this tweak to
the collect coalescing heuristic lets us eliminate a pile of pointless copying.
shader-db results are excellent. Note that, although we use more registers,
none of the shaders tested had their thread count affected, likely because the
max HURT isn't too high and most of the scary % here is from using a few more
registers when the register pressure is already low. In the near future, that
property will become guaranteed thanks to live range splitting, too.
total instructions in shared programs: 1507337 -> 1500562 (-0.45%)
instructions in affected programs: 428137 -> 421362 (-1.58%)
helped: 2658
HURT: 167
helped stats (abs) min: 1.0 max: 34.0 x̄: 2.63 x̃: 2
helped stats (rel) min: 0.10% max: 25.00% x̄: 3.04% x̃: 2.14%
HURT stats (abs) min: 1.0 max: 10.0 x̄: 1.24 x̃: 1
HURT stats (rel) min: 0.20% max: 23.81% x̄: 3.90% x̃: 3.57%
95% mean confidence interval for instructions value: -2.49 -2.31
95% mean confidence interval for instructions %-change: -2.76% -2.51%
Instructions are helped.
total bytes in shared programs:
10333670 ->
10293172 (-0.39%)
bytes in affected programs: 2996682 -> 2956184 (-1.35%)
helped: 2660
HURT: 175
helped stats (abs) min: 2.0 max: 204.0 x̄: 15.70 x̃: 12
helped stats (rel) min: 0.08% max: 23.08% x̄: 2.64% x̃: 1.83%
HURT stats (abs) min: 2.0 max: 60.0 x̄: 7.26 x̃: 6
HURT stats (rel) min: 0.12% max: 22.39% x̄: 3.19% x̃: 2.78%
95% mean confidence interval for bytes value: -14.81 -13.76
95% mean confidence interval for bytes %-change: -2.39% -2.18%
Bytes are helped.
total halfregs in shared programs: 417284 -> 427363 (2.42%)
halfregs in affected programs: 49814 -> 59893 (20.23%)
helped: 95
HURT: 3018
helped stats (abs) min: 1.0 max: 8.0 x̄: 2.29 x̃: 2
helped stats (rel) min: 2.44% max: 28.57% x̄: 9.20% x̃: 6.06%
HURT stats (abs) min: 1.0 max: 14.0 x̄: 3.41 x̃: 4
HURT stats (rel) min: 2.08% max: 150.00% x̄: 36.54% x̃: 27.27%
95% mean confidence interval for halfregs value: 3.17 3.31
95% mean confidence interval for halfregs %-change: 34.05% 36.23%
Halfregs are HURT.
total threads in shared programs:
16465280 ->
16465280 (0.00%)
threads in affected programs: 0 -> 0
helped: 0
HURT: 0
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 18 Mar 2023 18:45:08 +0000 (14:45 -0400)]
asahi: Set PIPE_CAP_LOAD_CONSTBUF
The CAP is a bit of a misnomer, what it really does is relax the alignment
requirements for UBO packing. It should work fine and save us some memory.
Noticed while debugging piglit fails.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 18 Mar 2023 18:33:10 +0000 (14:33 -0400)]
asahi/decode: Print VDM barriers
Instead of just decoding silently.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 18 Mar 2023 18:30:31 +0000 (14:30 -0400)]
asahi/decode: Remove agxdecode_dump_bo
Now that we have proper parsing this is more of a nuissance than not.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 11 Mar 2023 20:39:09 +0000 (15:39 -0500)]
agx: Add helper for calculating occupancy
Add information about the relationship between program register usage and
program occupancy (the maximum number of threads that may execute concurrently
on a single shader core). This table is derived from studying the
maxTotalThreadsPerThreadgroup property in Metal while varying the register
usage, something I blogged about a few years back. It's probably not 100%
accurate and it hasn't been tested against hardware, but it matters "only" for
performance (not correctness) so I'm not super stressed about the details.
In the (near) future, RA will be able to make use of this information to know
exactly when it can use more registers without hurting performance. In the
present, it's just used for better shader-db statistics.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Tue, 7 Mar 2023 04:33:11 +0000 (23:33 -0500)]
agx: Set loads_varying accurately
Instead of just always mashing to true. Should be better for depth-only passes.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 11 Mar 2023 22:48:56 +0000 (17:48 -0500)]
asahi: Add perf debug for shader variants
Compiling this can cause jank. This is still an issue in Quake3. There is a way
to solve it but it's rather involved and certainly not this weekend's project.
Better perf debugging on the other hand apparently is ^_^
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 11 Mar 2023 21:46:45 +0000 (16:46 -0500)]
asahi: Add perf debug for generate_mipmap
The current implementation leaves a lot of perf on the table, so call it out on
ASAHI_MESA_DEBUG=perf to help debugging perf problems, especially if this
ever happens in a real application (i.e. not a benchmark).
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sun, 12 Mar 2023 03:16:52 +0000 (22:16 -0500)]
agx: Don't destroy usub_sat with constant
Fixes KHR-GLES31.core.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-pad
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sun, 12 Mar 2023 03:07:18 +0000 (22:07 -0500)]
agx: Don't allow uniform source to local_atomic
Fixes KHR-GLES31.core.compute_shader.atomic-case3
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sun, 5 Mar 2023 03:17:29 +0000 (22:17 -0500)]
agx: Constify agx_{read,write}_registers
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Tue, 7 Mar 2023 03:59:23 +0000 (22:59 -0500)]
agx: Assert that we don't overflow registers
This will become particularly important when we bound to smaller register files.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sat, 4 Mar 2023 22:13:30 +0000 (17:13 -0500)]
agx: DCE even with noopt
To simplify live range splitting, RA will soon assume that DCE has run (removing
extraneous vectors). So run DCE even when otherwise disabling backend
optimizations. AGX_MESA_DEBUG=noopt is still useful for disabling instruction
combining, which is the more-likely-to-be-buggy pass anyway.
This also fixes IR not being printed with noopt.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Alyssa Rosenzweig [Sun, 12 Mar 2023 00:47:27 +0000 (19:47 -0500)]
asahi: Support more renderable formats
Fixes KHR-GLES3.copy_tex_image_conversions.forbidden.*
Arguably working around a mesa/st issue but more format support is good for
compatibility and performance anyway.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Janne Grunau <j@jannau.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
Yiwei Zhang [Fri, 31 Mar 2023 06:53:58 +0000 (06:53 +0000)]
venus/docs: sync to latest venus supported extensions
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22243>
Yiwei Zhang [Fri, 31 Mar 2023 06:26:01 +0000 (06:26 +0000)]
venus: add VK_EXT_rasterization_order_attachment_access support
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22243>
Yiwei Zhang [Fri, 31 Mar 2023 08:28:04 +0000 (08:28 +0000)]
venus: add VK_EXT_load_store_op_none support
There's no feature/properties structs associated with this extension.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22243>
Yiwei Zhang [Fri, 31 Mar 2023 06:16:36 +0000 (06:16 +0000)]
venus: sync latest protocol for layering extensions
- VK_EXT_load_store_op_none
- VK_EXT_rasterization_order_attachment_access
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22243>
Sajeesh Sidharthan [Wed, 5 Apr 2023 08:58:59 +0000 (14:28 +0530)]
radeonsi/vcn: optimize bitstream buffer resize logic
bitstream buffer is unmapped, resized and mapped again if new size
is greater than the current bitstream buffer size. This will be done
for each input buffer. This patch will avoid that and do resize
only once irrespective of number of input buffers. With the new logic,
total size is calculated first and call unmap, resize and map only once.
Signed-off-by: Sajeesh Sidharthan <sajeesh.sidharthan@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22308>
Alyssa Rosenzweig [Thu, 30 Mar 2023 18:08:38 +0000 (14:08 -0400)]
nir/print: Don't print sampler_index for txf
NIR's docs for sampler_index say
The following operations do not require a sampler and, as such, this
field should be ignored:
- nir_texop_txf
- nir_texop_txf_ms
- nir_texop_txs
- nir_texop_query_levels
- nir_texop_texture_samples
- nir_texop_samples_identical
Contrary to this documentation, we were still printing the sampler_index anyway,
even though the value is formally undefined. This was helpful for
PIPE_CAP_TEXTURE_BUFFER_SAMPLER drivers that (despite the NIR docs) respected the
sampler_index anyway. There are no longer any such drivers, so we should stop
printing sampler_index for txf to avoid confusion (and noise).
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22223>
Alyssa Rosenzweig [Fri, 31 Mar 2023 01:02:45 +0000 (21:02 -0400)]
docs/gallium: Note samplers are not used for txf
Now that PIPE_CAP_TEXTURE_BUFFER_SAMPLER is gone, txf does not require samplers
for any texture on any Gallium driver. NIR already requires drivers to ignore
sampler_index for non-sampler operation (mainly txf), and nowadays all Gallium
drivers ingest NIR. So, document that samplers aren't bound for txf (etc) as
part of the Gallium frontend-driver contract.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Suggested-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22223>
Alyssa Rosenzweig [Thu, 30 Mar 2023 17:24:16 +0000 (13:24 -0400)]
gallium: Remove PIPE_CAP_TEXTURE_BUFFER_SAMPLER
No more users. It was already not respected by rusticl so you couldn't set it if
you wanted OpenCL support. I regret introducing the CAP in the first place, and
no more drivers should use it.
Reverts
d5d3f77e4ac ("gallium: Add new cap PIPE_CAP_TEXTURE_BUFFER_SAMPLER").
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22223>
Alyssa Rosenzweig [Thu, 30 Mar 2023 17:21:14 +0000 (13:21 -0400)]
panfrost: Unset TEXTURE_BUFFER_SAMPLERS
We no longer need this CAP, as we can easily synthesize our own internal sampler
for this case. Gallium doesn't need to know about this quirk of our hardware.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22223>
Alyssa Rosenzweig [Thu, 30 Mar 2023 18:00:46 +0000 (14:00 -0400)]
pan/{mdg,bi}: Always use sampler 0 for txf
Now that we upload workaround samplers for txf, sampler 0 is guaranteed to be
valid but other samplers are not. So ignore whatever the current sampler_index
value is (it's formally undefined in NIR) and use 0, which we know is valid. We
already do this on Valhall for OpenCL, just need to generalize for Midgard and
Bifrost.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22223>
Alyssa Rosenzweig [Thu, 30 Mar 2023 17:55:14 +0000 (13:55 -0400)]
panfrost: Always upload a workaround sampler
The hardware requires a valid sampler even for texelFetch (txf), even though its
contents are ignored. We'd rather not pass on this requirement to the frontends,
so we should handle it by uploading our own workaround sampler in the case when
no sampler is already present. We already do this on Valhall (for rusticl), so
we just need to port the same workaround back to Midgard/Bifrost.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22223>
Mike Blumenkrantz [Thu, 6 Apr 2023 20:12:46 +0000 (16:12 -0400)]
zink: don't try copying multiple results for conditional render copy
conditional render is only a single result, so multiple results need
to first be aggregated
fixes #8798
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22345>
Ian Romanick [Fri, 17 Feb 2023 20:20:09 +0000 (12:20 -0800)]
nir/tests: Port almost all loop_analyze tests to new macro-based infastructure
The one test that remains would have an automatically generated name
that would conflict with another test. This test is also a little
special (per the comment in the test), so it's probably best to leave it
separate anyway.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Yevhenii Kolesnikov [Fri, 17 Jan 2020 11:01:01 +0000 (13:01 +0200)]
nir/loop_analyze: Determine iteration counts for more kinds of loops
If loop iterator is incremented with something other than regular
addition, it would be more error prone to calculate the number of
iterations theoretically. What we can do instead, is try to emulate the
loop, and determine the number of iterations empirically.
These operations are covered:
- imul
- fmul
- ishl
- ishr
- ushr
Also add unit tests for loop unrollment.
Improves performance of Aztec Ruins (sixonix
gfxbench5.aztec_ruins_vk_high) by -1.28042% +/- 0.498555% (N=5) on Intel
Arc A770.
v2 (idr): Rebase on 3 years. :( Use nir_phi_instr_add_src in the test
cases.
v3 (idr): Use try_eval_const_alu in to evaluate loop termination
condition in get_iteration_empirical. Also restructure the loop
slightly. This fixed off by one iteration errors in "inverted" loop
tests (e.g., nir_loop_analyze_test.ushr_ieq_known_count_invert_31).
v4 (idr): Use try_eval_const_alu in to evaluate induction variable
update in get_iteration_empirical. This fixes non-commutative update
operations (e.g., shifts) when the induction varible is not the first
source. This fixes the unit test
nir_loop_analyze_test.ishl_rev_ieq_infinite_loop_unknown_count.
v5 (idr): Fix _type parameter for fadd and fadd_rev loop unroll
tests. Hopefully that fixes the failure on s390x. Temporarily disable
fmul. This works-around the revealed problem in
glsl-fs-loop-unroll-mul-fp64, and there were no shader-db or fossil-db
changes.
v6 (idr): Plumb max_unroll_iterations into get_iteration_empirical. I
was going to do this, but I forgot. Suggested by Tim.
v7 (idr): Disable fadd tests on s390x. They fail because S390 is weird.
Almost all of the shaders affected (OpenGL or Vulkan) are from gfxbench
or geekbench. A couple shaders in Deus Ex (OpenGL), Dirt Rally (OpenGL),
Octopath Traveler (Vulkan), and Rise of the Tomb Raider (Vulkan) are
helped.
The lost / gained shaders in OpenGL are an Aztec Ruins shader that goes
from SIMD16 to SIMD8. The spills / fills affected are in a single Aztec
Ruins (Vulkan) compute shader.
shader-db results:
Skylake, Ice Lake, and Tiger Lake had similar results. (Tiger Lake shown)
total loops in shared programs: 5514 -> 5470 (-0.80%)
loops in affected programs: 62 -> 18 (-70.97%)
helped: 37 / HURT: 0
LOST: 2
GAINED: 2
Haswell and Broadwell had similar results. (Broadwell shown)
total loops in shared programs: 5346 -> 5298 (-0.90%)
loops in affected programs: 66 -> 18 (-72.73%)
helped: 39 / HURT: 0
fossil-db results:
Skylake, Ice Lake, and Tiger Lake had similar results. (Tiger Lake shown)
Instructions in all programs:
157374679 ->
157397421 (+0.0%)
Instructions hurt: 28
SENDs in all programs: 7463800 -> 7467639 (+0.1%)
SENDs hurt: 28
Loops in all programs: 38980 -> 38950 (-0.1%)
Loops helped: 28
Cycles in all programs:
7559486451 ->
7557455384 (-0.0%)
Cycles helped: 28
Spills in all programs: 11405 -> 11403 (-0.0%)
Spills helped: 1
Fills in all programs: 19578 -> 19588 (+0.1%)
Fills hurt: 1
Lost: 1
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Yevhenii Kolesnikov [Fri, 17 Jan 2020 11:01:01 +0000 (13:01 +0200)]
nir/loop_analyze: Track induction variables incremented by more operations
These operations are covered:
- imul
- fmul
- ishl
- ishr
- ushr
The only cases that can be currently affected are those where the
calculated loop-trip count would be zero.
v2 (idr): Split out from original commit. Rebase on lots of other work.
v3 (idr): Move operand size assertion. This code only cares that the
operands have the same size for the iadd and fadd cases. In other
cases, such as shifts, the sizes may not match. Fixes assertion
failures in
tests/spec/arb_gpu_shader_int64/glsl-fs-loop-unroll-ishl-int64.shader_test.
No shader-db or fossil-db changes on any Intel platform.
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Ian Romanick [Tue, 14 Feb 2023 01:33:29 +0000 (17:33 -0800)]
nir/loop_analyze: Use try_eval_const_alu and induction variable basis info
This dramatically simplifies will_break_on_first_iteration, and, much
more importantly, makes it significantly more flexible. It is now
possible to handle loops with more complex exit condition and other
kinds of increment operations.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Ian Romanick [Wed, 15 Feb 2023 00:12:23 +0000 (16:12 -0800)]
nir/loop_analyze: Change invert_cond instead of changing the condition
This ensures that scenarios like
nir_loop_analyze_test.iadd_inot_ilt_rev_known_count_5 don't regress in
the next commit. It also means we don't change float comparisons. These
are probably fine... but it still made me a little uneasy.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Ian Romanick [Tue, 14 Feb 2023 01:30:16 +0000 (17:30 -0800)]
nir/loop_analyze: Track induction variable basis information
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Ian Romanick [Tue, 14 Feb 2023 01:23:14 +0000 (17:23 -0800)]
nir/loop_analyze: Add a function to evaluate an ALU as constant
...with a substitution. This function is largely a copy-and-paste of
try_fold_alu (nir_opt_constant_folding.c), and an argument could be made
that this function belongs in that file.
v2: Some changes were mistakenly squashed in to "nir/loop_analyze: Use
try_eval_const_alu and induction variable basis info" that should have
been here.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Ian Romanick [Thu, 2 Feb 2023 00:18:04 +0000 (16:18 -0800)]
nir/tests: Add many loop analysis tests for induction variables modified by imul
Loop analysis doesn't currently treat values updated by multiplication
as induction variables. Future patches will change this.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
Ian Romanick [Thu, 2 Feb 2023 20:44:52 +0000 (12:44 -0800)]
nir/tests: Add more loop analysis tests for induction vars updated by shifts
These reverse the order of the comparison (e.g., -2 >= i vs i >= -2). I
split this into a separate commit because the previous commit was so
large.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>