Alyssa Rosenzweig
19da2f6d30
asahi: sync with query mismatches
...
otherwise the following assertion can fail. fixes crash in yuzu trace.
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
3b927567ac
Revert "asahi: don't canonicalize nans/flush denorms when copying"
...
This reverts commit ab7fb3d400
.
This breaks ./arb_copy_image-formats -auto --samples=4 since we need the blit
path for compression transitions. The correct thing to do is cast the formats.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:30 +00:00
Asahi Lina
74110ef21d
asahi: batch: Trace before waiting for syncobj
...
If the render hangs, at least this way we get the trace.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:30 +00:00
Asahi Lina
ff900ceffe
asahi: Enable scratch debugging
...
Via ASAHI_MESA_DEBUG=scratch. This will assert if enabled and the
scratch workgroup allocation count turns out not to be sufficient (that
is, there were failed allocations), to help debug the max occupancy
calculation.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:30 +00:00
Asahi Lina
8845702f8c
asahi: Allocate scratch for shaders
...
Finally, now that scratch is available, tell the hardware how much we
need and allocate the scratch buffers as necessary.
We only do the max subgroup calculation for compute right now, and it's
probably conservative (we could probably calculate a reduced occupancy
depending on register pressure). Getting this too low won't break, the
GPU will just be less efficient if there is not enough scratch
allocated. Vertex and fragment just get the max 96 for now.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:30 +00:00
Asahi Lina
bb5277aa3d
asahi: Hook up scratch
...
Instantiate our 3 scratch managers for each shader type, and pass them
to the hardware if a batch uses scratch.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:30 +00:00
Asahi Lina
fa475c1b56
asahi: scratch: Add feature to debug core IDs
...
Define SCRATCH_DEBUG_CORES to a raw core count to bypass the mapping
machinery and allocate memory for many cores, so we can work out how the
core IDs are mapped.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:30 +00:00
Asahi Lina
494399c65c
asahi: Implement scratch allocation
...
Implement our helper program to map scratch blocks into stack memory,
and the driver side that allocates these blocks as necessary.
Alloction is grow-only right now. Drivers are expected to instantiate
scratch memory managers for each shader type (VS, FS, CS) and the same
buffers are reused across commands for each one, growing as necessary.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
da9677f14b
asahi: cmdbuf: Fix scratch bucket offset/size
...
This is 4 bits. It is an opaque value that gets passed to the
helper, except 0 means no scratch.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
d6cc820d1a
asahi: libagx: Move PACKED and GLOBAL macros to libagx.h
...
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
eec7c4beb8
agx: compiler: Enable stack_adjust
...
We'll need this once we start using scratch.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
1f1751d258
agx: compiler: Export scratch size to the driver
...
So it can configure the pipeline correctly, and allocate the required
scratch space.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
b89da92a5e
agx: compiler: Add fence_helper_exit_agx barrier
...
This is used by the helper program on exit.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
c406ce793b
agx: Add scaffolding to build the helper shader at device init
...
Add the scaffolding to compile our helper program, and load it at device
init time.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
05c8b59f5b
agx: Hook up helper intrinsics into CL
...
So we can use these intrinsicts from libagx.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
30862d7189
agx: Hook up AGX helper NIR intrinsics
...
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
b07dbf7b0f
nir: Add AGX-specific helper opcodes
...
These opcodes are used by the helper program to fetch the current
operation info and core ID.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
5d0f1ca77f
agx: Rename some SRs
...
I think these better represent what these SRs actually do.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Asahi Lina
28d34f6352
asahi: libagx: introduce AGX_STATIC_ASSERT
...
Using the array size trick, this works in both OpenCL and C.
Signed-off-by: Asahi Lina <lina@asahilina.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
8661006ef0
agx: add some more bitop 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:29 +00:00
Mary Guillemard
923767a968
agx: Add a bitop optimizer pass
...
Signed-off-by: Mary Guillemard <mary@mary.zone >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Mary Guillemard
2b89eb979e
agx: Fuse not into and/or/xor
...
Signed-off-by: Mary Guillemard <mary@mary.zone >
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Mary Guillemard
ba508fe854
agx: Remove and/or/xor pseudo ops
...
Switch back to bitop while keeping the aliases on agx_print_instr.
Also add all variants of 2 args of agx_bitop_table.
Signed-off-by: Mary Guillemard <mary@mary.zone >
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Mary Guillemard
a5b6ff3ccc
agx: Add more bitops in agx_bitop_table
...
Signed-off-by: Mary Guillemard <mary@mary.zone >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
62001e175f
asahi: fix UB in qbo's
...
upper bits may be uninitialized. fixes
KHR-GL46.transform_feedback_overflow_query_ARB when built with gcc (passed by
chance with clang).
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
a06b51559b
asahi: plug geometry heap leak
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
877c180677
asahi: plug glsl type leak
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
06cf222830
asahi: plug so target leak
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
e2c5a93358
asahi: plug early_serialized_nir leak
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
ffac4e7179
asahi: plug pre-gs leak
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
7b44d15e5f
asahi: plug geometry shader leaks
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
1e973dd5a9
asahi: rework meta shader infra
...
this fixes the leaks, and is also a lot more pleasant to work with.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
7eda3da983
asahi: plug passthrough tcs leak
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
e91c0b6423
asahi: delete bogus assertion
...
dEQP-GLES3.functional.fragment_ops.scissor.outside_render_line at certain render
sizes.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
5261962186
asahi: fix prim restart unrolling with indirects
...
need to account for draw->start.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
c0d3bf3608
agx: optimize vote_eq
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
0de7018879
agx: optimize first_invocation
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
fb81201a34
agx: implement active_subgroup_invocation_agx
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
311070f7af
nir: add active_subgroup_invocation_agx sysval
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
da924e2f03
agx: fuse ballot+cmp
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
def00f7bf0
agx: introduce ballot pseudo
...
for more opts
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
92dcf75fcd
agx: lower more subgroups
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
f52e0bd70b
agx: implement load_subgroup_invocation
...
There's an sr.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
6f7511b522
asahi: decode uniform_high records
...
print them like low 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:29 +00:00
Alyssa Rosenzweig
1ee9b8b668
asahi: optimize more when linking libagx
...
Otherwise we get spurious scratch from lower_vars_to_explicit_types on dead
vars.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
9287bec892
asahi: fix unbound ssbos
...
fixes null ptr dereference in arb_shader_storage_buffer_object-array-ssbo-binding
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
3a6083dea3
asahi: enable robustness
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
591ce607e0
asahi: implement reset queries
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
5dc0f5ccba
asahi: implement VBO robustness
...
GL semantics. GLES (weaker) and VK (stronger) semantics are left as a todo, with
explanations given. Enabled always to deal with null VBOs, this should be
optimized once we have soft fault.
This necessitates a rework of VBO keys, but hopefully for the best.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:29 +00:00
Alyssa Rosenzweig
4aadf67523
asahi: fix metadata for images with VS lowered to GS
...
KHR-GL46.shader_image_load_store.basic-allTargets-atomicVS
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616 >
2024-02-14 21:02:28 +00:00