Commit graph

1337 commits

Author SHA1 Message Date
Eric Engestrom
860b262f44 microsoft/clc: fix incorrect changes that got through while the Windows CI was down
Fixes: e80d52223e ("microsoft: Use spirv_capabilities for spirv_to_dxil")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29137>
2024-05-10 20:52:21 +00:00
Alyssa Rosenzweig
e0aa70bd55 dzn: use common stype debug
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29009>
2024-05-10 18:49:38 +00:00
Faith Ekstrand
e80d52223e microsoft: Use spirv_capabilities for spirv_to_dxil
Note: This change doesn't actually affect dozen a it uses
vk_shader_module_to_nir() so caps will be exposed based on Vulkan
features rather than the manual table.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Iván Briano <ivan.briano@intel.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28905>
2024-05-09 01:14:23 +00:00
Faith Ekstrand
4b3561b14d spirv: Move the printf enable out of capabilities
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Iván Briano <ivan.briano@intel.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28905>
2024-05-09 01:14:22 +00:00
Karol Herbst
d22f936019 nir: remove workgroup_id_zero_base
This removes the need for drivers to handle both versions. The base will
get added once in nir_lower_system_values when converting from deref to
intrinsic and will be replaced by a zero for users not supporting it.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26800>
2024-04-24 20:18:49 +00:00
Karol Herbst
3217838fef nir: remove global_invocation_id_zero_base
This removes the need for drivers to handle both versions. The base will
get added once in nir_lower_system_values when converting from deref to
intrinsic and will be replaced by a zero for users not supporting it.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26800>
2024-04-24 20:18:49 +00:00
Mike Blumenkrantz
38c5a722c2 microsoft/compiler: set compact_arrays in compiler options
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28554>
2024-04-05 17:56:28 +00:00
Jesse Natalie
c891a384e7 dzn: Don't copy app indirect args if we don't need to
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
db16dcf0f9 dzn: Add a hash table of command signatures with non-default strides
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
d7bd87aa27 dzn: Rework indirect drawing keys for shaders and command signatures
When we don't need emulation of first vertex, base instance, draw ID
sysvals, or triangle fans, we can have very simple command signatures
and indirect arg buffer generation shaders. The next step is to handle
the case where everything can be supported straight from the app's
buffer.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
ccf439629f dzn: Update pipeline cache params to take all options into account
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
4de88025cc dzn: Understand whether first-vertex and base-instance are needed for a pipeline
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
fbd4e5d8aa dzn: Query options21
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
ed465bf738 dzn: Delete dzn structs for indirect draw args and use D3D ones
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
f6c3d73700 spirv2dxil: Output more specific metadata for whether draw sysvals are needed
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
30b1a6750c spirv2dxil: Support passing first vertex / base instance to DXIL backend
These values now have 3 modes of operation so switch from a bool to an enum:
1. Zero
2. Native DXIL sysvals
3. "Runtime data" via a constant buffer or root constants

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
607720151f microsoft/compiler: Handle base vertex/instance sysvals as DXIL intrinsics
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
2024-04-05 00:25:41 +00:00
Jesse Natalie
c21355260b microsoft/compiler: Add a fractional var mask for variable sorting
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
33735585a9 d3d12: Lower uniforms to UBO by nir options
Ubo0 is tricky. It exists if there were any uniforms when
lower_uniforms_to_ubo was run. If we try to run that ourselves,
it might be too late and DCE/remove_dead_variables might've been run,
which removed the uniforms and their accesses, without decrementing
num_uniforms. So we have no good way of knowing whether to declare
ubos from [0, N] or [1, N]. In practice this probably doesn't make
much of a difference but the logic is there so ¯\_(ツ)_/¯

If we use the nir option, then dead code isn't run, and num_uniforms
is a true indicator of whether ubo0 exists or not.

Note that this means we are no longer running this pass for internal
shaders that don't come from the GLSL compiler, so various places are
updated to query the nir info bit that's set by running this pass.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
9702ddccc2 microsoft/compiler: Don't duplicate work from gather_info in var sorting
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Jesse Natalie
ed757b010a microsoft/compiler: Improve linking helpers
* Take masks instead of shaders
* Be more aggressive at removing sysvals
* Handle loading from outputs

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Jesse Natalie
d4a15a048b microsoft/compiler: Expect front-facing var as an input
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Jesse Natalie
4180cf39f0 microsoft/compiler: Simplify I/O component type enum handling
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Jesse Natalie
230bed221e microsoft/compiler: Move kill-unused/undefined varying pass from spirv to common
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Jesse Natalie
b6b5514a5b microsoft/compiler: When sorting variables, put unused variables last
These variables will only be used for xfb

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Sil Vilerino
0dd871442b d3d12: Fix leak dxil_module::serialized_dependency_table
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28546>
2024-04-03 14:50:28 +00:00
Eric Engestrom
ff37f68740 meson: add VK_DRIVER_FILES to devenv, alongside the old VK_ICD_FILENAMES
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28516>
2024-04-02 18:08:52 +00:00
Eric Engestrom
4b8735cd4e ci: raise the log level threshold of spirv logs
Avoid the wall of "Unsupported SPIR-V capability" warnings in CI job
log, hiding away useful output:

    ERROR - dEQP error: SPIR-V WARNING:
    ERROR - dEQP error:     In file ../src/compiler/spirv/spirv_to_nir.c:4779
    ERROR - dEQP error:     Unsupported SPIR-V capability: SpvCapabilityDrawParameters (4427)
    ERROR - dEQP error:     28 bytes into the SPIR-V binary

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28503>
2024-04-02 17:25:42 +00:00
Jesse Natalie
e12b68aab5 microsoft/clc: Install clon12compiler
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26803>
2024-03-26 20:12:41 +00:00
Jesse Natalie
6e9b980b3f microsoft/clc: Adjust order of UAV binding assignment
All UAVs which can be accessed via pointer need to be grouped together
starting at base 0, because nir_to_dxil emits the globals array from
[0, size], where size is the input number of globals, as well as one
for each SSBO. Images need to come after that.

