Commit Graph

190608 Commits

Author SHA1 Message Date
Faith Ekstrand
00c6244ca2 nak/sm70: Implement a bunch of uniform ops on SM75+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
7359c214b7 nak/sm70: Fix encoding of fadd/fsetp and friends with UGPRs
UGPRs are treated more like CBufs or immediates so we want to use the
default encoding in the UGPR case and only use the reg encoding in the
zero or GPR case.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
21b1eb8da7 nak/sm70: Add support for encoding uniform ALU ops
This requires a pretty significant rework of encode_alu_base().  In
particular, we can't know the register file that's going to be used
until we get into encode_alu_base() so ALUSrc::from_src() can't handle
Zero itself.  Instead, we defer to a new ALUSrc::with_op_uniformity()
helper which does a postprocess step.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
8d2d2db6a0 nak/sm70: Rework ALU source encode helpers
We have a LOT of repeated bit numbers here and it helps if we can reduce
that a bit by making helpers for each thing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
1ae83135af nak/sm70: Defer ALU src processing until encode_alu()
This makes encode_alu() take Option<&Src> and call ALUSrc::from_src()
itself.  This is necessary for handling uniform ALU correctly as we
can't actually separate Reg from UReg without knowing what kind of ALU
op we are.  While we're here, take an Option<&Dst> instead of
Option<Dst>.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
e244f7bb44 nak: Support uniform regs in lower_copy_swap()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
130392e7ab nak/ra: Never move uniform regs in non-uniform blocks
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
11670be661 nak/ra: Spill UGPRs and UPreds
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
1334cf8fca nak/to_cssa: Resolve phi register file mismatches
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
1ed59706ea nak: Add a concept of uniform blocks
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
d7f544365d nak: Drop BasicBlock::new()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
f0ec1873df nak: Make SSARef::file() return Option<RegFile>
Once we start using UGPRs, it's possible to have a vector with a mix of
GPRs and UGPRs.  This isn't actually allowed by the hardware but it's
possible as an intermediate state thanks to copy-propagation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
d3e9373a90 nak/ra: Move an assert
We're allocating one register file at a time and our invariants are
per-file so we don't want to check the components assumption until we've
checked that it uses the active file.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
e0b051da39 nak: Clean up bindless cbuf handles
Take an SSARef instead of an SSAValue because they need to be vec2s.
Also, rename BindlessGPR to BindlessUGPR because that's what it is.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
35b445ba27 nak: Add OpR2UR
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
ebd16d1a56 nak: Add some helpers for uniform instructions and registers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
0f70b14d9a nak: Expose a BasicBlock::map_instrs() helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
fe2b06395e nak: Get rid of OpINeg
Instead, do the same thing we do for float modifiers and use OpIAdd2 or
OpIAdd3.  This makes for a little more work in copy-prop but the extra
opcode and lowering pass just isn't worth it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
a08f8c8804 nak: Only copy-prop neg into iadd2/3 if no carry is written
Fixes: 1b3382b861 ("nak: Add modifier propagation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
0a089b1b13 nak: BMov is always variable-latency
The barrier half is HW scoreboarded by the GPR isn't.  When moving from
a GPR to a barrier, we still need a token for WaR hazards.

Fixes: 7cd9680554 ("nak: Add back OpBMov with better semantics")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
61be2c94dc nak: Fix BasicBlock::phi*() for OpAnnotate
They assumed that phis would be at the start of the block which isn't
true if there are annotations in the way.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
944365802f nak: Only convert the written portion of the buffer in NirInstrPrinter
Fixes: 02774be708 ("nak/sm50: add a memstream abstraction")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
70b381e928 nak: Fix NAK_DEBUG=serial for warp barriers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:44 +00:00
Faith Ekstrand
290cbf413c nir/print: Improve divergence information
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:44 +00:00
Heinrich Fink
222fbcbfd5 zink: remove workaround of FB modifiers forcing present state
Remove a legacy workaround where presence of modifiers in framebuffer
state results in `needs_present` to be set without a good reason.

This prevents hitting an assertion for framebuffers that use DRM
modifiers, e.g. via GBM BO alloc -> EGLImage import -> GL FBO bind.

Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Heinrich Fink <hfink@snap.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29715>
2024-06-13 20:44:28 +02:00
Timothy Arceri
4c3d1a09de nir: add additional opt_loop_merge() test of deref handling
Here we test the rematerialization of the deref produces valid nir
when both the deref and array index value are moved to the else branch of
the first terminator during the merge.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29686>
2024-06-13 15:00:35 +00:00
Timothy Arceri
abb51f449d nir: test opt_loop_merge_terminators() skips unhandled loops
This test makes sure the merge if pass skips loops with trainling phis
as those are not handled by the pass.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29686>
2024-06-13 15:00:35 +00:00
Timothy Arceri
b26ef8f153 nir: correctly track current loop in nir_opt_loop()
We were not restoring an outer loop as the current loop after we had
finished processing a nested loop.

Fixes: 9995f336e6 ("nir: add merge loop terminators optimisation")

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29686>
2024-06-13 15:00:35 +00:00
Timothy Arceri
3d2a821198 nir: add test for opt_loop_merge_terminators
Makes sure we correctly rematerialize derefs moved during the merge.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29686>
2024-06-13 15:00:35 +00:00
Rhys Perry
92af96e0b3 nir/opt_loop: fix formatting
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29686>
2024-06-13 15:00:35 +00:00
Rhys Perry
cb51a93c1e nir/opt_loop: rematerialize derefs instead of creating phis
Fixes NIR validation of hogwarts_legacy/00ac08423ad6e422.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 9995f336e6 ("nir: add merge loop terminators optimisation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29686>
2024-06-13 15:00:35 +00:00
Eric Engestrom
ea97397296 turnip+zink/ci: mark dEQP-GLES3.functional.fbo.depth.depth_test_clamp.* tests as fixed
Fixes: 96ed275a53 ("turnip: Implement VK_EXT_depth_clamp_zero_one")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29717>
2024-06-13 14:20:18 +00:00
Sergi Blanch Torne
b24dd1fa1c ci: Fix parse GitLab pipeline url
When the namespace have a dash, this method cannot recogniza properly
the fields in a url. Better to use a regular expression quickly defining
the fields. The exception raised, when the pattern is not recognized
would help more the handler.

Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29683>
2024-06-13 14:10:57 +00:00
Eric Engestrom
f1fdba2432 lavapipe/ci: document regression while it's being worked on
Regression caused by !28998

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29712>
2024-06-13 13:47:43 +00:00
Boris Brezillon
e2f13e7d41 panvk: Don't bail out when allocationSize is zero in AllocateMemory()
"
VUID-VkMemoryAllocateInfo-allocationSize-07897
If the parameters do not define an import or export operation,
allocationSize must be greater than 0
"

That means allocationSize can be zero if we're importing, so we need
to proceed with the import instead of bailing out.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29670>
2024-06-13 14:48:40 +02:00
Mary Guillemard
58e6c8f6c8 pan/lib, panvk: Ensure data_size is on 64 bits
It was previously possible to overflow the data_size calculation (for
example with width=4096, height=4096, array_size=256 and any format)

This was then causing GetImageMemoryRequirements2 to return a size of 0.

Fix "dEQP-VK.pipeline.*.render_to_image.core.2d_array.huge.width_height_layers.r8g8b8a8_unorm" failures.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29670>
2024-06-13 14:48:32 +02:00
Boris Brezillon
c184059005 panvk: Fix Cube/2DArray/3D img -> buf copies
Not that I really care about fixing copies now that vk_meta_copy is on
its way, but it fixes OOB accesses causing new crashes after the
panvk_mempool changes.

Fixes: f73ae1a6b5 ("panvk: Implement vkCmdCopyImageToBuffer()")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29670>
2024-06-13 14:48:26 +02:00
Boris Brezillon
368d30befc pan/bi: Fix dynamic indexing of push constants
Base offset of the push constant access shouldn't be taken into
account when selecting the push constant words to load. We should
instead assume the first word in the range is the base of the
dynamic indexing, which also simplifies the code.

Fixes: d53e848936 ("pan/bi: Lower load_push_constant with dynamic indexing")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29670>
2024-06-13 14:48:18 +02:00
Boris Brezillon
87f89e4dec pan/bi: Make sure global loads/stores don't exceed 16 bytes
This is the granularity of global loads/stores. Since all other type
of memory accesses have the same or even smaller constraints, we don't
even bother testing the intrinsic type.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29670>
2024-06-13 14:48:09 +02:00
Boris Brezillon
bf8e17d5bb panvk/ci: Flag exact_sampling.*.edge_right test as fails
d91d2c275e ("panfrost: change default rounding mode for samplers")
changed the default coordinate rounding mode to nearest-even, which is
what we should use in Vulkan. But it turns out the CTS picks a value
that's too close to pixel edge on right_edge tests, which causes a
precision loss on coordinate rounding and leads to an off-by-one
on these tests.

Flag those as failing until the CTS is fixed to take subpixel precision
into account when selecting the pixel coordinate offset.

See https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/5168.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29670>
2024-06-13 14:48:02 +02:00
Boris Brezillon
bf8652b8f0 panvk: Fix formatting around OpaqueCaptureAddress implementation
Make clang-format happy, again.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29670>
2024-06-13 14:47:53 +02:00
Lionel Landwerlin
86813c60a4 mi-builder: add read/write memory fencing support on Gfx20+
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
3b88a77b45 genxml: add MI_MEM_FENCE for Gfx20
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
5b4278ccd8 anv: use new mi-builder write check API to avoid stalls
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
59f11ef774 anv: set query mi-builder mocs only once
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
4f50cc12b9 anv: use default mocs for memory bits only touched by CS
Since we don't need to share that data with other fixed functions.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
c343cfc8b1 anv: move more MI_SDI to mi_builder
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
d056f36fab anv: use the new relocated write mi-builder api
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
3e4f6def87 anv: centralize mi_builder setup
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00
Lionel Landwerlin
243ced4eb2 mi-builder: add a write check parameter
All the MI_SDI currently have forced write checks (meaning the command
streamer will stall until completion) on Gfx12.0+.

Now on Gfx12.0/12.5, the read commands have implicit waits on previous
writes (BSpec ). So if we're only dealing with CS writes & reads, we
don't need forced write checks.

In the few cases where CS is writing data for other bits of HW, we
need the forced write checks. This change adds an API that will let
the driver decide when to enable forced write checks.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29571>
2024-06-13 11:04:31 +00:00