Tensor Tiling Library
 
Loading...
Searching...
No Matches
preprocess_ttl.h
Go to the documentation of this file.
1/*
2 * TTL.h
3 *
4 * Copyright (c) 2023 Mobileye
5 *
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#pragma once
20
21/**
22 * This file is used for the preprocessed file header case.
23 *
24 * It selected TTL_c.h or TTL_opencl.h depending on the value of
25 * TTL_TARGET
26 *
27 * Durring an install with TTL_PRE_GENERATE it will be placed in the
28 * target directory alongside TTL_c.h and TTL_opencl.h
29 */
30
31/**
32 * @def TTL_TARGET
33 *
34 * @brief Define the target for TTL
35 *
36 * TTL can be built for multible targets - native support is
37 * - opencl - default if TTL_TARGET not predefined.
38 * - c
39 *
40 * Other platforms can be provided.
41 */
42#ifndef TTL_TARGET
43#define TTL_TARGET opencl
44#endif
45
46/**
47 * @def __TTL_STR_CONCAT1
48 *
49 * Concatenate x and y, must be used within another macro.
50 */
51#define __TTL_STR_CONCAT1(x, y) x##y
52
53/**
54 * @def __TTL_STR_CONCAT2
55 *
56 * Concatenate x and y, can be used standalone
57 */
58#define __TTL_STR_CONCAT2(x, y) __TTL_STR_CONCAT1(x, y)
59
60/**
61 * @def __TTL_STRINGFY1
62 *
63 * Turn s into a "string", must be used within another macro
64 */
65#define __TTL_STRINGFY1(s) #s
66
67/**
68 * @def __TTL_STRINGFY2
69 *
70 * Turn s into a "string", can be used standalone
71 */
72#define __TTL_STRINGFY2(s) __TTL_STRINGFY1(s)
73
74/**
75 * @def TTL_INCLUDE_H
76 *
77 * @brief Create an include name based on TTL_TARGET
78 *
79 * Values in the base distribution include
80 * - opencl/TTL_types.h
81 * - c/TTL_types.h
82 */
83// clang-format off
84#define TTL_INCLUDE_H_1 __TTL_STR_CONCAT2(TTL_, TTL_TARGET)
85#define TTL_INCLUDE_H_2 __TTL_STRINGFY2(TTL_INCLUDE_H_1.h)
86// clang-format on
87
88#include TTL_INCLUDE_H_2