Commit graph

1076 commits

Author SHA1 Message Date
Luca Bacci
098342ce53 Add checks for NULL dxil_validator
Fixes https://gitlab.freedesktop.org/mesa/mesa/-/issues/8718

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22141>
2023-05-17 15:33:17 +00:00
Alyssa Rosenzweig
c323762f9f treewide: Stop lowering legacy atomics
There are no more producers of legacy atomics so these calls are inert.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23036>
2023-05-16 22:36:21 +00:00
Jesse Natalie
60ed4b92a0 dzn: Hook up fd semaphore import/export
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22879>
2023-05-15 17:14:20 +00:00
Jesse Natalie
c64f1b6650 dzn: Hook up win32 semaphore import/export
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22879>
2023-05-15 17:14:20 +00:00
Jesse Natalie
cd5e372f1c dzn: External Fd memory extension
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22879>
2023-05-15 17:14:20 +00:00
Jesse Natalie
ed25ea1bc9 dzn: External Win32 memory extension
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22879>
2023-05-15 17:14:20 +00:00
Jesse Natalie
fb61340790 dzn: Dedicated resource cleanup
Vulkan's concept of dedicated resources is dangerously close to
D3D12's concept of a "committed" resource, where the memory and
resource are inextricably tied. This is a minor optimization,
but will start to be more important going forward with external
memory.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22879>
2023-05-15 17:14:20 +00:00
Jesse Natalie
7cc59ad973 dzn: Finish implementing KHR_synchronization2
This was already mostly implemented.

Without this, the synchronization2 sharing tests will crash,
because there's a CTS bug that's missing a skip check for Windows.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22879>
2023-05-15 17:14:20 +00:00
Jesse Natalie
eec07cdde4 dzn: Don't zero an output struct that can have pNext
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22879>
2023-05-15 17:14:20 +00:00
Jesse Natalie
4621a6db50 dxil: Use unified atomics
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22993>
2023-05-12 16:01:40 -07:00
Jesse Natalie
75e1407116 microsoft/compiler: Back-propagate type requirement information
For ALU ops where input types are known, we can store that info on
the input sources. This can be used to produce the correct overloads
of load instructions that don't immediately need to be followed by
bitcasts, or similarly to produce a constant value which can be directly
consumed by the relevant instruction without needing a bitcast.

Similarly for values that will be stored in an output, we know type
information. And using that info, we can use more-correct information
for phis instead of forcing all phi sources to be bitcast to int just
to be bitcast back to float on the other side for an alu or an output
store.

One missing piece is SSBO stores, where we can support int or float.
If the input is coming from a phi, we don't influence the phi's type,
so it'll be int, even though the incoming sources might've been float.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22972>
2023-05-12 22:23:48 +00:00
Jesse Natalie
d94e23d7bd microsoft/compiler: Duplicate some SSA values to simplify SSA typing
For each phi src, ensure that it's only used as a phi src.
This lets us give each phi their own unique types without worrying
about them stomping on each other. Also scalarize phis.

For each constant, ensure that it's only used once. The DXIL backend
will already dedupe these consts within the module, but this lets a
single load_const have multiple types depending on how it's used.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22972>
2023-05-12 22:23:48 +00:00
Jesse Natalie
049d340d8e microsoft/compiler: Remove alu type info from store_dest()
We pass in a *typed* value, we don't need to pass in additional
type info. That's just more opportunities to get it wrong.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22972>
2023-05-12 22:23:48 +00:00
Alyssa Rosenzweig
5a0223a2d4 dxil: Use nir_foreach_phi_safe
This should be faster, since we're not iterating pointlessly over all the
non-phis after the phi.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22967>
2023-05-12 14:02:23 +00:00
Jesse Natalie
bafa5efcfc dzn: Enable KHR_shader_integer_dot_product
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22952>
2023-05-11 21:56:31 +00:00
Jesse Natalie
a6ea08c542 microsoft/compiler: Enable packed dot product intrinsics for SM6.4+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22952>
2023-05-11 21:56:31 +00:00
Jesse Natalie
217bbdc4fd microsoft/compiler: Take inputs from callers before providing nir options
The base nir options were assuming all bit sizes were supported at
shader model 6.2. Multiple callers were then changing properties
based on actual support.

Standardize behavior by providing the majority of things that can
impact nir options when getting them. Some callers (e.g. meta blit
shaders or libclc) don't bother, because they are known to have
contents that are unaffected by these options. Other callers might
munge more properties afterwards, but this minimizes that.

