Tensor Tiling Library
 
Loading...
Searching...
No Matches
opencl/TTL_types.h
Go to the documentation of this file.
1/*
2 * TTL_types.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
19typedef unsigned int TTL_dim_t; ///< The type used to hold the size of an object along any dimension
20typedef int TTL_offset_dim_t; ///< The type used to hold offsets and origins.
21
22/**
23 * @def TTL_global
24 * @brief Create a typed reference in the __global address space.
25 *
26 * Using this macro allows a global reference to be created in an implmentation indepedent way.
27 *
28 * For example a pointer to a struct MyStruct in the global namespace.
29 *
30 * @code {.c}
31 * TTL_global(MyStruct *)
32 * @endcode
33 *
34 * for an unsigned int
35 *
36 * @code {.c}
37 * TTL_global(unsigned int *)
38 * @endcode
39 */
40
41/**
42 * @def TTL_global_printf
43 *
44 * Different implementations use different types for global pointers, using TTL_global_printf
45 * allows for agnostic implementations.
46 *
47 * @code {.c}
48 * TTL_global(MyStruct *) ptr_my_struct;
49 * printf("Ptr to my struct " TTL_global_printf "\n", ptr_my_struct)
50 * @endcode
51 */
52
53/**
54 * @def TTL_local
55 * @brief Create a typed reference in the __local address space.
56 *
57 * Using this macro allows a local reference to be created in an implmentation indepedent way.
58 *
59 * For example a pointer to a struct MyStruct in the local namespace.
60 *
61 * @code {.c}
62 * TTL_local(MyStruct *)
63 * @endcode
64 *
65 * for an unsigned int
66 *
67 * @code {.c}
68 * TTL_local(unsigned int *)
69 * @endcode
70 */
71
72/**
73 * @def TTL_local_printf
74 *
75 * Different implementations use different types for local pointers, using TTL_local_printf
76 * allows for agnostic implementations.
77 *
78 * @code {.c}
79 * TTL_local(MyStruct *) ptr_my_struct;
80 * printf("Ptr to my struct " TTL_local_printf "\n", ptr_my_struct)
81 * @endcode
82 */
83
84/**
85 * @brief TTL_event_t is a pseudonym for OpenCL event_t
86 *
87 * To allow full compatibility with OpenCL but allow other implementations to
88 * use TTL_event_t in a way that is more applicable to their platforms we
89 * used TTL_event_t. For OpenCL TTL_event_t is event_t.
90 */
91typedef event_t TTL_event_t;
92
93/**
94 * @brief Internal non-API helper function to allow debugging of events
95 *
96 * @param event
97 *
98 * @todo Add file name information if/once PHDL supports %s in format strings
99 */
100
101static inline void __TTL_dump_event(const TTL_event_t *const ttl_event) {
102 // In OpenCL compiler an event_t is a pointer to a mask of channels
103 const unsigned char *const event = *(const unsigned char **)ttl_event;
104
105 if (!event) {
106 printf("event=NULL");
107 } else {
108 printf("event=%p (channels mask=0x%x)", event, *event);
109 }
110}
event_t TTL_event_t
TTL_event_t is a pseudonym for OpenCL event_t.
unsigned char event_t
event_t is not supported, so provide a harmless placeholder
Definition c/TTL_types.h:28
unsigned int TTL_dim_t
The type used to hold the size of an object along any dimension.
int TTL_offset_dim_t
The type used to hold offsets and origins.