Commit graph

1571 commits

Author SHA1 Message Date
Faith Ekstrand
500955b6cb nak: Only insert barriers around ifs if they actually re-converge
We don't care about patterns like

    loop {
        ...
        if (...) {
            break;
        } else {
            ...
        }
        ...
    }

In that case, we don't need to sync after the if because there's nothing
to re-converge.  Every path except one will end up breaking out of it
anyway.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26382>
2023-11-27 20:59:34 +00:00
Faith Ekstrand
804201a3d7 nak: Run rustfmt
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26382>
2023-11-27 20:59:34 +00:00
Faith Ekstrand
e93935dd04 nvk: Limit shader stages to supported stages
Fixes: c7c73d6d17 ("nvk: Enable subgroups features")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26382>
2023-11-27 20:59:34 +00:00
Faith Ekstrand
28ae3210e1 nvk: Wire up MESA_VK_VERSION_OVERRIDE
We'll probably drop this once we have Vulkan 1.3 but this makes it a bit
easier to test stuff right now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26359>
2023-11-24 19:33:15 +00:00
Thomas H.P. Andersen
73317bb706 nvk: use nvk_pipeline_zalloc
3b3b157961 removed setting the pipeline type
assuming that it was already set by nvk_pipeline_zalloc. That helper was
not actually being used, so this patch updates it to do so.

This does not fix anything as the NVK_PIPELINE_GRAPHICS = 0 anyway, so it
is just a code cleanup.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26329>
2023-11-22 04:19:35 +00:00
Mary Guillemard
5b45304624 nvk: Implement VK_EXT_primitives_generated_query
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26324>
2023-11-21 23:50:41 +00:00
Mary Guillemard
7bda83bdfc nvk: Disable flush on each queries and flush at the end
VTG_PRIMITIVES_OUT (VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT) seems to
always require a FLUSH_PENDING_WRITES.

This changes the behavior of every queries to ensure that we only flush
during end query.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26324>
2023-11-21 23:50:41 +00:00
Faith Ekstrand
81387ed131 nvk/codegen: Fragment shader builtins are noperspective
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26321>
2023-11-21 18:55:25 +00:00
Faith Ekstrand
354cf99869 nak: gl_FragCoord and gl_PointCoord are screen-space interpolated
This matches what the NVIDIA proprietary driver does.  It also fixes
rendering corruptions in Grand Theft Auto 3.

Fixes: c47488341e ("nak: Use load_interpolated_input for frag_coord")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10156
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26321>
2023-11-21 18:55:25 +00:00
Faith Ekstrand
12f6279c39 nak: Two more print fixes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26299>
2023-11-20 21:57:01 -06:00
Faith Ekstrand
9033df070e nak: Rework printing of texture and image dims
They're now printed as part of the op for textures and we've changed the
names to follow the PTX convention.  For buffers and cube maps, I had to
come up with my own thing but I think the result is okay.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:04 +00:00
Faith Ekstrand
3a20beab03 nak: Display memory type at the end for load/store ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:04 +00:00
Faith Ekstrand
6f76f4db9f nak: Make MemAddrType a part of MemSpace
This is similar to what we did with scopes and ordering.  Shared and
local memory can only have an A32 address type.  The only times we can
get A64 is for global or generic.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:04 +00:00
Faith Ekstrand
6c861c3cc2 nak: Display memory access bits with the "." prefix
This just moves the "." from the caller to the Display implementation on
the actual enum type.  This makes it easier to properly handle defaults.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Faith Ekstrand
3d2104dd5d nak: Align instructions when printing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Faith Ekstrand
32d6720bb0 nak: Only write deps.delay when set
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Faith Ekstrand
3f027f7dcc nak: Default InstrDeps::delay to 0
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Faith Ekstrand
58c8391f97 nak: Implement DisplayOp on Op instead of Display
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Faith Ekstrand
9d1afb7533 nak: Rework opcode printing to use a new trait
The new trait has separate fmt functions for dsts and the rest of the
op.  There's a generic implementation of Display built on top of it
which just prints `{dsts} = {op}`.  The new trait also has a default
implementation of fmt_dsts() which just walks the dsts using
dsts_as_slice() and auto-formats them all.  This should be what we want
for 95% of cases and we can hand-implement the rest.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Faith Ekstrand
503c4b1d5d nak: Make most Display stuff lower-case
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Faith Ekstrand
2897b9dcee nak: Rework reg and SSA value printing
This makes everything lower-case, unifies on better prefixes, and makes
us take less whitespace for SSA vectors.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26291>
2023-11-20 21:36:03 +00:00
Mary Guillemard
275afe73f7 nvk: Implement VK_KHR_fragment_shader_barycentric
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9619

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26224>
2023-11-18 02:46:47 +00:00
Mary Guillemard
7fb91f22d5 nak: Add more bits discovered in SPH
This adds barycentric related bits and various others.

