Commit graph

223548 commits

Author SHA1 Message Date
Faith Ekstrand
052a758cfb kraid/isa: Add a simple XML parser
The xml crate doesn't provide a DOM but it makes everything easier to
have one so let's hand-roll a super simple DOM for the ISA XML.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
99dd4d269f kraid: Add the start of encoder code-gen
This is structured both as a proc macro and as a stand-alone executable.
This gives us options for how we want to actually dispatch it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
cec49c3654 kraid: Add ISA XML for v9-15
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
3557f69ded subprojects: Pull in the Rust xml crate
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
237b648d88 kraid: Move proc/lib.rs to proc/macros.rs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
7a1ee1b66f kraid: Replace OpEnd with OpNop.end
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
688bcea2ba kraid: Add a FlowCtrl struct
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
19e19f2dc8 kraid: Copy the bitview module from nouveau
This should go somewhere common eventually.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
0af201122b kraid: Print ASM swizzles when we have them
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
16d3ad1820 kraid: Rework swizzles
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
1631ebbc5a kraid: Plumb through Model::encode_shader()
Of course, we can't actually encode anything yet but this gives us the
model hook and deals with the util_dynarray so that everything inside
the model hook is safe code.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
11ceef9295 kraid: Add a super simple register allocator
This RA will do okay for large flat blocks and should either assert or
correctly allocate.  However, it's nowhere near a real allocator.  It's
just enough to get us off the ground.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
0542a2870e kraid: Add a validator to check IR invariants
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
b4ac98fa25 Kraid: re-indent shaders for prettier printing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
03b206ec41 kraid: Handle a few NIR intrinsics
This is just enough to have working SSBOs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
00e2afdbb9 kraid: Implement nir_op_iadd
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
b2adfd28e9 kraid: Add some float alu ops
This also sets up the rest of the ALU op infrastructure, including
handling source swizzles coming in from NIR.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
2febabbd3c kraid: Handle nir_op_mov/vec/[un]pack
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
765b89ed2e kraid: Handle load_const instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
6cbdc95f2a kraid: Parse the NIR CFG
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
102795ce74 kraid: Start parsing NIR shaders
The parser doesn't actually do anything yet but now we have a framework
we can add stuff to.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
f8a4b912d0 kraid: Add a builder
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
45c7868e39 kraid: Add Instr, BasicBlock, and Shader structs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
e07f0b567c kraid: Add an Opcode trait and Op enum
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
3de388f652 kraid: Add Src/Dst data types
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
eaead919d5 kraid: Add SSAValue and SSARef structs
These is based on NAK but modified for what we need on Mali.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
292ec991a0 kraid: Add a swizzle struct
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
326c7b4382 kraid: Add DataType and NumericType enums
Most of the implementation of DataType is in a proc macro so we can walk
over all the variants programatically instead of having to hand-type a
bunch of potentially error-prone code.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
9b33ba5a73 kraid: Add a GPU model abstraction
This is sort of our version of pan_model.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:26 +00:00
Faith Ekstrand
d88b53075a panfrost: Add the basis for the new Kraid compiler
This adds some mostly empty rust files, bindings, meson bits, and a call
into kraid from the bifrost compiler, guarded by PAN_USE_KRAID=1.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:25 +00:00
Daniel Stone
abdd97e540 symbols-check: Ignore more pthread symbols
We have yet more pthread-related symbols to be marked as weak, as well
as statx as a fallback for older systems. Add these to the list along
with the rest of the related symbols, since we can't stop glibc from
exporting them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:25 +00:00
Faith Ekstrand
2a416638a8 panfrost: Initial rust build system support
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
2026-06-02 21:19:25 +00:00
Marek Olšák
a56079b302 radv: emit_rast_samples_state uses uses_vrs_attachment only on gfx11+
it's not used by previous gens

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:06 +00:00
Marek Olšák
dd8ca1d94d radv: make RAST_SAMPLES_STATE dirty in CmdBeginRendering only on gfx12+
older gens don't use the render state in radv_emit_rast_samples_state

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:06 +00:00
Marek Olšák
47398b57de ac/nir/lower_ps_early: remove now-unused lowering of sample_mask_in
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:06 +00:00
Marek Olšák
4b5852ad3f radeonsi: use ac_nir_lower_sample_mask_in
to use the same code as RADV

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:06 +00:00
Marek Olšák
d5c4fb763a radv: fix an inefficiency where the ANCILLARY PS VGPR was enabled but unused
This was probably enabled because sample_mask_in lowering used sample_id.
Now that the lowering is done before shader info gathering, this
inefficiency can be removed.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:06 +00:00
Marek Olšák
7ee7f889b4 radv: enable SAMPLE_COVERAGE PS VGPR dynamically
This increases the PS wave launch rate if it decreases the number of
initialized VGPRs to an even number depending on other states.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:06 +00:00
Marek Olšák
13547b1f87 radv: switch to ac_nir_lower_sample_mask_in
load_use_sample_mask_in_amd will be fully implemented in a later commit.

This is already more efficient because of using helper_invocation
in the pass.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:05 +00:00
Marek Olšák
e5723a61f2 ac/nir: add a new pass ac_nir_lower_sample_mask_in
This covers all the optimal lowering cases of sample_mask_in.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:05 +00:00
Marek Olšák
146d3d7e1f ac/nir/lower_ps_early: assume frag_coord_is_center is always true
RADV will never use this option because it lowers sample_pos in its own
pass.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:05 +00:00
Marek Olšák
c42e4a2fba ac/nir/lower_ps_early: remove obsolete comment
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:04 +00:00
Marek Olšák
ea5352b7d7 radv: ignore color attachment samples for ps_iter_samples
Sample shading is only affected by the number of rasterization samples.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41768>
2026-06-02 20:38:04 +00:00
Gleb Popov
6ae0114b05 Rename the CACHE_LINE_SIZE define to MESA_CACHE_LINE_SIZE
The former clashes with a define with the same name that comes from FreeBSD
base headers.

Closes #5737

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41906>
2026-06-02 20:04:20 +00:00
Karol Herbst
2ea31794f0 rusticl/program: wrap compiler option parsing
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41905>
2026-06-02 19:30:23 +00:00
Karol Herbst
01de0ff26f rusticl/program: store log as a CString
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41905>
2026-06-02 19:30:23 +00:00
Karol Herbst
d7674245e2 rusticl/kernel: store kernel names as CString
There is no reasons to have this as a rust string.

Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41905>
2026-06-02 19:30:23 +00:00
Karol Herbst
8711a88d96 rusticl/util: add Traits to help with usage of CString
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41905>
2026-06-02 19:30:22 +00:00
Karol Herbst
4fa798516e meson: enable more rust 2024 lints
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41905>
2026-06-02 19:30:22 +00:00
Emma Anholt
aa26be6ea9 tu: Move to using drirc_gen.
Slight reduction in boilerplate (driconf.h definition, tu_device.cc
parsing, tu_device.h instance definitions), plus validation that you don't
typo between 00-turnip-defaults.conf and tu_device.cc parsing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41877>
2026-06-02 18:49:48 +00:00