Christian Gmeiner
3fbde2fd93
nir: add has_txs flag
...
Some nir lowerings might need to know if txs is supported by
the backend.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8898 >
2021-02-23 14:04:30 +00:00
Jesse Natalie
8a3dbf1ca6
microsoft/clc: Add a test with an unused kernel arg
...
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9160 >
2021-02-19 16:36:46 +00:00
Jesse Natalie
11061c4e28
microsoft/clc: Re-order dead variable removal after uniform vars_to_explicit_types
...
Since vars_to_explicit_types is now where driver_location/offset is filled out,
we need to make sure that we still have all app-provided kernel arg variables
at that point in time so they all get assigned unique offsets. That means
that we can't have removed dead uniforms yet, which also means we can't have
filled out metadata for inline samplers (since usage of them generates tons
of duplicate uniforms).
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9160 >
2021-02-19 16:36:46 +00:00
Jesse Natalie
5b0a10823b
microsoft/clc: Use driver_location for metadata instead of re-computing offsets
...
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
3ee8f2ccba
microsoft/clc: Move inline samplers to the end of the variable list
...
Since inline samplers are uniforms, just like kernel args, and
nir_lower_vars_to_explicit_types will assign driver_location based
on order in the variable list, move the inline samplers to the end
of the list to prevent them from creating gaps in the kernel arg
offsets.
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
d773257012
microsoft/clc: Fix wrap modes for inline samplers for integer textures
...
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
9da8179a1e
microsoft/clc: Let lower_vars_to_explicit_types fill kernel input driver_location
...
Importantly, also run that before mucking with the variable list via image lowering,
which removes and inserts variables, making the driver_location no longer line up
with metadata.
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
6f729a7c9d
microsoft/clc: Only apply float scaling to 32bit fdiv
...
Reviewed By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9091 >
2021-02-17 19:01:02 +00:00
Jesse Natalie
37142847fa
microsoft/clc: Add test with inline function
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9085 >
2021-02-16 22:11:21 +00:00
Jesse Natalie
c1b8629b2c
microsoft/clc: Add -fgnu89-inline to clang args
...
Without this, inline functions don't have their body emitted in the
resulting LLVM IR, meaning the kernel will fail to link.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9085 >
2021-02-16 22:11:21 +00:00
Michael Tang
f026345b34
microsoft/compiler: Make resource_state_manager only build with_gallium_d3d12
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8785 >
2021-01-29 12:54:02 -08:00
James Park
bef0af3f21
microsoft: Fix comma in variadic macro for MSVC
...
New preprocessor seems to be enabled by default when C17 mode is active.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8772 >
2021-01-29 05:43:31 +00:00
Caio Marcelo de Oliveira Filho
9f3d5e99ea
compiler: Use util/bitset.h for system_values_read
...
It is currently a bitset on top of a uint64_t but there are already
more than 64 values. Change to use BITSET to cover all the
SYSTEM_VALUE_MAX bits.
Cc: mesa-stable
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Acked-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8585 >
2021-01-26 20:20:47 +00:00
Connor Abbott
c81389ace0
dxil: Use sized types for nir_tex_instr::dest_type
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:42 +01:00
Daniel Schürmann
bd8e84eb8d
nir: replace .lower_sub with .has_fsub and .has_isub
...
This allows a more fine-grained control about whether
a backend supports one of these instructions.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597 >
2021-01-11 19:13:51 +00:00
Daniel Schürmann
b3ce55b445
nir,vc4: Lower fneg to fmul(x, -1.0)
...
This patch also replaces lower_negate with lower_ineg / lower_fneg.
The fneg semantics have been clarified as of Version 1.5, Revision 1
of the SPIR-V specification, which means that the previous lowering
to fsub is not a viable solution anymore, and is replaced with
lowering to fmul(x, -1.0).
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597 >
2021-01-11 19:13:51 +00:00
Erik Faye-Lund
6f3a34e75c
microsoft/compiler: do not lower away 64-bit ffma
...
In DXIL, the FMA instruction only supports 64-bit operations. However,
back when we implemented support for this, there were only a single
switch for lowering all ffma instructions, so we couldn't easily use it.
But now that there's separate flags to lower ffma on 16, 32 and 64 bit,
we can lower 16 and 32 bit ffmas, and leave 64 bit ffmas alone.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8349 >
2021-01-08 15:09:23 +00:00
Erik Faye-Lund
c2fa965cc3
microsoft/compiler: correct dxil fma opcode
...
When I originally added the FFMA opcode here, I added the FMAD opcode
instead of the FMA opcode. The reason for this is that it works on
32-bit values as well, so that seemed like a better fit.
But that's not correct, as the FMA opcode isn't a fused operation, so
let's correct the opcode.
This isn't currently in use, because we currently lower away all ffma
opcodes on the NIR level, but that's about to change.
While we're at it, let's also update the opcode name to match the DXIL
documentation.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8349 >
2021-01-08 15:09:23 +00:00
Christian Gmeiner
c6d65bb01e
microsoft/compiler: use intrinsic builders
...
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295 >
2021-01-06 14:34:41 +00:00
Jesse Natalie
dcd8adcc28
microsoft/clc: Fix const violations from ralloc_steal
...
Fixes: ff05da7f8d ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7697 >
2021-01-04 22:05:02 +00:00
Adam Jackson
8ddddfb516
treewide: Disambiguate various variables named "debug_options"
...
Name them after what they control so 'vi -t' can take you somewhere
useful.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8165 >
2021-01-04 20:51:28 +00:00
Jesse Natalie
24dcdc3fa9
microsoft/compiler: Fix clang fallthrough warnings
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
72d7e173e3
microsoft/resource_state_manager: Remove unused private variable
...
Clang detects that this variable is unused. We can re-add it if
we end up needing it but for now let's just remove it.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
c11f2f5de8
microsoft/compiler: Fix tautological comparison
...
Clang detects that a signed character can't be >= 128. Instead,
we should just explicitly check for the 8th bit via bitmask compare.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
f0eda8fbf8
microsoft/compile: Fix incorrect enum type in function signature
...
Clang warns for passing one enum type where another was expected.
This was just a copy/paste bug, and had no real impact since the
enum was just used as an integer in this function.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
cda9d44bae
microsoft/resoure_state_manager: Silence GCC invalid offsetof warning
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
bd97f401dc
microsoft/compiler: Fix incorrect size passed to strncpy
...
GCC correctly detects/warns that this was the wrong size
Fixes: b9c61379 ("microsoft/compiler: translate nir to dxil")
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
bb6a1f5b1e
microsoft/compiler: Fix warnings produced by GCC in release mode
...
Inline some variables/functions that are only used for asserts.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
4dbcf24f68
microsoft/clc: Hook up printf
...
Rewrites the original lowering pass to use the one shared with Clover,
instead only handling the new load_printf_buffer_address intrinsic.
Exports the new metadata to the runtime containing strings and arg sizes.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254 >
2020-12-28 15:55:08 -08:00
Vinson Lee
512ca3464d
d3d12: Initialize TransitionableResourceState m_SupportsSimultaneousAccess.
...
Fix defect reported by Coverity Scan.
Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member m_SupportsSimultaneousAccess is
not initialized in this constructor nor in any functions that it calls.
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8192 >
2020-12-24 22:02:00 +00:00
Michael Tang
0b3379c7be
microsoft/compiler: Add spirv2dxil executable
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8043 >
2020-12-22 13:28:22 -08:00
Michael Tang
67e48bee1e
microsoft/compiler: Add dedicated spirv_to_dxil libraries
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8043 >
2020-12-22 13:28:21 -08:00
Jesse Natalie
da9b6a21f4
d3d12: Include wsl/winadapter.h when not compiling for Windows
...
The winadapter.h provides typedefs and defines to enable the
D3D/DXCore headers to be included as-is when targeting non-
Windows platforms.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937 >
2020-12-16 16:25:54 +00:00
Jesse Natalie
4ee55769d6
microsoft/compiler: Pick up new dxcapi.h
...
This is more up-to-date with what's on GitHub, and more importantly,
it embeds some of the non-Windows support logic in the header, instead
of shelling out to a nonexistent header.
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937 >
2020-12-16 16:25:54 +00:00
Jesse Natalie
bc5f69faee
d3d12: Use DirectX-Headers wrap for d3d12.h
...
This does 2 things for us:
1. Allows us to compile-time depend on any features from new headers,
instead of having to conditionally compile based on Windows SDK version.
2. Allows us to reference d3d12.h when compiling for non-Windows.
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Reviewed-by: Dylan Baker <dylan@pnwbakers.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937 >
2020-12-16 16:25:54 +00:00
Erik Faye-Lund
2c9e7f73ad
microsoft/clc: increase test-timeout
...
The test "clc_compiler_test" is kinda nasty in packing too many things
into a single test, making it awkwardly long. We should really consider
splitting it up into multiple tests instead.
But right now, it's sometimes timing out on CI, which is bad, so here's
a quick band-aid to prevent this from happening.
The previous timeout of two minutes seems to not always be sufficient
under various loads, so let's add another minute just to be sure.
Here's an example of a failure with the current timeout:
https://gitlab.freedesktop.org/mesa/mesa/-/jobs/5918980#L1589
Fixes: ff05da7f8d ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-by: Daniel Stone <daniels@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7872 >
2020-12-02 14:19:19 +00:00
Erik Faye-Lund
3517b6fd53
microsoft/clc: add missing dependency
...
We include git_sha1.h in clc_compiler.c, so we should also make sure we
depend on the header being generated in time. This fixes a spurious
build error when compiling with many cores, like we do on CI.
Fixes: ff05da7f8d ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Acked-by: Daniel Stone <daniels@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7869 >
2020-12-02 13:41:24 +00:00
Erik Faye-Lund
84dd4ac1c7
microsoft/clc: use files-function for source-list
...
This makes things a bit more explicit, and is generally what we seem to
do around in the source-tree.
Acked-by: Daniel Stone <daniels@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7869 >
2020-12-02 13:41:24 +00:00
Jesse Natalie
c1c1bad582
d3d12: Fix GCC warnings for missing function prototypes
...
Most of these are adding 'static', for functions that are local
to a translation unit but weren't declared static.
There's one instance of a missing include for bringing the prototype
into the translation unit, one function missing a return type (default-int),
and one which added inline to avoid it being considered unused in some sources.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:47 +00:00
Jesse Natalie
30e5abe5f5
microsoft/compiler: Add missing 'return' to switch case
...
Fixes: b9c61379 ("microsoft/compiler: translate nir to dxil")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:47 +00:00
Jesse Natalie
e593329b0c
microsoft/compiler: Misc fixes caught by GCC
...
* Fix const-correctness on dxil_mdnode pointer arrays
* Fix warning for a missing scope in a case block
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:47 +00:00
Jesse Natalie
4e481a1f65
microsoft/compiler: Fix unhandled switch case warnings
...
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:47 +00:00
Jesse Natalie
244a41d6a8
d3d12: Remove Windows-specific macros
...
These all have trivial standard or Mesa replacements
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:47 +00:00
Jesse Natalie
4358af87e7
d3d12: Fix signed-unsigned comparison warnings
...
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:47 +00:00
Jesse Natalie
6060291c0e
d3d12: Fix brace-initialization issues
...
For C++ code, we shouldn't use {0}, instead use {} to default-
initialize everything. For code with nested structs/unions, make
sure there's enough braces to appropriately scope initialization.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:46 +00:00
Jesse Natalie
c3bf781cb0
microsoft/compiler: Remove dead code/variables
...
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780 >
2020-12-01 17:10:46 +00:00
Erik Faye-Lund
f9e4c0ada1
d3d12: lower bitfield_extract to shifts
...
This wasn't implemented yet, because we hadn't encountered it yet. But
now it seems we can trigger this, thanks to the nv_copy_depth_to_color
piglit tests.
This makes the test go from crash to fail, which isn't perfect, but it's
better than nothing.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7855 >
2020-12-01 13:59:30 +00:00
Daniel Stone
ad90e9fee6
microsoft/clc: Disable broken f32 -> i64/u64 test
...
Saturated conversions from f32 -> i64/u64 need to be reworked in the
upstream tree. Disable this test until we've done so, since it doesn't
pass currently.
Signed-off-by: Daniel Stone <daniels@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7537 >
2020-11-27 11:22:07 +00:00
Daniel Stone
3a134abab8
microsoft/clc: Allow building with Clang git
...
clang's version argument will return '1.2.3git' when built from a
non-release source tree, but the resource directory will be '1.2.3'.
Strip the 'git' suffix if it's there.
Signed-off-by: Daniel Stone <daniels@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7537 >
2020-11-27 11:22:07 +00:00
Jesse Natalie
ff05da7f8d
microsoft: Add CLC frontend and kernel/compute support to DXIL converter
...
This adds a standalone library which can convert through the pipeline of
OpenCL C -> SPIR -> SPIR-V -> NIR -> DXIL. It can add in the libclc
implementations of various library functions in the NIR phase, and
also massages the NIR to shift it more towards graphics-style compute.
This is leveraged by the out-of-tree OpenCLOn12 runtime
(https://github.com/microsoft/OpenCLOn12 ).
This is the combination of a lot of commits from our development branch,
containing code by several authors.
Co-authored-by: Boris Brezillon <boris.brezillon@collabora.com >
Co-authored-by: Daniel Stone <daniels@collabora.com >
Co-authored-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565 >
2020-11-18 04:05:37 +00:00