Commit Graph

1309 Commits

Author SHA1 Message Date
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
Jesse Natalie
0daad70f9f microsoft/compiler: For emulating scan, ensure all threads are active when reading cross-lane
HLSL docs say WaveReadLaneAt is undefined if the target lane is inactive. This makes
sense since the target lane may need to *send* the data, rather than it being pulled
by the calling lane. So don't early-out on the loop, iterate through the whole wave
on all threads and read the cross-lane data before branching.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27624>
2024-02-15 00:29:50 +00:00
Jesse Natalie
161a90abbd dzn: Add a driconf option to disable dzn for specific apps and use it for RDR2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27531>
2024-02-13 17:53:42 +00:00
Jesse Natalie
660c7fe6a7 dzn: Fix tessellation shader insertion into PSO desc
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27531>
2024-02-13 17:53:42 +00:00
Jesse Natalie
d5131e5f86 dzn: Simultaneous-access is mutually exclusive with MSAA
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27531>
2024-02-13 17:53:42 +00:00
Jesse Natalie
32c6caffd7 spirv2dxil: Trivial fixes for tessellation shaders
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27531>
2024-02-13 17:53:42 +00:00
Jesse Natalie
a3c45306e2 spirv2dxil: Remove dead branches early during shader compilation
Apparently spiregg can produce not-taken branches that somehow try
to access textures that aren't actually declared. These branches
need to be trimmed before any texture lowering is done.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27531>
2024-02-13 17:53:42 +00:00
Jesse Natalie
a8758afabd microsoft/compiler: Relax assert for SPIR-V barriers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27531>
2024-02-13 17:53:42 +00:00
Jesse Natalie
94e0091190 microsoft/compiler: Only use simplified subgroup ID algorithm for compute
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27528>
2024-02-08 20:41:58 +00:00
Eric Engestrom
5f373dec88 dzn: enable VK_EXT_headless_surface on all platforms except Windows
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27448>
2024-02-06 20:32:38 +00:00
Jesse Natalie
559f31e202 dzn: Use blits for all non-averaging resolves
Trying to do min/max resolves on depth/stencil is failing for me on
hardware, just simplify things and always use a manual resolve for
modes that aren't average.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:52 +00:00
Jesse Natalie
70fa127c97 dzn: Use correct format for depth/stencil resolves
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:52 +00:00
Jesse Natalie
973c5bd047 dzn: Don't resolve for RESOLVE_MODE_NONE
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:52 +00:00
Jesse Natalie
dd7cfd5255 dzn: Add a debug flag for forcing off native view instancing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:52 +00:00
Jesse Natalie
a85e8058cb dzn: Support non-static samplers for meta
Some hardware that doesn't support true static samplers, emulates it
by copying all static samplers into a reserved portion of every descriptor
heap. To support Vulkan's required 4000 live sampler limit in bindless
mode, D3D is now able to create descriptor heaps which do not have a reserved
portion. Any descriptor heaps above the MaxSamplerDescriptorHeapSizeWithStaticSamplers
limit will not have that reserved portion and cannot be used with static samplers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:51 +00:00
Jesse Natalie
c286c01136 dzn: Add barrier to copy source for DispatchIndirect copies
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:51 +00:00
Jesse Natalie
581a23c0cc dzn: Add missing handling of VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:51 +00:00
Jesse Natalie
60aad6ef07 spirv2dxil: Lower the Vulkan memory model and coherent loads/stores
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:51 +00:00
Jesse Natalie
003d2da2dc microsoft/compiler: Add a pass for promoting ACCESS_COHERENT on loads/stores
DXIL doesn't have instruction-level coherency. We have 3 options:
1. Promote the instruction to an atomic instruction. We can only do this
   for 32-bit or 64-bit ops.
2. If using bindless, declare the local resource declaration as globally-coherent.
3. If not using bindless, add globally-coherent to the global resource declaration.

This pass does all 3 of these, stopping at the intrinsic level for supported types
of atomics, otherwise assigning to the global resource declaration, which will be
unused if we're doing bindless, where instead we'll get it from the instruction.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:51 +00:00
Jesse Natalie
b74cd405d3 microsoft/compiler: Respect ACCESS_COHERENT in UAV variable data
DXIL has a globally-coherent field for UAVs. When emitting UAV metadata
based on a resource variable, respect the relevant bit in the var data.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5628
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27348>
2024-02-02 01:19:51 +00:00
Daniel Schürmann
26c8f13ff5 vulkan: enable VK_KHR_shader_expect_assume
This implementation ignores the hints.

Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27265>
2024-01-30 19:09:42 +00:00
Jesse Natalie
24f14bfacc dzn: Add missing blit source barriers for enhanced barriers
I was under the impression these would never be needed, since the source
should already be in the right GENERIC_READ layout, but when resolving
rendering attachments with a blit, the source is still in the layout that
it was in at the end of rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27313>
2024-01-29 17:46:11 +00:00
Jesse Natalie
f91ac2ff41 dzn: Add missing condition to immutable sampler init loop
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27313>
2024-01-29 17:46:11 +00:00
Jesse Natalie
fd89ca82a6 dzn: Add a stencil blit fallback
Not all D3D hardware supports specifying the stencil ref value from the
pixel shader. For such hardware, stencil blits need to do the awful
8-pass one-bit-per-pass discard-to-not-write blit approach.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27313>
2024-01-29 17:46:11 +00:00
Jesse Natalie
5cdcb7134a microsoft/compiler: Use double pack/unpack instead of int for reduce ops on doubles
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27313>
2024-01-29 17:46:11 +00:00
Jesse Natalie
4fede8d419 dzn: Fix path passed to CreateDeviceFactory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27287>
2024-01-26 01:30:00 +00:00
Jesse Natalie
fa1c9618f9 dzn: Don't set view instancing mask until after the PSO
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27286>
2024-01-26 01:05:02 +00:00
Jesse Natalie
98ec98d08f spirv2dxil: Handle aliasing/overlapping UBO/SSBO variables
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27280>
2024-01-25 21:20:58 +00:00
Jesse Natalie
4833126b40 spirv2dxil: Fix the spirv2dxil command line tool
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27280>
2024-01-25 21:20:58 +00:00