Jesse Natalie
b27d8ee2e9
clc: Include opencl-c-base.h with LLVM 15 (using builtins)
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21168 >
2023-02-11 05:24:08 +00:00
Karol Herbst
e22491c832
clc: fetch clang resource dir at runtime
...
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/19617 >
2022-12-02 15:38:44 +00:00
Karol Herbst
cd2609b12c
clc: generate sources only with with_microsoft_clc
...
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/19617 >
2022-12-02 15:38:44 +00:00
Italo Nicola
66b3df3c15
clc: add 32-bit target
...
Signed-off-by: Italo Nicola <italonicola@collabora.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18985 >
2022-10-15 02:23:03 +00:00
Pierre-Eric Pelloux-Prayer
70891edd97
nir: add a nir_opt_if_options enum
...
And don't enable nir_opt_if_optimize_phi_true_false on radeonsi with
LLVM 14 because it crashes Blender.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6976
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17949 >
2022-08-10 12:55:39 +00:00
Karol Herbst
6637b1f41e
clc: undefine spirv defs to work around LLVMs headers
...
Clang unconditionally adds those definitions if using a spirv LLVM target.
That's not a problem on its own, but clang's internal OpenCL header enable
a bunch of OpenCL extensions if those are set.
Lucky for us, we can simply undefine them and spare us the trouble of
finding an upstream solution to this problem :)
This fixes the OpenCL CTS' compiler features_macro test.
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17334 >
2022-08-04 23:53:50 +00:00
Lionel Landwerlin
cf44282deb
clc: add new feature options for intel_clc
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17253 >
2022-06-27 15:31:49 +00:00
Vinson Lee
3e679219a1
clc: Fix build with llvm-15.
...
opencl_c_h is defined only for llvm < 15.
Fixes: bcc2df4890
("clc: speed up compilation by not relying on opencl-c.h")
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16808 >
2022-06-04 22:27:55 -07:00
Karol Herbst
cd8c083ab5
clc: disable opaque pointers until they are supported
...
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/16479 >
2022-05-21 12:26:37 +00:00
Karol Herbst
b6ed3c6ea2
clc: fix compiler features_macro CTS Test
...
Even with that alone we can't pass the test, as LLVM enables some
extensions based on the SPIR target we choose.
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/16479 >
2022-05-21 12:26:37 +00:00
Karol Herbst
bcc2df4890
clc: speed up compilation by not relying on opencl-c.h
...
This depends on LLVM change: https://reviews.llvm.org/D125401
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/16479 >
2022-05-21 12:26:37 +00:00
Karol Herbst
e5a052f75f
clc: drop parsingComplete check
...
This relies too much on the properties of the SPIRV-LLVM-Translator and is
required to load SPIR-Vs found in the OpenCL CTS.
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/16479 >
2022-05-21 12:26:37 +00:00
Karol Herbst
c0cf7f578a
clc: parse localSize and localSizeHint
...
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/16479 >
2022-05-21 12:26:37 +00:00
Jason Ekstrand
46d9b0e431
clc: Declare LLVMContexts on the stack
...
This prevents more use-after-free errors. Passing them around using
std::unique_ptr ensures that the LLVMContext gets destroyed but doesn't
ensure destruction order. Declaring it on the stack ensures that the
context doesn't get destroyed until right before the the function
returns which is after any other LLVM stuff is destroyed.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Icecream95 <ixn@disroot.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15937 >
2022-04-14 21:19:56 +00:00
Jason Ekstrand
6099e6ce9a
clc: Rework logging a bit
...
First, separate out the LLVM context logging to make it take a
clc_logger instead of passing in a string stream. Currently, the LLVM
context may outlive the string stream which we assign which may lead to
use-after-free errors. Second, use a separate string stream for clang
diagnosticl logging which we intentionally declare before the compiler
so the compiler can't outlive it.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Icecream95 <ixn@disroot.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15937 >
2022-04-14 21:19:56 +00:00
Jason Ekstrand
6e3b9b1b1d
clc: Only initialize LLVM once
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Icecream95 <ixn@disroot.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15937 >
2022-04-14 21:19:56 +00:00
Dave Airlie
fdab872224
clc: initialise one more llvm stage
...
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Icecream95 <ixn@disroot.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15937 >
2022-04-14 21:19:56 +00:00
Dave Airlie
b518020f64
clc: add simple llvm initialise API
...
This just calls some of the LLVM init functions in a common place
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Icecream95 <ixn@disroot.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15937 >
2022-04-14 21:19:56 +00:00
Icecream95
f226222846
clc: Use stringstream for printing spirv errors
...
The type of the spv_position_t components can differ across platforms,
it's simpler to just let C++ overloading handle it.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15437 >
2022-04-14 00:14:43 +00:00
Jesse Natalie
53d4dc7feb
clc: Use kernel_arg_type_qual string to add const type qualifier to arg metadata
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13759 >
2021-11-15 07:47:00 -08:00
Jesse Natalie
82c69c9a9d
compiler/clc: Preserve OCL kernel arg type metadata on LLVM13
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13177 >
2021-10-04 18:16:01 +00:00
Jesse Natalie
3a752256f5
compiler/clc: Null extensions should mean all supported, not all
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13177 >
2021-10-04 18:16:01 +00:00
Lionel Landwerlin
445996379b
clc: let user specify the targetted SPIRV version
...
This version is given to the LLVM-SPIRV translator. On the SPIRV-Tools
side of things, we want to use the highest available version to be
sure to be able to parse back what was generated.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13113 >
2021-10-03 19:32:54 +00:00
Lionel Landwerlin
72fd81d0ac
clc: print warnings/errors on their own line
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13113 >
2021-10-03 19:32:54 +00:00
Lionel Landwerlin
3c8c817ae7
clc: add allowed extension for compile parameter
...
The LLVM-SPIRV translator can include a bunch of capabilities into the
generated SPIRV which is not what you always want. That include
internal Intel specific capabilities from the translator.
v2: Rename options
Fixup checks (Jesse)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13113 >
2021-10-03 19:32:54 +00:00
Jason Ekstrand
d2264489ce
compiler/clc: grab opencl-c.h from the system path by default
...
By default we use the header installed opencl-c.h header. But in the
case Mesa is compiled for microsoft clon12 we keep the injected file.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Dylan Baker <dylan@pnwbakers.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9156 >
2021-09-30 07:09:08 +00:00
Jason Ekstrand
8490766f53
compiler/clc: Clean ups
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Dylan Baker <dylan@pnwbakers.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9156 >
2021-09-30 07:09:08 +00:00
Jason Ekstrand
1506ea2ecb
Move a bunch of the CLC stuff from src/microsoft to common code
...
The D3D12-specific stuff isn't useful to have in common code but all the
stuff to invoke clang really should be common.
v2: Rebase (Lionel)
v3: Define a new clc_libclc_new_dxil() entrypoint to create a clc
context with DXIL nir_options (Jesse)
v4: Fixup meson build (Lionel)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Dylan Baker <dylan@pnwbakers.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9156 >
2021-09-30 07:09:08 +00:00