Commit Graph

184856 Commits

Author SHA1 Message Date
Alyssa Rosenzweig
14e1bb78ae agx: add spill/fill lowering pass
This simple pass turns moves of memory registers (outputted by RA from the
spiller produced moves/phis of memory variables) into concrete stack load/store
instructions. it's a lot more convenient to do this as a dedicated post-RA pass
than trying to fold this into the hairball that is RA proper.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
40da539d01 agx: introduce "memory variables"
in order to spill, we need to be able to assign spill slots. this is equivalent
to register allocation, so we borrow NAK's neat solution: add "memory variables"
into the IR which get RA'd to "memory registers" that correspond directly to
stack slots. then we can just spill by inserting moves.

this requires extensions to RA, parallel copy lowering, and the IR itself. but
it makes competent spilling so much more straightforward.

to exercise this code path, the commit also includes a trivial spiller that
simply moves every source/destination between memory variables and general
variables, which has the effect of spilling everything. to be replaced by
Braun-Hack eventually, this is just foundations.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
06eb552baa agx: print register vectors
easier dbg

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
282f2ac1aa agx: allow 16-bit immediate on stack load/store
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
485e17e01e asahi: allocate preamble scratch
needed for preamble spilling

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
f97b041e87 agx: set nr_preamble_gprs for preamble scratch
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
94b9200042 asahi: add has_scratch to shader key
some stages are unspillable

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
9445005c87 agx: improve scratch size accounting
- prep for preamble scratch
- only include scratch actually used
- prep for spilling scratch

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
a2328820f7 agx: clamp register file based on workgroup size
once we allow workgroup sizes larger than 384 threads, we need to restrict the
register file to ensure we fit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
bb37b072a5 asahi,agx: use intrinsics pass
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
e34a707d78 asahi: optimize memory_barrier
don't flush everything, only flush batches that could actually need a flush.

this eliminates memory barrier flushes in an apitrace of ryujinx, although perf
impact there seems neglible.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
745c9d8bdc asahi: track batches with incoherent writes
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
98ffbf4cf6 asahi: rm blank
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:31 +00:00
Alyssa Rosenzweig
53e820f20e asahi: hoist layer id code
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
bbe6689108 asahi: hoist xfb code
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
ae6e1e3609 asahi: collapse if
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
757fd8be56 asahi: fix instance count with indirect draw
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
facc4b9a5e asahi: drop any_draws
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
ae3544eccd asahi: move some code into dirty tracking
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
c19325c229 asahi: optimize no changes descriptor case
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
1362ae38d4 asahi: optimize "no changes" case
drawoverhead case 1

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
8fc373370f asahi: collapse stage uniform upload
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
8ba151aa16 asahi: dirty track stage uniforms
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
6be7c5f889 asahi: split up stage uniform upload
so we can update incrementally

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
23b4503225 asahi: rewrite queries
1. always keep the query in gpu memory, so we can implement qbos properly.

2. use a lightweight data structure for tracking writers to reduce overhead

3. allow many writers per query to eliminate stalls

4. use context-wide occlusion heap, to satisfy #1 without introducing
   flushes or silly copies. this is what the pvr mesa driver does :-)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
ca58bc239a asahi: drop silly else
default

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
6ffbf77983 asahi: assert invariant
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
24b7fbca9d asahi: allow disk cache with compblit
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
8ab443d549 asahi: enable compblit behind dbg flag
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
07a4ff5810 asahi: track bit count, not word count
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
0aa3eaa944 asahi: rm dead
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
46c70b72ca asahi: skip set if tested
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
7eac18b1bc asahi: force inline ppp update logic
benefits a lot from constant folding.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
5982ae9025 asahi: fix vbo dirty track
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
668bf461b1 asahi: don't use util_resource_size
drawoverhead.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
d9c4fcce5f asahi: log geometry shaders separate from xfb
different perf issues.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
c6c8262ce1 asahi: implement pipeline stats as a checkbox
real impl is blocked on uapi to plumb thru hw perf counters.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
27d39bf544 agx: reassociate bcsel with ior/iand
fairly dramatic improvement to citra shaders, citra seems to be a % faster with
this.

total instructions in shared programs: 2910477 -> 2909192 (-0.04%)
instructions in affected programs: 983562 -> 982277 (-0.13%)
helped: 529
HURT: 1
Instructions are helped.

total bytes in shared programs: 19400010 -> 19392214 (-0.04%)
bytes in affected programs: 6785058 -> 6777262 (-0.11%)
helped: 529
HURT: 58
Bytes are helped.

total halfregs in shared programs: 519553 -> 519429 (-0.02%)
halfregs in affected programs: 1877 -> 1753 (-6.61%)
helped: 37
HURT: 12
Halfregs are helped.

total spills in shared programs: 135040 -> 135022 (-0.01%)
spills in affected programs: 135040 -> 135022 (-0.01%)
helped: 6
HURT: 0

total fills in shared programs: 342326 -> 342308 (<.01%)
fills in affected programs: 342326 -> 342308 (<.01%)
helped: 6
HURT: 0

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
b45d54a388 agx: optimize b2x(inot)
easier to do as algebraic rules.

total instructions in shared programs: 2915611 -> 2910477 (-0.18%)
instructions in affected programs: 285251 -> 280117 (-1.80%)
helped: 1245
HURT: 5
Instructions are helped.

total bytes in shared programs: 19439752 -> 19400010 (-0.20%)
bytes in affected programs: 1881556 -> 1841814 (-2.11%)
helped: 1244
HURT: 6
Bytes are helped.

total halfregs in shared programs: 519253 -> 519553 (0.06%)
halfregs in affected programs: 5509 -> 5809 (5.45%)
helped: 24
HURT: 107
Halfregs are HURT.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
34ca925064 agx: don't inline imms into stack_store
we need opt_large_consts..

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
f6c17cbe48 ail: use template for tiled memcpy
less macro hell

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
075e595058 ail: port tiling routines to c++
to fix macro hell

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
104ba72547 ail: add tests for linear<-->twiddled copies
based on the panfrost tests.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
2c9189434f docs/asahi: fix strided linear note
turns out linear 2d arrays work

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
f836d573e4 agx: only run early tests if needed
if it'd be early anyway don't bother, speeds up dolphin with spec shaders

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
7825044c39 asahi: honour discard_whole | persistent
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
793ac04077 asahi: handle read-only SSBOs
reduces silliness in Yuzu.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
97a945246c asahi: fix valid buffer tracking for SSBO/image/XFB
smaller ranges.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
6689b083d8 asahi: don't sync for uninitialized buffer
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00
Alyssa Rosenzweig
9e8ce4550c asahi: enable tcs caching
works fine

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
2024-02-14 21:02:30 +00:00