-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathemulate.h
More file actions
268 lines (234 loc) · 8.16 KB
/
emulate.h
File metadata and controls
268 lines (234 loc) · 8.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
// Copyright (c) 2022-2026 Ben Ashbaugh
//
// SPDX-License-Identifier: MIT
*/
#include <CL/cl.h>
#include <CL/cl_ext.h>
#include <map>
extern bool g_EnhancedErrorChecking;
extern bool g_KernelForProfiling;
extern bool g_SuggestedLocalWorkSize;
extern const struct _cl_icd_dispatch* g_pNextDispatch;
struct SLayerContext
{
typedef std::map<cl_event, cl_event> CEventMap;
CEventMap EventMap;
};
SLayerContext& getLayerContext(void);
///////////////////////////////////////////////////////////////////////////////
// Emulated Functions
cl_command_buffer_khr CL_API_CALL clCreateCommandBufferKHR_EMU(
cl_uint num_queues,
const cl_command_queue* queues,
const cl_command_buffer_properties_khr* properties,
cl_int* errcode_ret);
cl_int CL_API_CALL clFinalizeCommandBufferKHR_EMU(
cl_command_buffer_khr command_buffer);
cl_int CL_API_CALL clRetainCommandBufferKHR_EMU(
cl_command_buffer_khr command_buffer);
cl_int CL_API_CALL clReleaseCommandBufferKHR_EMU(
cl_command_buffer_khr command_buffer);
cl_int CL_API_CALL clEnqueueCommandBufferKHR_EMU(
cl_uint num_queues,
cl_command_queue* queues,
cl_command_buffer_khr command_buffer,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
cl_int CL_API_CALL clCommandBarrierWithWaitListKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandCopyBufferKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_mem src_buffer,
cl_mem dst_buffer,
size_t src_offset,
size_t dst_offset,
size_t size,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandCopyBufferRectKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_mem src_buffer,
cl_mem dst_buffer,
const size_t* src_origin,
const size_t* dst_origin,
const size_t* region,
size_t src_row_pitch,
size_t src_slice_pitch,
size_t dst_row_pitch,
size_t dst_slice_pitch,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandCopyBufferToImageKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_mem src_buffer,
cl_mem dst_image,
size_t src_offset,
const size_t* dst_origin,
const size_t* region,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandCopyImageKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_mem src_image,
cl_mem dst_image,
const size_t* src_origin,
const size_t* dst_origin,
const size_t* region,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandCopyImageToBufferKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_mem src_image,
cl_mem dst_buffer,
const size_t* src_origin,
const size_t* region,
size_t dst_offset,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandFillBufferKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_mem buffer,
const void* pattern,
size_t pattern_size,
size_t offset,
size_t size,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandFillImageKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_mem image,
const void* fill_color,
const size_t* origin,
const size_t* region,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandSVMMemcpyKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
void* dst_ptr,
const void* src_ptr,
size_t size,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandSVMMemFillKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
void* svm_ptr,
const void* pattern,
size_t pattern_size,
size_t size,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clCommandNDRangeKernelKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_queue command_queue,
const cl_command_properties_khr* properties,
cl_kernel kernel,
cl_uint work_dim,
const size_t* global_work_offset,
const size_t* global_work_size,
const size_t* local_work_size,
cl_uint num_sync_points_in_wait_list,
const cl_sync_point_khr* sync_point_wait_list,
cl_sync_point_khr* sync_point,
cl_mutable_command_khr* mutable_handle);
cl_int CL_API_CALL clGetCommandBufferInfoKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_command_buffer_info_khr param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
#if defined(cl_khr_command_buffer_multi_device) && 0
cl_command_buffer_khr CL_API_CALL clRemapCommandBufferKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_bool automatic,
cl_uint num_queues,
const cl_command_queue* queues,
cl_uint num_handles,
const cl_mutable_command_khr* handles,
cl_mutable_command_khr* handles_ret,
cl_int* errcode_ret);
#endif // defined(cl_khr_command_buffer_multi_device)
cl_int CL_API_CALL clUpdateMutableCommandsKHR_EMU(
cl_command_buffer_khr command_buffer,
cl_uint num_configs,
const cl_command_buffer_update_type_khr* config_types,
const void** configs );
cl_int CL_API_CALL clGetMutableCommandInfoKHR_EMU(
cl_mutable_command_khr command,
cl_mutable_command_info_khr param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
///////////////////////////////////////////////////////////////////////////////
// Override Functions
bool clGetDeviceInfo_override(
cl_device_id device,
cl_device_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret,
cl_int* errcode_ret);
bool clGetEventInfo_override(
cl_event event,
cl_event_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret,
cl_int* errcode_ret);
bool clGetEventProfilingInfo_override(
cl_event event,
cl_profiling_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret,
cl_int* errcode_ret);
bool clGetPlatformInfo_override(
cl_platform_id platform,
cl_platform_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret,
cl_int* errcode_ret);