summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2020-11-06 17:09:30 +0100
committerMarge Bot <eric+marge@anholt.net>2020-11-18 04:05:37 +0000
commitff05da7f8dc4aa531704d48f718514e3b1fff45d (patch)
tree42b328eaf716d1ac49d3af45beecfc6f27c62e9a /meson.build
parent1885e356e6a4d425471c0bfa0aee5fcf98d19186 (diff)
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>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build33
1 files changed, 30 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index 614c9877072..e25f9fcde39 100644
--- a/meson.build
+++ b/meson.build
@@ -299,6 +299,26 @@ if with_aco_tests and not with_amd_vk
error('ACO tests require Radv')
endif
+_microsoft_clc = get_option('microsoft-clc')
+if _microsoft_clc == 'auto'
+ with_microsoft_clc = false
+else
+ with_microsoft_clc = _microsoft_clc == 'true'
+endif
+
+if with_microsoft_clc
+ with_clc = true
+ dep_clang = dependency(
+ 'clang',
+ method: 'cmake',
+ static: true,
+ modules: [
+ 'clangBasic', 'clangCodeGen', 'clangDriver', 'clangFrontend', 'clangFrontendTool',
+ 'clangHandleCXX', 'clangHandleLLVM',
+ ],
+ )
+endif
+
if host_machine.system() == 'darwin'
with_dri_platform = 'apple'
pre_args += '-DBUILDING_MESA'
@@ -1470,8 +1490,13 @@ if with_gallium_opencl
'lto', 'option', 'objcarcopts', 'profiledata',
]
endif
+if with_microsoft_clc
+ llvm_modules += ['target', 'linker', 'irreader', 'option', 'libdriver']
+endif
-if with_amd_vk or with_gallium_radeonsi or with_gallium_opencl
+if with_microsoft_clc
+ _llvm_version = '>= 10.0.0'
+elif with_amd_vk or with_gallium_radeonsi or with_gallium_opencl
_llvm_version = '>= 8.0.0'
elif with_gallium_swr
_llvm_version = '>= 6.0.0'
@@ -1521,7 +1546,7 @@ if _llvm != 'disabled'
optional_modules : llvm_optional_modules,
required : (
with_amd_vk or with_gallium_radeonsi or with_gallium_swr or
- with_gallium_opencl or _llvm == 'enabled'
+ with_gallium_opencl or with_microsoft_clc or _llvm == 'enabled'
),
static : not _shared_llvm,
method : _llvm_method,
@@ -1564,9 +1589,11 @@ elif with_amd_vk or with_gallium_radeonsi or with_gallium_swr
error('The following drivers require LLVM: Radv, RadeonSI, SWR. One of these is enabled, but LLVM is disabled.')
elif with_gallium_opencl
error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
+elif with_microsoft_clc
+ error('The Microsoft CLC compiler requires LLVM, but LLVM is disabled.')
endif
-with_opencl_spirv = _opencl != 'disabled' and get_option('opencl-spirv')
+with_opencl_spirv = (_opencl != 'disabled' and get_option('opencl-spirv')) or with_microsoft_clc
if with_opencl_spirv
chosen_llvm_version_array = dep_llvm.version().split('.')
chosen_llvm_version_major = chosen_llvm_version_array[0].to_int()