Commit graph

223366 commits

Author SHA1 Message Date
Faith Ekstrand
f279bcdaef nak: Allow SSA value 0 again
We no longer need the index to be non-zero because we add 17.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41462>
2026-05-30 01:20:10 +00:00
Faith Ekstrand
8629f5cb3e nak: Use LowerBoundedU32 for SSAValue
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41462>
2026-05-30 01:20:10 +00:00
Faith Ekstrand
e6bc41ed44 compiler/rust: Add LowerBoundedU32[Array] types
This is a generalization of NAK's SSAValue and SSAValueArray structs.
But instead of depending on NAK's bespoke invariants, this depends on
something far simpler: A lower bound on the u32.  As long as you can
guarantee that the maximum array length is strictly less than the
minimum U32 value, we can pull the same trick as NAK and generalize it
into a LowerBoundedU32Array type.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41462>
2026-05-30 01:20:10 +00:00
Faith Ekstrand
48b234d78b meson: Bump the minimum rust version to 1.85.0
Acked-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41462>
2026-05-30 01:20:10 +00:00
Caio Oliveira
181eaee52e brw: Remove old encoder, generator and related tools
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
15e53be9c9 intel/compiler: Add and use gen_update_reloc_imm()
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
f5eb84daf8 iris: Use gen_print instead of brw_disasm
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
159ab10712 intel/tools: Use gen_print instead of brw_disasm
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
4010129227 anv: Use gen_print instead of brw_disasm
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
ddc9383eed brw: Make brw_generator an implementation detail of brw_to_binary.cpp
Now that every caller goes through brw_to_binary(), brw_generator has
a single user (brw_to_binary.cpp itself).  Move the class definition
into that .cpp inside an anonymous namespace and delete the header,
so it can no longer leak into other translation units.

No functional change.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
74583d3db6 brw: Add brw_to_binary() as the single codegen entrypoint
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
24e8921b3d brw: Use the new gen based generator
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
a20f7432a6 brw: Port the copy of generator to use gen_encoding
This port tries to keep the same structure and still uses a lot of
brw_reg, converting types at the last moment.  The idea is to make
easiert to verify the change.  A later patch will convert to use
gen_operand and other types earlier.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
266d80e1c0 brw: Make a copy of brw_generator for using gen
It is convenient for us to have the new code in a different file (for
various validation tasks).  So first make a copy of the current generator
to a new file that later will be updated to use the gen module.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
0952a56da0 intel/executor: Update to use gen module
Assisted-by: Pi coding agent (opus-4.7)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
677f643491 intel/decoder: Convert to use gen module
Assisted-by: Pi coding agent (opus-4.7)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
cb0227ab27 jay: Use gen module
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
2117be441c jay: Use gen_condition enum and helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
f52a360399 brw, jay: Use various enums from gen instead of brw
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
9e3d70408d brw, jay: Use gen_sfid instead of brw_sfid
Tweak jay_opcodes.py to add a padding because gen_sfid is packed now.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
2ee7f796f5 brw, jay: Use gen_swsb and related enums
These are the same as brw ones, just with a new name.  Also
make all the code use the same gen_print_swsb() helper.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
f97fbc36d9 brw, jay: Use lsc_* symbols from gen
Also use the new structs for collecting desc/ex_desc information.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
03ea848277 intel/compiler: Stop forcing null destination HSTRIDE=1 on pre-xe SEND in brw_asm "compat" mode
Remove the compatibility handling from gen and update the expected
results for the relevant parser tests.

This was the last remaining quirk in the "compact" mode, so also remove the
INTEL_BRW_ASM_COMPAT env var plumbing.

Assisted-by: Pi coding agent (opus-4.7)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
8d0c16e4fc intel/compiler: Stop forcing null source <0;1,0> region in brw_asm "compat" mode
Remove the compatibility handling from gen and update the expected
results for the relevant parser tests.

Assisted-by: Pi coding agent (opus-4.7)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
4a0a34a981 intel/compiler: Stop replicating narrow immediate values in brw_asm "compat" mode
Remove the compatibility handling from gen and update the expected
results for the relevant parser tests.

Assisted-by: Pi coding agent (opus-4.7)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
2e5040b013 brw/tests: Port assembler tests to gen module
Convert test inputs to the new syntax maintaining the previous expected
files untouched.

This uses the previously added compatibility mode when running those
tests.  A later patch will remove those quirks and adjust the expected
files accordingly.

Assisted-by: Pi coding agent (opus-4.7)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
6139c10334 brw: Add temporary workarounds for compatibility with old parser
To convert tests to the new syntax maintaining the previous expected
files untouched,  There are a few quirks with old parser that we are
adding temporarily to the gen module (behind an env variable):

The quirks:
- Small integer immediates encoding their value also in the upper half
  of the 32-bit immediate field.
- Pre-Xe default `null` source region to <0;1,0>.
- Pre-Xe SEND normalizing destination stride from 0 to 1.

None of those quirks should be needed, at least for the parser.  A later
patch will remove those quirks and adjust the expected files accordingly.
This separation was done to make verification easier in the main patch
that ports the tests to a new syntax.

Assisted-by: Pi coding agent (opus-4.7)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
1db8559504 intel/gen: Add integrated gentool CLI for asm/disasm
Support for assembly and disassembly with the new syntax,
helper to show register regions in ASCII "diagramas", and
cheat sheet for the new syntax.