Note that lower_helper_invocation was incorrectly being turned off
for SM6.6+ by some callers, despite load_helper_invocation being
unimplemented by the backend.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22952>
2023-05-11 21:56:31 +00:00
Jesse Natalie
f2945409b3 dzn: Enable 64-bit ints and floats
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22952>
2023-05-11 21:56:31 +00:00
Jesse Natalie
7cdbf4f065 spirv2dxil: Support int64 and doubles
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22952>
2023-05-11 21:56:31 +00:00
MouriNaruto
90c3fd0c83 dzn: Fix segmentation fault when Direct3D 12 user mode
driver from at least one of GPUs is not available.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22961>
2023-05-11 15:58:51 +00:00
Jesse Natalie
e169a402a8 microsoft/compiler: Do basic I/O analysis for dependency tables
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22949>
2023-05-10 21:42:34 +00:00
Jesse Natalie
8ff95b766d microsoft/compiler: Allocate space for I/O and viewID dependency tables before instruction processing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22949>
2023-05-10 21:42:34 +00:00
Jesse Natalie
6d52f08a76 dzn/ci: Remove 'exclude' for graphicsfuzz cases
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22926>
2023-05-09 18:44:37 +00:00
Jesse Natalie
cd91387cad dzn: Run nir_opt_remove_phis before nir_lower_returns
Otherwise nir_lower_returns can produce invalid NIR by not updating
a phi in a non-trivial if.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22926>
2023-05-09 18:44:37 +00:00
Jesse Natalie
ebe3b91ca0 microsoft/compiler: Avoid integer divides by 0
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22787>
2023-05-09 00:33:59 +00:00
Jesse Natalie
a6ac1f5fbd spirv2dxil: Lower large temps to scratch
WARP has a temp register limit, and the control flow needed to convert
indirect to direct accesses on large temps ends up bloating shaders massively.
We can just go ahead and spill these large temps to scratch, which maps
to an alloca in DXIL.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22787>
2023-05-09 00:33:59 +00:00
Jesse Natalie
a4ce095bad dzn: Use A4B4G4R4 instead of B4G4R4A4 when available
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22911>
2023-05-09 00:17:16 +00:00
Jesse Natalie
421546c60d ci/windows: Pick up WARP 1.0.6 NuGet with lots of dzn fixes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22908>
2023-05-08 22:58:58 +00:00
Eric Engestrom
cb4e4fc5de dzn: fix pointer type mismatch
../src/microsoft/vulkan/dzn_image.c: In function ‘dzn_GetImageMemoryRequirements2’:
    ../src/microsoft/vulkan/dzn_image.c:918:91: error: passing argument 6 of ‘dzn_ID3D12Device12_GetResourceAllocationInfo3’ from incompatible pointer type [-Werror=incompatible-pointer-types]
      918 |                                                            &image->castable_format_count, &image->castable_formats,
          |                                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~
          |                                                                                           |
          |                                                                                           DXGI_FORMAT **
    In file included from ../src/microsoft/vulkan/dzn_private.h:67,
                     from ../src/microsoft/vulkan/dzn_image.c:24:
    ../src/microsoft/vulkan/dzn_abi_helper.h:64:107: note: expected ‘const DXGI_FORMAT * const*’ but argument is of type ‘DXGI_FORMAT **’
       64 |                                               const UINT *num_castable_formats, const DXGI_FORMAT *const *castable_formats,
          |                                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    ninja: build stopped: subcommand failed.

Fixes: 71dbb3120a ("dzn: Use GetResourceAllocationInfo3 for castable formats")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22877>
2023-05-05 17:52:29 +01:00
Jesse Natalie
be34257197 dzn: Delete queue-level event waits
These are unneeded. Events can't be used to indefinitely stall work
like you can with a semaphore or timeline semaphore. The signals
still need to happen so that execution will modify the state that
can be polled from the CPU though.

Fixes dEQP-VK.synchronization.basic.event.single_submit_multi_command_buffer

