Commit Graph

14 Commits

Author SHA1 Message Date
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
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 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 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 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 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
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
Jesse Natalie e7f8c195d8 microsoft/compiler: Fix reference to renamed intrinsic getter
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/7609>
2020-11-16 10:31:49 +00:00
Erik Faye-Lund bd5f928506 d3d12: ensure all compoents of clip-distances are written
This fixes a regression that happened after rebasing on master, where we
end up not writing all components of the clip-distance array, which the
DXIL validation code in the D3D12 runtime treats as an error.

To ensure we don't end up overwriting a previous wrire, enable
nir_shader_compiler_options::lower_all_io_to_temps as well.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7477>
2020-11-10 15:37:07 +00:00
Erik Faye-Lund b9c61379ab microsoft/compiler: translate nir to dxil
Here's the code to emit DXIL code from NIR. It's big and bulky as-is,
and it needs to be split up a bit.

This is the combination of a lot of commits from our development branch,
containing code by several authors.

Co-authored-by: Bill Kristiansen <billkris@microsoft.com>
Co-authored-by: Boris Brezillon <boris.brezillon@collabora.com>
Co-authored-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Gert Wollny <gert.wollny@collabora.com>
Co-authored-by: Jesse Natalie <jenatali@microsoft.com>
Co-authored-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7477>
2020-11-10 15:37:07 +00:00