Assisted-by: Pi coding agent (gpt-5.5, opus-4.6)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Caio Oliveira
e962477875 Revert "intel/dev: Remove unused intel_get_device_info_for_build() function"
This reverts commit 0cc89ca03a.

This allows to use PCI IDs without having to set INTEL_FORCE_PROBE environment
variable.  Useful for tests and tools, I'm assuming the original user of it is gone
or out-of-tree.

Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Jordan Justen
82b68cc7cc intel/gen: Implement uncompact support
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Jordan Justen
62c1e64c3f intel/gen: Split out type decode functions for use with uncompact
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Jordan Justen
8841685896 intel/gen: Implement compact support
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:54:00 +00:00
Jordan Justen
d08e84c3e6 intel/gen: Add gen_compact_accessor for compact/uncompact
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Jordan Justen
381f9f56d1 intel/gen: Add gen_raw_compact_inst type
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Jordan Justen
bae944fc98 intel/gen/compact: Add compact tables from brw/brw_eu_compact.c
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Caio Oliveira
a07f953c2f intel/gen: Add gen_parse()
Assisted-by: Pi coding agent (GPT-5.5, Opus-4.7)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Caio Oliveira
4a178882e8 intel/gen: Add gen_print()
Assisted-by: Pi coding agent (gpt-5.5, opus-4.7)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Jordan Justen
a071dff770 intel/gen: Make use of generated instruction info
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Jordan Justen
558348d7ec intel/gen: Create gen_info_util.h
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Jordan Justen
068ea94ca3 intel/gen: Add gen_inst_info.py script to generate C++ headers
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:59 +00:00
Jordan Justen
8b59d133ec intel/gen: Add gen 9 through Xe2 instruction formats in JSON
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:58 +00:00
Caio Oliveira
11dde62fcc intel/gen: Add function to finish structured control flow
Given an array of gen_insts representing a structured program,
fill in the missing JIPs and UIPs to follow that structure.

The input array must provide JIPs for the WHILE instructions (the
"back-edges", since there's no DO in Gfx9+).  It optionally can
provide other JIPs or UIPs, their values will be used instead of
the calculated one.

The input JIPs and UIPs are absolute index values in the array,
and after finish they will be converted into relative byte offsets,
which is what the hardware will use.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:58 +00:00
Caio Oliveira
b35a6008e2 intel/gen: Add validation
Port the validation rules from brw_eu_validate.cpp.  This also
ports the tests of the validation, so we can check whether the
rules actually flag the cases.

Also include some new validation cases derived from asserts in
brw_eu encoding logic.

Assisted-by: Pi coding agent (gpt-5.5, opus-4.6)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:58 +00:00
Caio Oliveira
596d18bbf7 intel/gen: Add various to_string/from_string functions
String with explicit size will be useful for the parser code later.

Assisted-by: Pi coding agent (Opus-4.7)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:58 +00:00
Caio Oliveira
03c32e90a9 intel/gen: Add gen encoding module
Add a new module that can produce the binary encoded representation of
the instructions.  Some key differences from existing encoding logic
in brw:

- Use a struct to represent the instructions before final encoding.
  This is similar to the struct we already use in validation.  This
  allows generator/validation code to ignore details of instruction
  formatting and just "set src0 to something".

- Split the encoding logic between Pre-Xe (Gfx9 and Gfx11) and Xe (from
  Gfx12 and up).  They are documented differently, so splitting makes
  both sides easier to deal with.

- Try to follow the bit range numbers as they are documented in the
  spec, programatically shifting them when needed.  This means numbers
  in code match PRMs / BSpec.

Later patches will add compaction and make use of the module in various
parts of the code.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41413>
2026-05-30 00:53:58 +00:00
Karol Herbst
87b5340831 nir/opt_dead_write_vars: cache is_entrypoint of the function
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
ends_program calls into nir_cf_node_get_function repeadtly to fetch the
same function and to check whether we are inside an entry point or not.

But we already got the information higher up the chain so use that
instead.

nir_cf_node_get_function is quite expensive, because it follows pointers
through the tree.

Speeds up compilation of more complex shaders by quite a bit. I am seeing
a 66% cut of compilation time spent in e.g. llama-bench.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41891>
2026-05-29 22:58:00 +00:00
Lionel Landwerlin
e24dc5bd1e anv: fake VK_EXT_image_compression_control on Xe2+
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We're required to support this extension for Android VP17.

We've tried supporting it through the use of
CMF_DISABLE_WRITE_COMPRESSION but some regressions are measures
(-0.5~-1.0%).

We're not aware using CMF_DISABLE_WRITE_COMPRESSION would prevent any
application bug so it doesn't feel useful to implement.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41187>
2026-05-29 23:50:54 +03:00
Lionel Landwerlin
2218581c95 anv: move compression control drirc to feature section
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41187>
2026-05-29 23:49:48 +03:00
Lionel Landwerlin
b6a582cdf1 anv: move fake_sparse drirc to feature category
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41187>
2026-05-29 23:49:48 +03:00
Lionel Landwerlin
3c340e0b7c anv: rename drirc script
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41187>
2026-05-29 23:49:47 +03:00