Emma Anholt
d79061dba1
glsl/opt_algebraic: Drop log(exp(x)) -> x and exp(log(x)) -> x optimisations.
...
No change on freedreno shader-db.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21475 >
2023-02-28 03:36:08 +00:00
Emma Anholt
2bd0343ba0
glsl/opt_algebraic: Drop ~~x == x transformation.
...
No change on freedreno shader-db.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21475 >
2023-02-28 03:36:08 +00:00
Mike Blumenkrantz
36a916f3f4
zink: use tc renderpass optimizing to more optimally start queries
...
if tc has determined that no queries are ended inside a renderpass,
it becomes possible to start queries outside of a renderpass, which
is more performant on some hw
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
7c96e98975
zink: always start/stop/resume queries inside renderpasses
...
this avoids potentially splitting renderpasses by ensuring that
all (non-cs) query operations always occur inside renderpasses
zink_query_update_gs_states() now has to be called inside renderpass
to catch the active queries
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
cbbc7c98c4
zink: pull 'was_line_loop' into ctx for query updating
...
make this a bit more flexible
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
5492e927e7
zink: use more consistent check for deleting zink_query::stats_list links
...
the linkage of this may vary depending on the query's active state,
so avoid issues by just checking the linkage directly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
b4deaf7b2c
zink: break out query suspend functionality for reuse
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
53c9f60ce4
zink: track whether queries were started in a renderpass
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
e5d517f362
zink: rework query pool overflow
...
now when a query pool is full, a new query pool can be created and the
previous one can be dropped from reuse to be freed at a later time
this has the added benefit of avoiding yet another place where a renderpass
might get split
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
7da78ffb69
zink: create/use query pools dynamically
...
this fits the concept of "pools are shared between queries" a bit
better and leaves the pool ownership/destruction to their users
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
e56d4f9264
zink: rework find_or_allocate_qp()
...
this and its caller are now a bit more streamlined with regards to
functionality of the surrounding code
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
bf782503e1
zink: reorder some query code
...
no functional changes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
8fdbf81ff0
zink: try updating qbos on query resume if !in_rp
...
this is another logical place to do the update since it won't split
a renderpass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
49deb9cbe7
zink: only update qbo for TIME_ELAPSED on start if !in_rp
...
this otherwise splits the current renderpass for no reason
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
93a7187f34
zink: handle null query results for conditional render
...
this just needs to have a zero blasted into the buffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
cf60c7fbfa
zink: handle null query results
...
it's possible that a query may have no results at all, so shortcut
everything and return zero as fast as possible for those cases
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
6bcf4721dc
zink: only try doing qbo updates on query suspend if !in_rp
...
this otherwise creates infinite recursion trying to end a currently
ending renderpass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
2440c98b3b
zink: refuse to start cs invocation queries in renderpass
...
these can't produce data in renderpasses, so ensure they aren't accidentally
started inside a renderpass where they'll have to later be restarted outside
of one
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
74a65363ea
zink: don't double suspend queries
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:42 +00:00
Mike Blumenkrantz
9d0c3d3fb1
zink: un-suspend queries if they end while suspended
...
ensure they don't accidentally resume themselves after suspend
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
34e2d2ec58
zink: add zink_query::suspended to indicate suspended state of queries
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
74af46230c
zink: don't auto-sync qbos on query end
...
these can now be synced later all at once
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
c870c7c942
zink: handle multiple query starts in qbo update
...
this still isn't used due to how queries are started/stopped, but it should
be a bit more robust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
d60c864c45
zink: delete zink_query::last_start_idx
...
this was always zero
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
c46d68235e
zink: make zink_vk_query unref consistent
...
the no-check free seems suspicious
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
eb5e0f5ab5
zink: fix possible query destroy leak
...
if the starts array has been reset, then the counter will be inaccurate,
and some of the members will leak, so this needs to iterate over the capacity
of the array instead of the contents
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
10389698a0
zink: fix zink_query_start initialization
...
not sure if this was a bug, but it would have fully zeroed the struct
and prevented previous zink_vk_query members from being unrefed
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
2a938c3e22
zink: rewrite zink_query_start struct
...
making the non-pool members easier to zero
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
ed9909e3a0
zink: reset queries on the promoted cmdbuf when possible
...
this avoids splitting renderpasses just to reset queries
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
96f7fe7191
zink: remove suspended queries from list before resuming
...
this avoids double-starting primgen queries from recursion when
needs_rast_discard_workaround is true
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Mike Blumenkrantz
4f53997574
zink: move zink_batch_no_rp call for query reset
...
this could otherwise pointlessly terminate a renderpass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534 >
2023-02-28 03:15:41 +00:00
Patrick Lerda
7e613d2a32
mesa/shaderapi: fix path memory leak
...
For instance, with "piglit/arb_shading_language_include-api -auto -fbo" or
"piglit/shader_runner tests/spec/arb_shading_language_include/execution/replacement.shader_test -auto -fbo":
Direct leak of 66 byte(s) in 6 object(s) allocated from:
#0 0x7fa4b59050 in __interceptor_strdup (/usr/lib64/libasan.so.6+0x59050)
#1 0x7f9a098fe0 in validate_and_tokenise_sh_incl ../src/mesa/main/shaderapi.c:3383
#2 0x7f9a0a43e8 in _mesa_NamedStringARB ../src/mesa/main/shaderapi.c:3547
Signed-off-by: Patrick Lerda <patrick9876@free.fr >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21553 >
2023-02-28 01:17:35 +00:00
Giancarlo Devich
e7c5a8b3f8
d3d12: Don't loop in update_draw_indirect_with_sysvals
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21567 >
2023-02-27 23:00:41 +00:00
Giancarlo Devich
bf6c214b25
d3d12: Create varying structures as necessary, reference them
...
This changes instances of d3d12_varying_info to d3d12_varying_info*,
significantly reducing the size of the d3d12_shader_key,
d3d12_gs_variant_key, and d3d12_tcs_variant_key.
Associated changes to key fill, compare, hashing, and gs and tcs variant
maps significantly reduce the amount of time spent clearing and
comparing memory.
The biggest win here is not having to re-zero _or_ re-fill varyings in
d3d12_fill_shader_key, validate_geometry_shader_variant, and
validate_tess_ctrl_shader_variant.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527 >
2023-02-27 22:05:34 +00:00
Giancarlo Devich
41d5e76f2c
d3d12: Don't memcmp gs/tcs keys
...
This is unnecessary and incomplete. Not only is it covered by the hash
map lookup, but also does not consider the other key members.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527 >
2023-02-27 22:05:34 +00:00
Giancarlo Devich
30883c0145
d3d12: Don't unnecessarily zero out gs/tcs keys
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527 >
2023-02-27 22:05:34 +00:00
Giancarlo Devich
56d30bf591
d3d12: Track max varying slot, set and compare less bytes
...
Often, the full range of available slots don't need to participate in
the comparison or be zeroed out.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527 >
2023-02-27 22:05:34 +00:00
Giancarlo Devich
9a3820fe11
d3d12: Don't recompute has_flat_varyings or missing_dual_src_outputs
...
Per shader selection, these two flags can be expensive to compute.
Instead, recompute their values as neccessary, and save them in the
context.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527 >
2023-02-27 22:05:34 +00:00
Emma Anholt
d246948ce3
anv: Skip BTI RT flush if we're doing an op that doesn't use render targets.
...
rt_flushes emitted on zink sauer.trace --loop=500 -2.02118% +/- 1.15992% (n=8).
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21508 >
2023-02-27 21:44:56 +00:00
Emma Anholt
2bd304bc8f
anv: Skip the RT flush when doing depth-only rendering.
...
The spec citation says it's just for when the RT write message BTI might
point to a different RT, and if we don't have any color attachments then
we won't have one of those at all.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21508 >
2023-02-27 21:44:56 +00:00
Mike Blumenkrantz
6992aa951d
aux/tc: only call tc_parse_draw() when parsing renderpass info
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21533 >
2023-02-27 21:04:56 +00:00
Mike Blumenkrantz
ad0d5a24aa
aux/tc: track whether queries have been terminated in a renderpass
...
on tilers it's important to know whether a query is ended mid-renderpass
so that the query begin can occur inside/outside of the renderpass
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21533 >
2023-02-27 21:04:56 +00:00
Caio Oliveira
91fa939763
panfrost: Use NIR scoped barriers instead of memory barriers
...
Now both GLSL and SPIR-V will produce the scoped barriers, so no
need to handle the old ones.
Control barriers are still present in some cases, so keep that
for now.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00
Caio Oliveira
901bc6d53c
pan/midgard: Handle nir_intrinsic_scoped_barrier in Midgard compiler
...
Behave the same as the existing more specific barrier intrinsics.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00
Caio Oliveira
64a0266260
pan/compiler: Fix handling of nir_intrinsic_scoped_barrier
...
Only emit anything if this is a control barrier, i.e. contains an
execution scope. Also change the assertion to look at that scope
instead of the memory scope.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00
Caio Oliveira
c80268a20d
intel/compiler: Mark various memory barriers intrinsics unreachable
...
Now that both SPIR-V and GLSL are using scoped barriers, we can stop
handling the specialized ones.
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00
Caio Oliveira
fe908ffefa
glsl: Implement use_scoped_barrier option for lowering memory barriers
...
When the option is enabled, lower memory barriers to the
unified nir_intrinsic_scoped_barrier.
The translation of the following is based on
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_gl_spirv.txt
- memoryBarrier()
- memoryBarrierBuffer()
- memoryBarrierImage()
- memoryBarrierShared()
- groupMemoryBarrier()
Also use scoped barrier for the memory counterparts of the GLSL
(control) barrier() when the option is enabled. The execution
part of a (control) barrier() remains using the old intrinsic.
For memoryBarrierAtomicCounter() there's no corresponding
nir_var_atomic_counter mode. Since atomic counters are lowered
to SSBOs, use the nir_var_mem_ssbo mode in the scoped barrier
instead.
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Acked-by: Rob Clark <robclark@freedesktop.org >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00
Caio Oliveira
2178a8da51
gallivm: Fix handling of nir_intrinsic_scoped_barrier
...
A scoped barrier only has a control barrier behavior if there's
an execution scope.
Fixes: 13d900de0d
("llvmpipe: set nir_shader_compiler_options::use_scoped_barrier")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00
Caio Oliveira
e411e0afd3
microsoft/compiler: Handle scoped barrier in Tess splitting
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00
Caio Oliveira
1db7e6a261
nir: Support use_scoped_barrier in nir_lower_atomics_to_ssbo
...
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Acked-by: Rob Clark <robclark@freedesktop.org >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339 >
2023-02-27 20:24:01 +00:00