Commit Graph

158375 Commits

Author SHA1 Message Date
Pavel Ondračka
05785d482e r300: run dataflow optimizations in separate loops
Constant folding first, than copy propagate simple movs, after that
we run the merge movs pass and finally peephole. The important part
is to do the copy propagate for the whole program before running merge
movs.

We no longer check the return from merge_movs so convert it to void.

Shader-db changes with RV530:
total instructions in shared programs: 155361 -> 154787 (-0.37%)
instructions in affected programs: 67920 -> 67346 (-0.85%)
total temps in shared programs: 20836 -> 20773 (-0.30%)
temps in affected programs: 711 -> 648 (-8.86%)
total presub in shared programs: 8226 -> 8202 (-0.29%)
presub in affected programs: 223 -> 199 (-10.76%)
total temps in shared programs: 20836 -> 20773 (-0.30%)
temps in affected programs: 711 -> 648 (-8.86%)

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17560>
2022-08-21 09:51:10 +02:00
Pavel Ondračka
2755faf938 r300: check for identical saturate mode when merging MOVs
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17560>
2022-08-21 09:50:03 +02:00
Pavel Ondračka
6286e48e5d r300: fix negate mask computation when merging movs
The main problem here is we can have a negate bit set for an unused
channel, so we can't just OR together the negates when channel merging.
Right now the bug is hidden because how we run the pass order, but
that will change in a later commit. Add some helpers for merging of the
negates, they will be also used more in a later commits. As a bonus
construct the new source separatelly and only rewrite the original
instructions after checking that the final swizzle is valid.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17560>
2022-08-21 09:49:35 +02:00
Pavel Ondračka
aeae7b812c r300: allow constant swizzles with inline constant
This will prevent a regression in the number of inlined constants in
a later commit. Constructs like 4.000000 (0x48).w110 works just fine.

There is a small behavioral change. We would previously allow positive
and negative same-value contants to be produced, e.g.,
4.000000 (0x48).w-w__ and this would be later split into some extra
movs in the dataflow swizzle pass. We now explicitly check that the
final swizzle is valid while inlining. So there is a minor decrease
in inlined constants and in the total instructions.

total lits in shared programs: 4328 -> 4194 (-3.10%)
lits in affected programs: 554 -> 420 (-24.19%)
total instructions in shared programs: 155488 -> 155361 (-0.08%)
instructions in affected programs: 5707 -> 5580 (-2.23%)

Additonally, a fix for pair translation is needed since the constant
inlining can now produce swizzles like this: 4.000000 (0x48).w-0-0-_
so we have to teach pair translation to also ignore the sign for zero
swizzle.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17560>
2022-08-21 09:49:08 +02:00
Jesse Natalie
7b60414494 microsoft/clc: Handle a null clc logger
Fixes: 55b3980e ("microsoft/compiler: Add dxil_logger type and parameter to nir_to_dxil")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7076
Reviewed-by: Michael Tang <tangm@microsoft.com>
Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18127>
2022-08-20 22:40:36 +00:00
Riteo
163390d762 vulkan/device_select_wayland: fix a memory leak with DRM device handling
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18076>
2022-08-20 20:03:03 +00:00
Konstantin Seurer
995480a3f7 radv/ci: Remove host build related fails
!17028 removed acceleration structure host build support.

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18142>
2022-08-20 17:48:04 +00:00
Timur Kristóf
1762e6b540 aco: Improve SCC nocompare optimization when SCC is clobbered.
When SCC is clobbered between s_cmp and its operand's writer,
the current optimization that eliminates s_cmp won't kick in.

However, when s_cmp is the only user of its operand temporary,
it is possible to "pull down" the instruction that wrote the operand.

Fossil DB stats on Navi 21:

Totals from 63302 (46.92% of 134906) affected shaders:
CodeSize: 176689272 -> 176418332 (-0.15%)
Instrs: 33552237 -> 33484502 (-0.20%)
Latency: 205847485 -> 205816205 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 34321285 -> 34319908 (-0.00%); split: -0.00%, +0.00%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16266>
2022-08-20 15:27:40 +00:00
Timur Kristóf
e69de0f81d aco: Support s_cselect_b64 in SCC no-compare optimization.
This was simply left out by accident when I wrote this.

Fossil DB stats on Navi 21:

Totals from 70165 (52.01% of 134906) affected shaders:
CodeSize: 246375656 -> 245814396 (-0.23%)
Instrs: 46519773 -> 46379458 (-0.30%)
Latency: 385159303 -> 385089261 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 66490172 -> 66487867 (-0.00%); split: -0.00%, +0.00%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16266>
2022-08-20 15:27:40 +00:00
Timur Kristóf
b0ef7c7c82 aco/optimizer_postRA: Don't try to optimize dead instructions.
Also delete them when they are already dead in process_instruction().