Fixes: 04fa6c71 ("dzn: Batch command lists together")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22842>
2023-05-04 03:27:39 +00:00
Jesse Natalie
7d34fe04e4 dzn: Support separate depth/stencil resolves via blits
In theory, ResolveSubresourceRegion should be able to resolve just
the depth or just the stencil. In practice, WARP had bugs, which
means that was never tested, so just do it via blits.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22836>
2023-05-04 03:10:56 +00:00
Jesse Natalie
dfc88a536b dzn: Support all available depth/stencil resolve modes
Fixes dEQP-VK.imageless_framebuffer.depth_stencil_resolve and
dEQP-VK.renderpass2.depth_stencil_resolve.misc.properties

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22836>
2023-05-04 03:10:56 +00:00
Jesse Natalie
3f641538d3 dzn: Augment blit resolve to support min/max/sample-zero modes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22836>
2023-05-04 03:10:56 +00:00
Dave Airlie
fa938dd975 vulkan: write beta extensions into generator scripts.
Updated by: Hyunjun Ko <zzoon@igalia.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21806>
2023-05-04 02:40:06 +00:00
Constantine Shablya
61413d70a0 vulkan: introduce supported_features parameter to vk_physical_device_init
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22333>
2023-05-03 03:27:54 +00:00
Jesse Natalie
888bfa7f04 dzn: Ensure bindless is factored into pipeline/nir hash
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22810>
2023-05-02 16:39:51 -07:00
Jesse Natalie
aa43b03086 dzn: Ensure subgroup size control is factored into pipeline hash
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22810>
2023-05-02 16:39:34 -07:00
Jesse Natalie
dacc3cc597 dzn: Use the nir hash as an input to the dxil hash
Instead of re-computing all the same bits we already computed,
just use the nir hash. Helps prevent missing a bit between the two.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22810>
2023-05-02 16:39:34 -07:00
Jesse Natalie
c9a34e6de0 dzn: Ensure sample-rate shading is factored into nir hash
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22810>
2023-05-02 16:39:31 -07:00
Jesse Natalie
cc8cdbb0ef dzn: Hook up subgroup size to compute shader compilation
Previously this was only in the graphics path... where it does nothing,
since D3D only supports wave size control for compute. Whoops.

Fixes: db083070 ("dzn: Implement subgroup size control extension")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22810>
2023-05-02 16:39:10 -07:00
Jesse Natalie
73952bfbfd dzn: Fix UBO descriptors pointing to the end of the buffer
UBO descriptors can re-use the default descriptor when their upper
bound is 64KiB, not the end of the buffer.

Fixes dEQP-VK.memory.pipeline_barrier.host_write_uniform_buffer.1048576

Fixes: d34ac0a70b ("dzn: Re-design custom buffer descriptors")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22805>
2023-05-02 21:14:09 +00:00
Jesse Natalie
cc66d546dd microsoft/compiler: Unroll loops in opt passes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22786>
2023-05-01 21:12:43 +00:00
Jesse Natalie
bb65d36c5c spirv2dxil: Mark SSBO reads for bindless as CAN_REORDER
This makes it so that they can be CSE'd, which helps prevent redundant
reads of the same data.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22786>
2023-05-01 21:12:43 +00:00
David Heidelberg
4f1716ebca ci/dzn: add flaking test
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22766>
2023-04-28 22:35:21 +02:00
Jesse Natalie
3fc4ddd628 dzn: Expose core VK1.2 extensions that aren't optional
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22745>
2023-04-28 00:03:17 +00:00
Jesse Natalie
0b8a39498d dzn: Expose core VK1.1 extensions that aren't optional
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22745>
2023-04-28 00:03:17 +00:00
Jesse Natalie
bc8f7c53af ci/dzn: Run almost the full CTS
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22639>
2023-04-25 15:36:01 +00:00
Jesse Natalie
d34ac0a70b dzn: Re-design custom buffer descriptors
Previously, custom buffer descriptors were owned by a descriptor set. Now,
custom buffer descriptors are owned by the buffer. Additionally, we respect
the app-provided sizes when they're smaller than the buffer size, even if
robustness is not enabled, so that size queries work correctly.

This new design fixes several issues:
* Descriptor set copies were broken when they involved custom descriptors,
  because the original descriptor set owned the lifetime of the custom
  descriptor, the new one was just borrowing it. If those lifetimes didn't
  line up, problems would arise.
* A single buffer with the same sub-view placed in multiplel descriptor sets
  would allocate multiple slots, when it only really needed one.
* Custom buffer descriptors now lower the base offset to 0 to allow merging
  multiple overlapping (ending at the same upper bound) descriptors. Since
  the shader is already doing an offset add, making it nonzero is free.
* Dynamic buffer descriptors were incorrect before. The size passed into the
  descriptor set is supposed to be the size from the *dynamic* offset, not the
  size from the static offset. By allocating/populating the descriptor when
  placed into the set, it prevented larger offsets from working correctly. This
  buffer-owned design prevents cmdbufs from having to own lifetime of custom
  descriptors.

Fixes dEQP-VK.ssbo.unsized_array_length.float_offset_explicit_size

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22639>
2023-04-25 15:36:01 +00:00
Jesse Natalie
a12a15a9ea dzn: Handle depth bias for point fill mode emulation
Fixes dEQP-VK.draw.renderpass.depth_bias.depth_bias_triangle_list_point

This is not complete, there's no slope scale or clamp handling, but it
does handle static or dynamic (though dynamic is untested).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22639>
2023-04-25 15:36:01 +00:00
Jesse Natalie
542febcf59 dzn: Handle opaque BC1
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22639>
2023-04-25 15:36:01 +00:00