Skip to content

Commit 67d4c97

Browse files
authored
update to the latest command buffer APIs (#378)
1 parent 8793b7b commit 67d4c97

File tree

7 files changed

+102
-57
lines changed

7 files changed

+102
-57
lines changed

intercept/src/cli_ext.h

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern "C" {
1313
///////////////////////////////////////////////////////////////////////////////
1414
// cl_khr_command_buffer
1515

16-
// Note: This implements the provisional extension v0.9.2.
16+
// Note: This implements the provisional extension v0.9.5.
1717

1818
typedef cl_bitfield cl_device_command_buffer_capabilities_khr;
1919
typedef struct _cl_command_buffer_khr* cl_command_buffer_khr;
@@ -22,7 +22,7 @@ typedef cl_uint cl_command_buffer_info_khr;
2222
typedef cl_uint cl_command_buffer_state_khr;
2323
typedef cl_properties cl_command_buffer_properties_khr;
2424
typedef cl_bitfield cl_command_buffer_flags_khr;
25-
typedef cl_properties cl_ndrange_kernel_command_properties_khr;
25+
typedef cl_properties cl_command_properties_khr;
2626
typedef struct _cl_mutable_command_khr* cl_mutable_command_khr;
2727

2828
#define CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR 0x12A9
@@ -86,6 +86,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
8686
clCommandBarrierWithWaitListKHR(
8787
cl_command_buffer_khr command_buffer,
8888
cl_command_queue command_queue,
89+
const cl_command_properties_khr* properties,
8990
cl_uint num_sync_points_in_wait_list,
9091
const cl_sync_point_khr* sync_point_wait_list,
9192
cl_sync_point_khr* sync_point,
@@ -95,6 +96,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
9596
clCommandCopyBufferKHR(
9697
cl_command_buffer_khr command_buffer,
9798
cl_command_queue command_queue,
99+
const cl_command_properties_khr* properties,
98100
cl_mem src_buffer,
99101
cl_mem dst_buffer,
100102
size_t src_offset,
@@ -109,6 +111,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
109111
clCommandCopyBufferRectKHR(
110112
cl_command_buffer_khr command_buffer,
111113
cl_command_queue command_queue,
114+
const cl_command_properties_khr* properties,
112115
cl_mem src_buffer,
113116
cl_mem dst_buffer,
114117
const size_t* src_origin,
@@ -127,6 +130,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
127130
clCommandCopyBufferToImageKHR(
128131
cl_command_buffer_khr command_buffer,
129132
cl_command_queue command_queue,
133+
const cl_command_properties_khr* properties,
130134
cl_mem src_buffer,
131135
cl_mem dst_image,
132136
size_t src_offset,
@@ -141,6 +145,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
141145
clCommandCopyImageKHR(
142146
cl_command_buffer_khr command_buffer,
143147
cl_command_queue command_queue,
148+
const cl_command_properties_khr* properties,
144149
cl_mem src_image,
145150
cl_mem dst_image,
146151
const size_t* src_origin,
@@ -155,6 +160,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
155160
clCommandCopyImageToBufferKHR(
156161
cl_command_buffer_khr command_buffer,
157162
cl_command_queue command_queue,
163+
const cl_command_properties_khr* properties,
158164
cl_mem src_image,
159165
cl_mem dst_buffer,
160166
const size_t* src_origin,
@@ -169,6 +175,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
169175
clCommandFillBufferKHR(
170176
cl_command_buffer_khr command_buffer,
171177
cl_command_queue command_queue,
178+
const cl_command_properties_khr* properties,
172179
cl_mem buffer,
173180
const void* pattern,
174181
size_t pattern_size,
@@ -183,6 +190,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
183190
clCommandFillImageKHR(
184191
cl_command_buffer_khr command_buffer,
185192
cl_command_queue command_queue,
193+
const cl_command_properties_khr* properties,
186194
cl_mem image,
187195
const void* fill_color,
188196
const size_t* origin,
@@ -196,6 +204,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
196204
clCommandSVMMemcpyKHR(
197205
cl_command_buffer_khr command_buffer,
198206
cl_command_queue command_queue,
207+
const cl_command_properties_khr* properties,
199208
void* dst_ptr,
200209
const void* src_ptr,
201210
size_t size,
@@ -208,6 +217,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
208217
clCommandSVMMemFillKHR(
209218
cl_command_buffer_khr command_buffer,
210219
cl_command_queue command_queue,
220+
const cl_command_properties_khr* properties,
211221
void* svm_ptr,
212222
const void* pattern,
213223
size_t pattern_size,
@@ -221,7 +231,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL
221231
clCommandNDRangeKernelKHR(
222232
cl_command_buffer_khr command_buffer,
223233
cl_command_queue command_queue,
224-
const cl_ndrange_kernel_command_properties_khr* properties,
234+
const cl_command_properties_khr* properties,
225235
cl_kernel kernel,
226236
cl_uint work_dim,
227237
const size_t* global_work_offset,
@@ -273,9 +283,9 @@ clRemapCommandBufferKHR(
273283
///////////////////////////////////////////////////////////////////////////////
274284
// cl_khr_command_buffer_mutable_dispatch
275285

276-
// Note: This implements the provisional extension v0.9.1.
286+
// Note: This implements the provisional extension v0.9.3.
277287

278-
typedef cl_uint cl_command_buffer_structure_type_khr;
288+
typedef cl_uint cl_command_buffer_update_type_khr;
279289
typedef cl_bitfield cl_mutable_dispatch_fields_khr;
280290
typedef cl_uint cl_mutable_command_info_khr;
281291
typedef struct _cl_mutable_dispatch_arg_khr {
@@ -289,8 +299,6 @@ typedef struct _cl_mutable_dispatch_exec_info_khr {
289299
const void* param_value;
290300
} cl_mutable_dispatch_exec_info_khr;
291301
typedef struct _cl_mutable_dispatch_config_khr {
292-
cl_command_buffer_structure_type_khr type;
293-
const void* next;
294302
cl_mutable_command_khr command;
295303
cl_uint num_args;
296304
cl_uint num_svm_args;
@@ -303,12 +311,6 @@ typedef struct _cl_mutable_dispatch_config_khr {
303311
const size_t* global_work_size;
304312
const size_t* local_work_size;
305313
} cl_mutable_dispatch_config_khr;
306-
typedef struct _cl_mutable_base_config_khr {
307-
cl_command_buffer_structure_type_khr type;
308-
const void* next;
309-
cl_uint num_mutable_dispatch;
310-
const cl_mutable_dispatch_config_khr* mutable_dispatch_list;
311-
} cl_mutable_base_config_khr;
312314
typedef cl_bitfield cl_mutable_dispatch_asserts_khr;
313315

314316
#define CL_COMMAND_BUFFER_MUTABLE_KHR (1 << 1)
@@ -327,15 +329,14 @@ typedef cl_bitfield cl_mutable_dispatch_asserts_khr;
327329
#define CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR 0x12A0
328330
#define CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR 0x12A1
329331
#define CL_MUTABLE_COMMAND_COMMAND_TYPE_KHR 0x12AD
330-
#define CL_MUTABLE_DISPATCH_PROPERTIES_ARRAY_KHR 0x12A2
332+
#define CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR 0x12A2
331333
#define CL_MUTABLE_DISPATCH_KERNEL_KHR 0x12A3
332334
#define CL_MUTABLE_DISPATCH_DIMENSIONS_KHR 0x12A4
333335
#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_OFFSET_KHR 0x12A5
334336
#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_SIZE_KHR 0x12A6
335337
#define CL_MUTABLE_DISPATCH_LOCAL_WORK_SIZE_KHR 0x12A7
336338

337-
#define CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR 0
338-
#define CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR 1
339+
#define CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR 0
339340

340341
#define CL_COMMAND_BUFFER_MUTABLE_DISPATCH_ASSERTS_KHR 0x12B7
341342

@@ -346,7 +347,9 @@ typedef cl_bitfield cl_mutable_dispatch_asserts_khr;
346347
extern CL_API_ENTRY cl_int CL_API_CALL
347348
clUpdateMutableCommandsKHR(
348349
cl_command_buffer_khr command_buffer,
349-
const cl_mutable_base_config_khr* mutable_config) ;
350+
cl_uint num_configs,
351+
const cl_command_buffer_update_type_khr* config_types,
352+
const void** configs);
350353

351354
extern CL_API_ENTRY cl_int CL_API_CALL
352355
clGetMutableCommandInfoKHR(

intercept/src/dispatch.cpp

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10665,6 +10665,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueCommandBufferKHR(
1066510665
CL_API_ENTRY cl_int CL_API_CALL clCommandBarrierWithWaitListKHR(
1066610666
cl_command_buffer_khr command_buffer,
1066710667
cl_command_queue command_queue,
10668+
const cl_command_properties_khr* properties,
1066810669
cl_uint num_sync_points_in_wait_list,
1066910670
const cl_sync_point_khr* sync_point_wait_list,
1067010671
cl_sync_point_khr* sync_point,
@@ -10694,6 +10695,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandBarrierWithWaitListKHR(
1069410695
cl_int retVal = dispatchX.clCommandBarrierWithWaitListKHR(
1069510696
command_buffer,
1069610697
command_queue,
10698+
properties,
1069710699
num_sync_points_in_wait_list,
1069810700
sync_point_wait_list,
1069910701
sync_point,
@@ -10717,6 +10719,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandBarrierWithWaitListKHR(
1071710719
CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferKHR(
1071810720
cl_command_buffer_khr command_buffer,
1071910721
cl_command_queue command_queue,
10722+
const cl_command_properties_khr* properties,
1072010723
cl_mem src_buffer,
1072110724
cl_mem dst_buffer,
1072210725
size_t src_offset,
@@ -10751,6 +10754,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferKHR(
1075110754
cl_int retVal = dispatchX.clCommandCopyBufferKHR(
1075210755
command_buffer,
1075310756
command_queue,
10757+
properties,
1075410758
src_buffer,
1075510759
dst_buffer,
1075610760
src_offset,
@@ -10779,6 +10783,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferKHR(
1077910783
CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferRectKHR(
1078010784
cl_command_buffer_khr command_buffer,
1078110785
cl_command_queue command_queue,
10786+
const cl_command_properties_khr* properties,
1078210787
cl_mem src_buffer,
1078310788
cl_mem dst_buffer,
1078410789
const size_t* src_origin,
@@ -10817,6 +10822,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferRectKHR(
1081710822
cl_int retVal = dispatchX.clCommandCopyBufferRectKHR(
1081810823
command_buffer,
1081910824
command_queue,
10825+
properties,
1082010826
src_buffer,
1082110827
dst_buffer,
1082210828
src_origin,
@@ -10849,6 +10855,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferRectKHR(
1084910855
CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferToImageKHR(
1085010856
cl_command_buffer_khr command_buffer,
1085110857
cl_command_queue command_queue,
10858+
const cl_command_properties_khr* properties,
1085210859
cl_mem src_buffer,
1085310860
cl_mem dst_image,
1085410861
size_t src_offset,
@@ -10883,6 +10890,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferToImageKHR(
1088310890
cl_int retVal = dispatchX.clCommandCopyBufferToImageKHR(
1088410891
command_buffer,
1088510892
command_queue,
10893+
properties,
1088610894
src_buffer,
1088710895
dst_image,
1088810896
src_offset,
@@ -10911,6 +10919,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyBufferToImageKHR(
1091110919
CL_API_ENTRY cl_int CL_API_CALL clCommandCopyImageKHR(
1091210920
cl_command_buffer_khr command_buffer,
1091310921
cl_command_queue command_queue,
10922+
const cl_command_properties_khr* properties,
1091410923
cl_mem src_image,
1091510924
cl_mem dst_image,
1091610925
const size_t* src_origin,
@@ -10945,6 +10954,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyImageKHR(
1094510954
cl_int retVal = dispatchX.clCommandCopyImageKHR(
1094610955
command_buffer,
1094710956
command_queue,
10957+
properties,
1094810958
src_image,
1094910959
dst_image,
1095010960
src_origin,
@@ -10973,6 +10983,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyImageKHR(
1097310983
CL_API_ENTRY cl_int CL_API_CALL clCommandCopyImageToBufferKHR(
1097410984
cl_command_buffer_khr command_buffer,
1097510985
cl_command_queue command_queue,
10986+
const cl_command_properties_khr* properties,
1097610987
cl_mem src_image,
1097710988
cl_mem dst_buffer,
1097810989
const size_t* src_origin,
@@ -11009,6 +11020,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyImageToBufferKHR(
1100911020
cl_int retVal = dispatchX.clCommandCopyImageToBufferKHR(
1101011021
command_buffer,
1101111022
command_queue,
11023+
properties,
1101211024
src_image,
1101311025
dst_buffer,
1101411026
src_origin,
@@ -11037,6 +11049,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandCopyImageToBufferKHR(
1103711049
CL_API_ENTRY cl_int CL_API_CALL clCommandFillBufferKHR(
1103811050
cl_command_buffer_khr command_buffer,
1103911051
cl_command_queue command_queue,
11052+
const cl_command_properties_khr* properties,
1104011053
cl_mem buffer,
1104111054
const void* pattern,
1104211055
size_t pattern_size,
@@ -11071,6 +11084,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandFillBufferKHR(
1107111084
cl_int retVal = dispatchX.clCommandFillBufferKHR(
1107211085
command_buffer,
1107311086
command_queue,
11087+
properties,
1107411088
buffer,
1107511089
pattern,
1107611090
pattern_size,
@@ -11099,6 +11113,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandFillBufferKHR(
1109911113
CL_API_ENTRY cl_int CL_API_CALL clCommandFillImageKHR(
1110011114
cl_command_buffer_khr command_buffer,
1110111115
cl_command_queue command_queue,
11116+
const cl_command_properties_khr* properties,
1110211117
cl_mem image,
1110311118
const void* fill_color,
1110411119
const size_t* origin,
@@ -11132,6 +11147,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandFillImageKHR(
1113211147
cl_int retVal = dispatchX.clCommandFillImageKHR(
1113311148
command_buffer,
1113411149
command_queue,
11150+
properties,
1113511151
image,
1113611152
fill_color,
1113711153
origin,
@@ -11159,6 +11175,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandFillImageKHR(
1115911175
CL_API_ENTRY cl_int CL_API_CALL clCommandSVMMemcpyKHR(
1116011176
cl_command_buffer_khr command_buffer,
1116111177
cl_command_queue command_queue,
11178+
const cl_command_properties_khr* properties,
1116211179
void* dst_ptr,
1116311180
const void* src_ptr,
1116411181
size_t size,
@@ -11194,6 +11211,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandSVMMemcpyKHR(
1119411211
cl_int retVal = dispatchX.clCommandSVMMemcpyKHR(
1119511212
command_buffer,
1119611213
command_queue,
11214+
properties,
1119711215
dst_ptr,
1119811216
src_ptr,
1119911217
size,
@@ -11220,6 +11238,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandSVMMemcpyKHR(
1122011238
CL_API_ENTRY cl_int CL_API_CALL clCommandSVMMemFillKHR(
1122111239
cl_command_buffer_khr command_buffer,
1122211240
cl_command_queue command_queue,
11241+
const cl_command_properties_khr* properties,
1122311242
void* svm_ptr,
1122411243
const void* pattern,
1122511244
size_t pattern_size,
@@ -11256,6 +11275,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandSVMMemFillKHR(
1125611275
cl_int retVal = dispatchX.clCommandSVMMemFillKHR(
1125711276
command_buffer,
1125811277
command_queue,
11278+
properties,
1125911279
svm_ptr,
1126011280
pattern,
1126111281
pattern_size,
@@ -11283,7 +11303,7 @@ CL_API_ENTRY cl_int CL_API_CALL clCommandSVMMemFillKHR(
1128311303
CL_API_ENTRY cl_int CL_API_CALL clCommandNDRangeKernelKHR(
1128411304
cl_command_buffer_khr command_buffer,
1128511305
cl_command_queue command_queue,
11286-
const cl_ndrange_kernel_command_properties_khr* properties,
11306+
const cl_command_properties_khr* properties,
1128711307
cl_kernel kernel,
1128811308
cl_uint work_dim,
1128911309
const size_t* global_work_offset,
@@ -11476,7 +11496,9 @@ CL_API_ENTRY cl_command_buffer_khr CL_API_CALL clRemapCommandBufferKHR(
1147611496
// cl_khr_command_buffer_mutable_dispatch
1147711497
CL_API_ENTRY cl_int CL_API_CALL clUpdateMutableCommandsKHR(
1147811498
cl_command_buffer_khr command_buffer,
11479-
const cl_mutable_base_config_khr* mutable_config)
11499+
cl_uint num_configs,
11500+
const cl_command_buffer_update_type_khr* config_types,
11501+
const void** configs)
1148011502
{
1148111503
CLIntercept* pIntercept = GetIntercept();
1148211504

@@ -11486,24 +11508,27 @@ CL_API_ENTRY cl_int CL_API_CALL clUpdateMutableCommandsKHR(
1148611508
if( dispatchX.clUpdateMutableCommandsKHR )
1148711509
{
1148811510
GET_ENQUEUE_COUNTER();
11489-
CALL_LOGGING_ENTER( "command_buffer = %p, mutable_config = %p",
11511+
CALL_LOGGING_ENTER( "command_buffer = %p, num_configs = %u",
1149011512
command_buffer,
11491-
mutable_config );
11513+
num_configs );
1149211514
if( pIntercept->config().CallLogging )
1149311515
{
1149411516
std::string configStr;
1149511517
pIntercept->getCommandBufferMutableConfigString(
11496-
mutable_config,
11518+
num_configs,
11519+
config_types,
11520+
configs,
1149711521
configStr );
11498-
CALL_LOGGING_INFO("mutable_config %p: %s",
11499-
mutable_config,
11522+
CALL_LOGGING_INFO(" configs = %s",
1150011523
configStr.c_str() );
1150111524
}
1150211525
HOST_PERFORMANCE_TIMING_START();
1150311526

1150411527
cl_int retVal = dispatchX.clUpdateMutableCommandsKHR(
1150511528
command_buffer,
11506-
mutable_config );
11529+
num_configs,
11530+
config_types,
11531+
configs );
1150711532

1150811533
HOST_PERFORMANCE_TIMING_END();
1150911534
CHECK_ERROR( retVal );

0 commit comments

Comments
 (0)