Theoretically, nir_to_dxil could emit 3 arrays:
1. Globals
2. Constants
3. Printf
But constants get converted to globals early on so that'd be pretty
tricky to actually detangle.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26803>
2024-03-26 20:12:41 +00:00
Jesse Natalie
b64f13e70f microsoft/clc: Add linkage capability to libclc build to silence warning
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26803>
2024-03-26 20:12:41 +00:00
Jesse Natalie
6468c6a80b clc: Move libclc helpers back to microsoft/clc
These were intended to be shared with (e.g.) rusticl, but they're
unused and I expect they will continue to be. The spirv options
are also hardcoded to be what CLOn12 expects.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26803>
2024-03-26 20:12:41 +00:00
Jesse Natalie
a6658e3dc6 microsoft/compiler: Simplify code emitting CL globals
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26803>
2024-03-26 20:12:41 +00:00
Jesse Natalie
1649a4d92b microsoft/clc: When possible, compute a part-constant "pointer" value for kernel inputs
When a kernel input is a pointer to global or constant memory, it's expected
that the invoker provides the pointer value in the form of
(buffer_index << 32) | offset. The buffer index, however, is statically
knowable in the compiler, as long as a buffer is bound. Since it's
undefined behavior to dereference the pointer with no buffer bound,
we can replace any deref chain that terminates in an access with one
that uses a constant buffer index.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26803>
2024-03-26 20:12:41 +00:00
Jesse Natalie
6fc8d0147e microsoft/compiler: Don't store static-indexing handles that are dynamically emitted
These handles can be emitted in control flow, which means that the handle
might be in a block which does not dominate a block that's processed
later on, which results in incorrect DXIL if we try to reference it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26803>
2024-03-26 20:12:41 +00:00
Jesse Natalie
ff802ca93b ci/windows: Update DirectX-Headers, Agility SDK, zlib, DXC, and WARP
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28339>
2024-03-25 19:11:35 +00:00
Jesse Natalie
267ae85a72 microsoft/compiler: Disable GS streams workaround for validator 1.8
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28339>
2024-03-25 19:11:35 +00:00
Jesse Natalie
811bed8a23 microsoft/compiler: domainLocation component index needs to be i8
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28339>
2024-03-25 19:11:35 +00:00
Jesse Natalie
007b0fdff0 dzn: Initialize memoryTypeBits for querying properties on imported handles
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28339>
2024-03-25 19:11:35 +00:00
Jesse Natalie
5957778c16 dzn: Include vulkan_core.h instead of vulkan.h in the device enum header
Prevents pulling in X11 "None" define into the DXCore implementation,
which conflicts with updated DXCore headers.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10803
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28339>
2024-03-25 19:11:35 +00:00
Jesse Natalie
c75c485d7d dzn: Support bufferDeviceAddress
Flip on the caps/extensions, use their presence to turn on bindless just like
descriptor_indexing, use the buffer flag to indicate UAV access, and fix up
the getter to return the kind of data we want.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28028>
2024-03-07 22:35:09 +00:00
Jesse Natalie
68f43aa3ec spirv2dxil: Support buffer_device_address
This works similarly to the CL compiler, where a 64-bit address is
decomposed into a 32-bit index and offset. But unlike CL, where the
index is into a per-kernel array of bound buffers, for Vulkan it points
into the global device-wide descriptor heap.

For all global deref chains that terminate in a load/store/atomic, create
a parallel deref chain that begins by decomposing the pointer to a vec2,
followed by a load_vulkan_descriptor, and then an SSBO deref chain. Any instance
where the original deref chain was used for something else will remain as
global derefs, so also run lower_explicit_io for global to produce appropriate
pointer math.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28028>
2024-03-07 22:35:09 +00:00
Jesse Natalie
ba17f5ca6a microsoft/compiler: Remove code after discard/terminate in later optimization steps
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27996>
2024-03-05 21:40:09 +00:00
Jesse Natalie
4ccbaa2cd8 microsoft/compiler: Remove deref load/store/atomic ops that statically go out of array bounds
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27919>
2024-03-01 20:49:17 +00:00
Jesse Natalie
941d83ded4 spirv2dxil: Set push constant register space to nonzero
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27919>
2024-03-01 20:49:17 +00:00
Luca Bacci
fe520ecfbf meson,windows: Use relative paths in Vulkan ICD manifest files
See https://github.com/msys2/MINGW-packages/issues/16065

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27468>
2024-03-01 20:09:59 +00:00
Jesse Natalie
0ac7ea7578 dzn: Fix conditions for barrier in texture-converting copy case
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27864>
2024-02-29 19:56:59 +00:00
Jesse Natalie
705e646e38 microsoft/compiler: Fix SM6.6 non-bindless handle annotation for UAV counter
Counter bool is 8, not 6.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27708>
2024-02-21 03:39:22 +00:00
Jesse Natalie
1314c5b357 microsoft/compiler: Fix wave size control for SM6.8+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27624>
2024-02-15 00:29:50 +00:00
Jesse Natalie
e21774eb0a microsoft/compiler: Fix wave size control for SM6.6+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27624>
2024-02-15 00:29:50 +00:00