Commit graph

3839 commits

Author SHA1 Message Date
Georg Lehmann
cba575f4df nir: always emit ddx intrinsics
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31014>
2024-10-17 09:50:19 +00:00
Georg Lehmann
6cb6bc7133 elk: remove alu fddx/fddy check
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31014>
2024-10-17 09:50:19 +00:00
Kenneth Graunke
4cb67cb07a intel/brw: Use whole 512-bit registers in constant combining on Xe2
Xe2 increased the register size from 256-bits to 512-bits.  So we can
store 32 16-bit values in a register, rather than 16 values.  Prior to
this patch, we hadn't updated the pass, so the second half of each of
our registers was unused.

Backport-to: 24.2
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31499>
2024-10-15 18:14:37 +00:00
Kenneth Graunke
d9e5022650 intel/brw: Delete more Gfx8 code from brw_fs_combine_constants
These platforms are supported by elk, not brw.

Backport-to: 24.2
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31499>
2024-10-15 18:14:37 +00:00
Kenneth Graunke
dea61b7399 intel/brw: Fix register and builder size in emit_barrier() for Xe2
We were manually allocating 1 REG_SIZE for the barrier payload, which is
only half a register on Xe2.  This should eventually get allocated to a
whole register anyway, but it's awkward in the meantime.  Also, we were
zero-initializing the header using group(8, 0) which only initialized
half the register.  The rest of the fields are Reserved MBZ, so they're
likely unused and unread anyway - but it's better to zero-initialize
them so we don't get random undefined, miserable-to-debug behavior.

Backport-to: 24.2
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31499>
2024-10-15 18:14:37 +00:00
Kenneth Graunke
7c9eb8b289 intel/brw: Make a ubld temporary in emit_barrier()
Saves typing .exec_all() in a lot of places.

Backport-to: 24.2
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31499>
2024-10-15 18:14:37 +00:00
Kenneth Graunke
a9d9488788 intel/brw: Delete Gfx7-8 code from emit_barrier()
Those are supported by elk, not brw.

Backport-to: 24.2
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31499>
2024-10-15 18:14:37 +00:00
Kenneth Graunke
c747c1e1f4 intel/brw: Fix spill/fill count for load/store_scratch in SIMD32
Honestly, I don't know what I was thinking - we are emitting a single
spill/fill message here, but were counting it as 2 spill/fills in SIMD32
shaders.  So our eventual shader stat reporting would subtract the
number of spills and fills from send_count, and get a negative number,
wrapping around to just shy of UINT32_MAX.  That's way too many sends.

This is especially noticable on Xe2 which often uses SIMD32 shaders.

Backport-to: 24.2
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31499>
2024-10-15 18:14:37 +00:00
Marek Olšák
65ace5649b nir: reject unsupported component counts from all vectorize callbacks
If you allow an unsupported component count in the callback for loads,
nir_opt_load_store_vectorize will align num_components to the next supported
vector size, essentially overfetching.

This changes all callbacks to reject it. AMD will enable it in a later commit.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29398>
2024-10-15 05:50:24 +00:00
Marek Olšák
02923e237d nir: add hole_size parameter into the vectorize callback
It will be used to allow merging loads with a hole between them.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29398>
2024-10-15 05:50:24 +00:00
Caio Oliveira
b9787fcc80 intel/brw: Move emit_scan/emit_scan_step near its usage
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
0ba1159b0a intel/brw: Add SHADER_OPCODE_*_SCAN
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
9537b62759 intel/brw: Add SHADER_OPCODE_REDUCE
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
4361a08254 intel/brw: Reduce scope of has_source_and_destination_hazard
This predicate at the moment is only relevant during register
allocation, so move it there and the code can ignore virtual
instructions that were already lowered previously.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
bf9456753d intel/brw: Validate some instructions exists only up until some phases
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
affa7567c2 intel/brw: Add phases to backend
The general idea is to be able to validate that certain instructions
were lowered and certain restrictions were already handled.  Passes can
now assert their expectations, i.e. if a pass is mean to run after
certain lowerings or not.

The actual phases are a initial stab and as we re-organized the passes,
we may remove/add phases.

This commit just add some phase steps, later commits will make use of
them.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
21f78454bf intel/brw: Fix Gfx9 3-src validation to handle FIXED_GRF
Note this validation path is not being used at the moment, but will in a
later commit.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
3e8796b677 intel/brw: Print Non-SSA regs after NIR in debug output
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
2811cb2923 intel: Add statistic for Non SSA registers after NIR to BRW
This is going to be useful while we convert the NIR to BRW to produce
SSA definitions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
6db7d1af16 intel/compiler: Rename shader_stats structs
Add the `brw_` and `elk_` prefixes to the structs to avoid compilation
failure building with LTO ("violates the C++ One Definition Rule") when
the structs diverge.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30496>
2024-10-11 06:40:29 +00:00
Caio Oliveira
13d99979d2 intel/brw: Remove the remaining DO_SRC macro from EU validation
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
f1036da345 intel/brw: Add vstride/width/hstride to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
2251748aad intel/brw: Add dst/srcs register numbers to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
808b8b65b6 intel/brw: Add abs/negate to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
f6dbb72219 intel/brw: Add dst/src0 address_mode to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
e4440df2d8 intel/brw: Add pred/cmod/sat to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
be70d1f9b1 intel/brw: Add dst/srcs type to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
e0ba4ca166 intel/brw: Add dst/srcs reg file to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
3db1c3fc0e intel/brw: Add access_mode to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
3dc1f64e51 intel/brw: Add exec_size to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
853fe03470 intel/brw: Add has_dst to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
c394eb3111 intel/brw: Add num_sources to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
9cdb90e787 intel/brw: Add opcode to brw_hw_decoded_inst
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
76e177d87d intel/brw: Create a struct to hold a decoded brw_inst in eu_validation
For now it contains only the "raw" brw_inst.  Later patches will add
useful fields to it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
382bd4ce36 intel/brw: Add ERROR helper variant that returns to EU validation
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31296>
2024-10-11 04:13:48 +00:00
Caio Oliveira
a0ea2a656f intel/brw: Enable EU validation and compaction tests for Xe2
A few EU validation tests had to be updated to account for larger GRF,
extra supported types for 3-src instructions and the lack of AccWrEnable
in Xe2.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31299>
2024-10-01 16:03:35 -07:00
Caio Oliveira
8b1c5425a9 intel/brw: Update DPAS validation tests for Xe2
The main change is that in Xe2 DPAS instruction requires SIMD16.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31299>
2024-10-01 16:03:35 -07:00
Caio Oliveira
b4acc3fc42 intel/brw: Remove Gfx8- from test_eu_validate.c
These tests only run for Gfx9+.