We still need to figure out the bits between 640..672, 800..1024 and checks
some "reserved" bits. (especially around the GS passthrough bit)

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26224>
2023-11-18 02:46:47 +00:00
Faith Ekstrand
62006c2f96 nvk: Advertise the rest of the subgroup ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>
2023-11-18 01:09:33 +00:00
Faith Ekstrand
1bc865ca8a nak: Implement quad ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>
2023-11-18 01:09:33 +00:00
Faith Ekstrand
cca40086c6 nak: Lower scan/reduce in NIR
We can probably do slightly better than this if we take advantage of the
predicate destination in SHFL but not by much.  All of the insanity is
still required (nvidia basically emits this), we just might be able to
save ourslves a few comparison ops.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>
2023-11-18 01:09:33 +00:00
Faith Ekstrand
11bcce9461 nak: Use c == 0x0 for shuffle_up
The bounds check on SHFL.UP is from below, so we actually want
maxLane == 0.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>
2023-11-18 01:09:33 +00:00
Faith Ekstrand
8c79d616bd nak: Add builder helpers for a few ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>
2023-11-18 01:09:33 +00:00
Faith Ekstrand
c874db9381 nak: Add the predicate destination to OpShfl
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>
2023-11-18 01:09:33 +00:00
Faith Ekstrand
3cc389f3da nvk: Set the right API version in the ICD json files
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>
2023-11-18 01:09:33 +00:00
Faith Ekstrand
cd543c94fd nvk: Advertise VK_KHR_synchronization2
We've already got everything, we just need to turn it on.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9657
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26245>
2023-11-17 05:32:55 +00:00
Faith Ekstrand
7f6d3b82c8 nvk: Implement bufferDeviceAddressCaptureReplay
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10158
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26242>
2023-11-17 03:07:02 +00:00
Faith Ekstrand
b4cfac64c8 nvk: Add a separate VMA heap for BDA capture/replay
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26242>
2023-11-17 03:07:02 +00:00
Faith Ekstrand
78eee47471 nvk: Handle VMA allocation failure
The chances of these happening is slim to none right now but, the moment
we throw VK_KHR_buffer_device_address into the mix, failure becomes much
more of a real possibility.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26242>
2023-11-17 03:07:02 +00:00
Faith Ekstrand
0052f1a6fe nvk: Rework error handling in nouveau_ws_bo_new() and from_dma_buf()
Add static _locked versions of both functions which can do the usual
goto cascade for error handling and wrap them in exported functions
which take a lock, call _locked, drop the lock, and return.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26242>
2023-11-17 03:07:02 +00:00
Faith Ekstrand
ce1cccea98 nvk: Drop nouveau_ws_bo_new_tiled()
It's no longer used.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26242>
2023-11-17 03:07:02 +00:00
Faith Ekstrand
7e00380445 nvk: Implement VK_KHR_pipeline_executable_properties
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9621
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26241>
2023-11-17 00:12:36 +00:00
Faith Ekstrand
3b3b157961 nvk: Don't set pipeline->base.type manually
It's already set by nvk_pipeline_zalloc().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26241>
2023-11-17 00:12:36 +00:00
Faith Ekstrand
faadac57d5 nak: Support dumping shader assembly as part of compile
This dumps it to a string that gets attached to the nak_shader_bin.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26241>
2023-11-17 00:12:36 +00:00
Mary Guillemard
ae17145882 nak: Rewrite nir_intrinsic_load_sample_pos and implement nir_intrinsic_load_barycentric_at_sample
nir_intrinsic_load_sample_pos was causing failures on barycentric CTS tests.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26239>
2023-11-16 22:12:29 +00:00
Mary Guillemard
8d8d93fab9 nak: Pass offset to load_frag_w
This fix IPA.OFFSET getting an undef for the offset and restore previous
behavior.

Fixes: 618bdb8571 ("nak: Rework FS input interpolation")
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26239>
2023-11-16 22:12:29 +00:00
Faith Ekstrand
1f582bad0a nak: Stop passing undefs to ipa_nv
The undefs get ignored so they technically don't hurt anything. This
mostly just lets them CSE better

Fixes: 618bdb8571 ("nak: Rework FS input interpolation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26239>
2023-11-16 22:12:29 +00:00
Faith Ekstrand
0bd23d6263 nak: Enable SM70 for Volta
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26212>
2023-11-15 13:38:04 -06:00
M Henning
aedf9113c4 nak: Set "evict first" from ACCESS_NON_TEMPORAL
This matches the way ptxas sets this hint.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26201>
2023-11-15 17:48:29 +00:00
M Henning
adc3fd4c99 nak: Add encodings for cache eviction priorities
We were previously setting "evict first" everywhere, which could
possibly be a perf issue on machines that are also running shaders
compiled with codegen, which sets "evict normal" on everything.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26201>
2023-11-15 17:48:29 +00:00
Faith Ekstrand
23e1f3c373 nvk: Use nak_shader_info natively
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
2023-11-15 02:24:13 +00:00
Faith Ekstrand
c074ea6215 nak: Handle the num_gpr offsetting inside nak
This makes the thing in the nak_shader_info exactly the thing that gets
plugged into the hardware.  Makes the driver a bit simpler.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
2023-11-15 02:24:13 +00:00
Faith Ekstrand
d8551cd328 nak: Add a writes_layer bit to nak_shader_info::vtg
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
2023-11-15 02:24:12 +00:00
Faith Ekstrand
a232050204 nak: Move clip, cull, and XFB into a nak_shader_info.vtg
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
2023-11-15 02:24:12 +00:00
Faith Ekstrand
440adf7970 nak: Properly prefix nak_xfb_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
2023-11-15 02:24:12 +00:00