2019-06-28 16:36:38 -07:00
|
|
|
# Copyright © 2017-2018 Intel Corporation
|
2017-12-08 15:26:00 -08:00
|
|
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
# SOFTWARE.
|
|
|
|
|
|
|
|
clover_cpp_args = []
|
2019-12-17 18:11:10 +01:00
|
|
|
clover_opencl_cpp_args = [
|
2020-11-06 13:55:53 +10:00
|
|
|
'-DCL_TARGET_OPENCL_VERSION=300',
|
2019-12-17 18:11:10 +01:00
|
|
|
'-DCL_USE_DEPRECATED_OPENCL_1_0_APIS',
|
|
|
|
'-DCL_USE_DEPRECATED_OPENCL_1_1_APIS',
|
|
|
|
'-DCL_USE_DEPRECATED_OPENCL_1_2_APIS',
|
|
|
|
'-DCL_USE_DEPRECATED_OPENCL_2_0_APIS',
|
2019-04-10 10:24:46 +10:00
|
|
|
'-DCL_USE_DEPRECATED_OPENCL_2_1_APIS',
|
2020-11-06 13:55:53 +10:00
|
|
|
'-DCL_USE_DEPRECATED_OPENCL_2_2_APIS',
|
2020-10-06 10:25:18 -07:00
|
|
|
'-DLIBCLC_INCLUDEDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'includedir')),
|
|
|
|
'-DLIBCLC_LIBEXECDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'libexecdir'))
|
2019-12-17 18:11:10 +01:00
|
|
|
]
|
2018-01-21 19:10:58 +01:00
|
|
|
clover_spirv_cpp_args = []
|
2017-12-08 15:26:00 -08:00
|
|
|
clover_incs = [inc_include, inc_src, inc_gallium, inc_gallium_aux]
|
|
|
|
|
2019-09-20 13:08:50 +02:00
|
|
|
# the CL header files declare attributes on the CL types. Compilers warn if
|
|
|
|
# we use them as template arguments. Disable the warning as there isn't
|
|
|
|
# anything we can do about it
|
|
|
|
if cpp.has_argument('-Wno-ignored-attributes')
|
|
|
|
clover_cpp_args += '-Wno-ignored-attributes'
|
|
|
|
endif
|
|
|
|
|
2017-12-08 15:26:00 -08:00
|
|
|
if with_opencl_icd
|
|
|
|
clover_cpp_args += '-DHAVE_CLOVER_ICD'
|
|
|
|
endif
|
|
|
|
|
2018-01-21 19:10:58 +01:00
|
|
|
if with_opencl_spirv
|
|
|
|
clover_spirv_cpp_args += '-DHAVE_CLOVER_SPIRV'
|
|
|
|
endif
|
|
|
|
|
2017-12-08 15:26:00 -08:00
|
|
|
libclllvm = static_library(
|
|
|
|
'clllvm',
|
|
|
|
files(
|
|
|
|
'llvm/codegen/bitcode.cpp',
|
|
|
|
'llvm/codegen/common.cpp',
|
|
|
|
'llvm/codegen/native.cpp',
|
|
|
|
'llvm/codegen.hpp',
|
|
|
|
'llvm/compat.hpp',
|
|
|
|
'llvm/invocation.cpp',
|
|
|
|
'llvm/invocation.hpp',
|
|
|
|
'llvm/metadata.hpp',
|
|
|
|
'llvm/util.hpp',
|
|
|
|
),
|
|
|
|
include_directories : clover_incs,
|
|
|
|
cpp_args : [
|
2019-09-20 13:08:50 +02:00
|
|
|
clover_cpp_args,
|
2019-12-17 18:11:10 +01:00
|
|
|
clover_opencl_cpp_args,
|
2019-09-20 13:08:50 +02:00
|
|
|
clover_spirv_cpp_args,
|
2019-06-28 16:36:38 -07:00
|
|
|
'-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths(
|
2020-11-18 18:28:49 -08:00
|
|
|
dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang',
|
2019-06-28 16:36:38 -07:00
|
|
|
dep_llvm.version(), 'include',
|
|
|
|
)),
|
2017-12-08 15:26:00 -08:00
|
|
|
],
|
2020-04-24 13:10:41 -07:00
|
|
|
gnu_symbol_visibility : 'hidden',
|
2020-11-24 17:31:59 -08:00
|
|
|
dependencies : [dep_llvm, dep_elf, dep_llvmspirvlib, idep_mesautil],
|
2017-12-08 15:26:00 -08:00
|
|
|
)
|
|
|
|
|
2018-02-10 21:40:10 +01:00
|
|
|
libclspirv = static_library(
|
|
|
|
'clspirv',
|
|
|
|
files('spirv/invocation.cpp', 'spirv/invocation.hpp'),
|
|
|
|
include_directories : clover_incs,
|
2020-04-24 13:10:41 -07:00
|
|
|
cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2020-11-24 17:31:59 -08:00
|
|
|
dependencies : [dep_spirv_tools, idep_mesautil],
|
2018-02-10 21:40:10 +01:00
|
|
|
)
|
|
|
|
|
2019-08-06 20:35:48 +02:00
|
|
|
libclnir = static_library(
|
|
|
|
'clnir',
|
2020-10-06 22:14:59 -05:00
|
|
|
files('nir/invocation.cpp', 'nir/invocation.hpp'),
|
2019-08-06 20:35:48 +02:00
|
|
|
include_directories : [clover_incs, inc_mesa],
|
2023-06-14 22:35:23 -07:00
|
|
|
dependencies : [idep_nir, idep_mesaclc],
|
2020-04-24 13:10:41 -07:00
|
|
|
cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-08-06 20:35:48 +02:00
|
|
|
)
|
|
|
|
|
2017-12-08 15:26:00 -08:00
|
|
|
clover_files = files(
|
|
|
|
'api/context.cpp',
|
|
|
|
'api/device.cpp',
|
|
|
|
'api/dispatch.cpp',
|
|
|
|
'api/dispatch.hpp',
|
|
|
|
'api/event.cpp',
|
|
|
|
'api/interop.cpp',
|
2020-11-06 16:25:21 +10:00
|
|
|
'api/invalid.cpp',
|
2017-12-08 15:26:00 -08:00
|
|
|
'api/kernel.cpp',
|
|
|
|
'api/memory.cpp',
|
|
|
|
'api/platform.cpp',
|
|
|
|
'api/program.cpp',
|
|
|
|
'api/queue.cpp',
|
|
|
|
'api/sampler.cpp',
|
|
|
|
'api/transfer.cpp',
|
|
|
|
'api/util.hpp',
|
2021-09-26 10:46:04 -07:00
|
|
|
'core/binary.cpp',
|
|
|
|
'core/binary.hpp',
|
2019-05-10 09:27:06 +02:00
|
|
|
'core/compiler.hpp',
|
2017-12-08 15:26:00 -08:00
|
|
|
'core/context.cpp',
|
|
|
|
'core/context.hpp',
|
|
|
|
'core/device.cpp',
|
|
|
|
'core/device.hpp',
|
|
|
|
'core/error.hpp',
|
|
|
|
'core/event.cpp',
|
|
|
|
'core/event.hpp',
|
|
|
|
'core/format.cpp',
|
|
|
|
'core/format.hpp',
|
|
|
|
'core/kernel.cpp',
|
|
|
|
'core/kernel.hpp',
|
|
|
|
'core/memory.cpp',
|
|
|
|
'core/memory.hpp',
|
|
|
|
'core/object.hpp',
|
|
|
|
'core/platform.cpp',
|
|
|
|
'core/platform.hpp',
|
clover: add core clover printf support (v12)
"The implementation is based on what LLVM AMD target expect.
The compiler provided an id link to argument desc and format used.
The runtime need to store them to be able to parse the buffer filled by
the device during the kernel execution, ie, an id value to find the
format and followed by the arguments values"
v2: airlied
Split out the core code to a separate patch, add support for the
different global buffer formats, and move the LLVM specific code
as much as possible to the backend.
v3: handle strings differences better
llvm backend stores strings to the printf buffer
nir backend stores them to a sideband storage in NIR and stores
an index in the buffer.
v4: move specifier parsing to util code.
v5: rename buffer fmt + make printf code work
v6: handle args/specifier number mismatch support
v7: move to single string + struct
v8: use "%s" to print strings to avoid bad specifier, fix str
calcs.
v9: move to the same global buffer format as llvm, just strings
are different now. This requires changes to nir lowering.
buffer format:
[0] contains offset into buffer at start contains 8
[1] contains length of buffer
v10: printf const clean, add warning, endian assert, print %%
at end, fix specifiers to vector
v11: minor cleanups, make sure the format string never contains
an n.
v12: validate format string
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
2020-10-29 10:05:45 +10:00
|
|
|
'core/printf.cpp',
|
|
|
|
'core/printf.hpp',
|
2017-12-08 15:26:00 -08:00
|
|
|
'core/program.cpp',
|
|
|
|
'core/program.hpp',
|
|
|
|
'core/property.hpp',
|
|
|
|
'core/queue.cpp',
|
|
|
|
'core/queue.hpp',
|
|
|
|
'core/resource.cpp',
|
|
|
|
'core/resource.hpp',
|
|
|
|
'core/sampler.cpp',
|
|
|
|
'core/sampler.hpp',
|
|
|
|
'core/timestamp.cpp',
|
|
|
|
'core/timestamp.hpp',
|
|
|
|
'util/adaptor.hpp',
|
|
|
|
'util/algebra.hpp',
|
|
|
|
'util/algorithm.hpp',
|
2021-09-26 11:03:56 -07:00
|
|
|
'util/compat.hpp',
|
2017-12-08 15:26:00 -08:00
|
|
|
'util/factor.hpp',
|
|
|
|
'util/functional.hpp',
|
|
|
|
'util/lazy.hpp',
|
|
|
|
'util/pointer.hpp',
|
|
|
|
'util/range.hpp',
|
|
|
|
'util/tuple.hpp',
|
|
|
|
)
|
|
|
|
|
|
|
|
libclover = static_library(
|
|
|
|
'clover',
|
2018-10-02 14:58:29 +01:00
|
|
|
[clover_files, sha1_h],
|
2017-12-08 15:26:00 -08:00
|
|
|
include_directories : clover_incs,
|
2019-12-17 18:11:10 +01:00
|
|
|
cpp_args : [
|
|
|
|
clover_opencl_cpp_args,
|
|
|
|
clover_spirv_cpp_args,
|
|
|
|
clover_cpp_args,
|
|
|
|
],
|
2020-04-24 13:10:41 -07:00
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-08-06 20:35:48 +02:00
|
|
|
link_with : [libclllvm, libclspirv, libclnir],
|
2022-11-22 09:20:59 +01:00
|
|
|
dependencies : [idep_mesautil, idep_nir],
|
2017-12-08 15:26:00 -08:00
|
|
|
)
|