Acked-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31272>
2024-10-01 21:16:54 +00:00
Sviatoslav Peleshko
57344052b6 intel/brw: Don't apply discard_if condition opt if it can change results
We can't just always negate the alu instruction's cmod, because negating
it can produce different results when the argument is NaN float. We can
still do that if the condition is == or !=.

Fixes: 0ba9497e ("intel/fs: Improve discard_if code generation")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11800
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31042>
2024-09-27 11:52:27 +00:00
Caio Oliveira
93c3780bc1 intel/brw: Skip per-primitive inputs when computing flat input mask
The per-primitive have their own separate section in the FS thread
payload, and are not considered when setting the mask in
3STATE_SBE's ConstantInterpolationEnable.

This is also consistent with what is done for brw_interp_reg().

Fixes
- dEQP-VK.mesh_shader.ext.misc.clip_geom_provoking_last
- dEQP-VK.mesh_shader.ext.misc.clip_geom_and_task_shader_provoking_last

Backport-to: 24.2
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11844
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31417>
2024-09-27 08:15:18 +00:00
Caio Oliveira
2455e2765a intel/brw: Add DUMP flag to brw_assemble
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31305>
2024-09-27 02:46:28 +00:00
Caio Oliveira
28ef0de250 intel/brw: Add SWSB MATH pipe to assembler
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31336>
2024-09-26 20:40:28 +00:00
Caio Oliveira
d12950539c intel/brw: Consider pipe when comparing SWSB in tests
When tests were added, there was a single pipe (float), so there wasn't
a pipe to compare in `operator==`.  Add it there now and adjust
expectations accordingly.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31335>
2024-09-25 19:32:31 +00:00
Lionel Landwerlin
2193d87277 brw: remove EOT handling from sampler messages
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31307>
2024-09-25 10:22:40 +00:00
Lionel Landwerlin
2ed4af057a brw: fix mask componentation for 16-bit sampler returns
We can't use register counts since 16-bit sampler loads in SIMD8 will
only write back half a GRF.

Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>
Fixes: 0116430d39 ("intel/brw: Handle 16-bit sampler return payloads")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31307>
2024-09-25 10:22:40 +00:00
Lionel Landwerlin
eeb5f6e8c8 brw: make sampler message emission more generic
We can generalize the simd8-16bits case by just rounding to a physical
register.

We also take the opportunity to limit the register allocation to a
single physical GRF for the residency data.

Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>
Fixes: 0116430d39 ("intel/brw: Handle 16-bit sampler return payloads")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31307>
2024-09-25 10:22:40 +00:00
Sagar Ghuge
7e48cbb029 intel: uncached L1 to fix memory barrier issue in RT shader
In the RT shader, if there's a executeCallableEXT() in between,
even though the called shader does nothing, the instructions before and
after the executeCallableEXT() is not properly synced.

Patch fixes:
- dEQP-VK.ray_tracing_pipeline.memguarantee.inside.rgen
- dEQP-VK.ray_tracing_pipeline.memguarantee.inside.chit
- dEQP-VK.ray_tracing_pipeline.memguarantee.inside.miss
- dEQP-VK.ray_tracing_pipeline.memguarantee.inside.call

Thank to Kevin for finding out there is a load/store issue.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31201>
2024-09-24 14:33:11 +00:00
Rohan Garg
56adf42110 intel/brw: lower math op regions for Xe2+
This helps fix:
  - dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_3.tan_frag
  - dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_2.tan_frag

Signed-off-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31218>
2024-09-24 09:58:28 +00:00
Caio Oliveira
e1b74407bb intel/brw: Only validate GRF boundary crossing restriction for GRFs
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31294>
2024-09-24 03:39:05 +00:00
Kenneth Graunke
878ae9708a intel/brw: Don't include sync.nop in INTEL_DEBUG instruction counts
In an earlier commit, I made us stop counting sync.nops in the shader
statistics we use for shader-db (brw_debug_log_message) and fossil-db
(stats->instructions = ...).  However, I missed adjusting the printout
for INTEL_DEBUG.

Fixes: 1497f4e0c2 ("intel/fs: Don't include sync.nop in instruction count statistics")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31311>
2024-09-24 03:12:32 +00:00