No Fossil DB changes.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16266>
2022-08-20 15:27:40 +00:00
David Heidelberg
4a4e5320a1 ci: implement stress testing jobs in ci_run_n_monitor.py
Can be triggered by `--stress`.

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18014>
2022-08-20 10:05:57 +00:00
David Heidelberg
607bf3cc41 ci: GraphQL was already implemented in ci_run_n_monitor.py
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18014>
2022-08-20 10:05:57 +00:00
David Heidelberg
d6b61fcf60 ci: traces: update freedreno and broadcom to brotli compressed traces
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18156>
2022-08-20 09:42:28 +00:00
Mike Blumenkrantz
1d521a5c15 zink: add gfx pipeline lookup shortcut
if the final hash was the same as the last-used hash for this program,
it should be safe to reuse the last pipeline object in the presence of
dynamic vertex input since the number of permutations is low

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
6a836eaff5 zink: track which stages in gfx programs are using inlined uniforms
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
8a5b3658df zink: split resource tracking into two sets for buffer/texture
this will make the hash lookups slightly faster to cut down overhead

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
8b93f157de zink: make batch internal api static again
hooray

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
40424cbe98 zink: merge all the batch state sets onto the struct
less memory fragmentation

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
a4830517c2 zink: use PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND
this eliminates the bespoke handling I wrote to do the same thing a while ago

cc: mesa-stable

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
16ae4fb8b7 zink: add is_buffer param to zink_batch_resource_usage_set
this allows constants to be specified, reducing register pressure during
descriptor binds

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
0b56ac82eb zink: move zink_batch_resource_usage_set to be static inline
this has to go in zink_resource.h to avoid infinite include dependency
conflicts

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
7172c8a421 zink: remove c++ guard from zink_resource.h
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
277590d3e4 zink: add more c++ guards to headers
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
58823f054e zink: make zink_bo.h compile in c++
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
bc46d44ba5 zink: constify shader module variable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
98fdcd9f9b zink: pass shader stage as param for gfx module update
less register pressure

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
145137df89 zink: use dynarray instead of list for internal shader cache
this is less likely to obliterate cpu caches

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
d8455e5ebf zink: change u_foreach_bit to regular for loop in zink_gfx_program_update
too hot to be using this

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
5c7c566bda zink: make program cache values more intelligible
instead of magic constants

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
47d83e609a zink: cache dynamic render vs renderpass pipelines separately
removes comparisons from hash lookup

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
fc460f6274 zink: use stage comparison template to ignore vertices_per_patch
no need to compare if this won't be used

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
fbade5c71a zink: add templates for pipeline stage comparison
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
3f163b173d zink: use a list for free batch states
this ensures "fairer" reuse and avoids having any states sitting idle
for too long with resources attached

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
a0e69e7601 zink: split out first-time shader module creation
this simplifies the code a bit and makes it more flexible

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
f5008d4370 zink: split out gfx shader module creation from cache searching
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
db00e794b2 zink: split out nonseamless/inline shader module info calculation
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
4de0f7acd9 zink: plumb screen info through shader key comparison
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
b8a7b912d3 zink: plumb some screen info through gfx shader creation
this should allow optimizing out some parts of the code

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
190e5bda11 zink: simplify shader key comparison by splitting out non-generated tcs
non-generated tcs has unique mechanics in that it doesn't have a base shader key,
so split that out to avoid unnecessary complexity

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
59fa328589 zink: rework bit iteration in update_gfx_shader_modules to use for loop
this is roughly 1% faster in drawoverhead case 7

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
69464177d0 zink: fix shader key struct packing
these structs were improperly sizing to be way bigger than expected

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
f08082c083 zink: remove some gfx pipeline state members
these are no longer used

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
c58f3ec6fc zink: use template to eliminate more instructions in pipeline state comparison
these values don't need to be checked at all if dynamic vertex is enabled,
which wouldn't previously have been possible without adding even more
data to check to the pipeline state

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
d862871682 zink: move pipeline state comparison to c++ template
the other part of the pipeline update hotpath

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
c886a7a423 zink: move gfx pipeline recalc to c++
this is one of the hottest paths in the driver, and having to load
a function variant with all the extra dynamic state paths is not optimal
when they can never be used

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
5457a70ce3 zink: move pipeline cache structs to zink_program.h
these shouldn't be widely used, so they're not in zink_types.h

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
0b6751773c zink: add c++ guards to zink_pipeline.h
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
7b115a5311 zink: remove cpu conditional render hack
this was quite useful for debugging/testing, but now everything works,
so it's dead code

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
3555371679 zink: move gfx program update/creation into zink_program.c
this doesn't need to be c++

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
a98536bba2 zink: deduplicate some program destroy code
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00