Commit graph

16300 commits

Author SHA1 Message Date
Caio Oliveira
74d38a6271 intel/gen: Change validation test code to use the parser
Assisted-by: Pi coding agent (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41918>
2026-06-01 16:02:41 +00:00
Sid Pranjale
020a6bc282 vulkan: implement VK_EXT_debug_marker
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32722>
2026-06-01 15:31:38 +00:00
Kenneth Graunke
405c99d0a6 jay: Add URB load support
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41821>
2026-06-01 08:30:25 +00:00
Kenneth Graunke
9c8f7c481f brw: Fold constants after nir_lower_io for VS/GS/TES outputs
brw_nir_lower_deferred_urb_writes assumes that constant offsets will be
properly folded.  In brw itself we call the big optimization loop which
takes care of this, but jay doesn't do that in-between.

At any rate, nir_lower_io generates a lot of address math that really
ought to get cleaned up, so it seems like a good point to call it here.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41821>
2026-06-01 08:30:25 +00:00
Kenneth Graunke
fb99a109e4 brw: Fix mistake in brw_nir_lower_deferred_urb_writes
I meant to add these together, not put a random semicolon in the middle
of the expression which meant the offset got tossed on the floor.

Fixes: 6fbe201a12 ("brw: Convert VS/TES/GS outputs to URB intrinsics.")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41821>
2026-06-01 08:30:25 +00:00
Kenneth Graunke
c798a9df1c brw: Refactor urb_read_length setting for TES
We now calculate it when emitting push input loads at the NIR level,
rather than in the backend.

v2: Fix missing interaction with legacy tesslevel remapping

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> [v1]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41821>
2026-06-01 08:30:24 +00:00
Kenneth Graunke
4dfa11a9d6 brw: Ensure entire input load fits in push data
We were seeing if the start of the load was within the push range,
rather than the entire load.  (We could also split loads, but that
seems needlessly complex.)

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41821>
2026-06-01 08:30:24 +00:00
Kenneth Graunke
f4260b15cf brw: Fix URB read length for tessellation evaluation shaders
Calculate the end of our read as a byte offset and divide by the 32B
unit of URB reads.  We were calculating 1 byte beyond the start offset
and dividing by 8 (the number of 4 byte DWords in 1 unit of URB read).

Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41821>
2026-06-01 08:30:24 +00:00
Kenneth Graunke
887c04239f anv: Drop TES dispatch mode asserts
SIMD4x2 mode is only supported by elk which anv doesn't use.  iris
doesn't check this.  Eventually we should probably just demote the
dispatch_mode field to the stages that still need it.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41821>
2026-06-01 08:30:23 +00:00
Alyssa Rosenzweig
e22cdebfdc brw: nir_lower_constant_convert_alu_types only once
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40762>
2026-05-30 21:00:39 -07: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
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