Commit graph

1295 commits

Author SHA1 Message Date
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
Jesse Natalie
9b495ee8a9 dzn: Disable depth/stencil for partial binding from dynamic rendering
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27224>
2024-01-24 22:32:59 +00:00
Jesse Natalie
f4c6d9d9a9 dzn: Handle VkBindImageMemorySwapchainInfoKHR
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27224>
2024-01-24 22:32:59 +00:00
Jesse Natalie
df684ee653 dzn: Fix enhanced barrier layout for depth blits
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27224>
2024-01-24 22:32:59 +00:00
Jesse Natalie
fcd56e31f7 dzn: Implement maintenance3 VariableDescriptorCountLayoutSupport
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27224>
2024-01-24 22:32:59 +00:00
Jesse Natalie
beb82c836d microsoft/compiler: Add feature flags for new comparison sampling ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27200>
2024-01-24 21:38:49 +00:00
Karol Herbst
f2b7c4ce29 nir: rework and fix rotate lowering
No driver supports urol/uror on all bit sizes. Intel gen11+ only for 16
and 32 bit, Nvidia GV100+ only for 32 bit. Etnaviv can support it on 8,
16 and 32 bit.

Also turn the `lower` into a `has` option as only two drivers actually
support `uror` and `urol` at this momemt.

Fixes crashes with CL integer_rotate on iris and nouveau since we emit
urol for `rotate`.

v2: always lower 64 bit

Fixes: fe0965afa6 ("spirv: Don't use libclc for rotate")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by (Intel and nir): Ian Romanick <ian.d.romanick@intel.com>

Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27090>
2024-01-22 10:27:44 +00:00
Jesse Natalie
ebcab145cf dzn: Add a debug option to enable experimental shader models
This allows us to run with unsigned shaders

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27160>
2024-01-20 00:07:15 +00:00
Jesse Natalie
90bf4b630b microsoft/compiler: Handle comparison bias/gradient sampling
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27160>
2024-01-20 00:07:15 +00:00
Jesse Natalie
733b7fe831 microsoft/compiler: Declare shader model 6.8 / validator 1.8
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27160>
2024-01-20 00:07:15 +00:00
Karol Herbst
36012af17f nir/printf: remove treat_doubles_as_floats
It is broken and clang uses fp32 for float constants if the fp64 extension
isn't enabled anyway. SPIRVs can't use fp64 constants with printf unless
they enable the Float64 cap, which also requires cl_khr_fp64 to be
supported.

So just remove it and rely on clang handling -cl-single-precision-constant
correctly, which at the moment doesn't seem to be the case, but we can
think about that once we plan to support cl_khr_fp64.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26541>
2024-01-18 13:16:13 +01:00
Daniel Schürmann
bdbf873b0f nir: remove redundant passes from nir_opt_if()
These are now covered by nir_opt_loop():
- opt_if_loop_last_continue()
- opt_merge_breaks()
- opt_if_loop_terminator()

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24940>
2024-01-03 20:48:05 +00:00
Daniel Schürmann
a3ed36da1a treewide: replace calls to nir_opt_trivial_continues() with nir_opt_loop()
Totals from 850 (1.11% of 76636) affected shaders: (RADV, GFX11)
MaxWaves: 18134 -> 18130 (-0.02%)
Instrs: 3011298 -> 3008585 (-0.09%); split: -0.17%, +0.08%
CodeSize: 15836804 -> 15841972 (+0.03%); split: -0.09%, +0.12%
VGPRs: 63580 -> 63604 (+0.04%)
SpillSGPRs: 966 -> 1148 (+18.84%); split: -0.83%, +19.67%
Latency: 36102291 -> 30186144 (-16.39%); split: -16.41%, +0.02%
InvThroughput: 9058100 -> 7011821 (-22.59%); split: -22.61%, +0.02%
VClause: 65369 -> 65364 (-0.01%); split: -0.03%, +0.02%
SClause: 100309 -> 100305 (-0.00%); split: -0.04%, +0.04%
Copies: 335658 -> 336472 (+0.24%); split: -0.70%, +0.94%
Branches: 110806 -> 108945 (-1.68%); split: -1.94%, +0.26%
PreSGPRs: 73476 -> 73934 (+0.62%); split: -0.25%, +0.87%
PreVGPRs: 58809 -> 58840 (+0.05%); split: -0.01%, +0.06%

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24940>
2024-01-03 20:48:04 +00:00
Yonggang Luo
0210b554d6 treewide: Replace the include of nir_types.h with glsl_types.h
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26753>
2023-12-30 15:08:11 +00:00
Yonggang Luo
4d6d0a24ed ci/msvc: Rename vs2019 to msvc
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26736>
2023-12-24 11:46:43 +00:00