@@ -21,14 +21,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp(
21
21
22
22
cl_context CLContext = cl_adapter::cast<cl_context>(hContext);
23
23
cl_ext::clCreateCommandBufferKHR_fn clCreateCommandBufferKHR = nullptr ;
24
- cl_int Res =
24
+ UR_RETURN_ON_FAILURE (
25
25
cl_ext::getExtFuncFromContext<decltype (clCreateCommandBufferKHR)>(
26
26
CLContext, cl_ext::ExtFuncPtrCache->clCreateCommandBufferKHRCache ,
27
- cl_ext::CreateCommandBufferName, &clCreateCommandBufferKHR);
28
-
29
- if (!clCreateCommandBufferKHR || Res != CL_SUCCESS)
30
- return UR_RESULT_ERROR_INVALID_OPERATION;
27
+ cl_ext::CreateCommandBufferName, &clCreateCommandBufferKHR));
31
28
29
+ cl_int Res = CL_SUCCESS;
32
30
auto CLCommandBuffer = clCreateCommandBufferKHR (
33
31
1 , cl_adapter::cast<cl_command_queue *>(&Queue), nullptr , &Res);
34
32
CL_RETURN_ON_FAILURE_AND_SET_NULL (Res, phCommandBuffer);
@@ -51,12 +49,10 @@ urCommandBufferRetainExp(ur_exp_command_buffer_handle_t hCommandBuffer) {
51
49
52
50
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
53
51
cl_ext::clRetainCommandBufferKHR_fn clRetainCommandBuffer = nullptr ;
54
- cl_int Res = cl_ext::getExtFuncFromContext<decltype (clRetainCommandBuffer)>(
55
- CLContext, cl_ext::ExtFuncPtrCache->clRetainCommandBufferKHRCache ,
56
- cl_ext::RetainCommandBufferName, &clRetainCommandBuffer);
57
-
58
- if (!clRetainCommandBuffer || Res != CL_SUCCESS)
59
- return UR_RESULT_ERROR_INVALID_OPERATION;
52
+ UR_RETURN_ON_FAILURE (
53
+ cl_ext::getExtFuncFromContext<decltype (clRetainCommandBuffer)>(
54
+ CLContext, cl_ext::ExtFuncPtrCache->clRetainCommandBufferKHRCache ,
55
+ cl_ext::RetainCommandBufferName, &clRetainCommandBuffer));
60
56
61
57
CL_RETURN_ON_FAILURE (clRetainCommandBuffer (hCommandBuffer->CLCommandBuffer ));
62
58
return UR_RESULT_SUCCESS;
@@ -68,13 +64,10 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) {
68
64
69
65
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
70
66
cl_ext::clReleaseCommandBufferKHR_fn clReleaseCommandBufferKHR = nullptr ;
71
- cl_int Res =
67
+ UR_RETURN_ON_FAILURE (
72
68
cl_ext::getExtFuncFromContext<decltype (clReleaseCommandBufferKHR)>(
73
69
CLContext, cl_ext::ExtFuncPtrCache->clReleaseCommandBufferKHRCache ,
74
- cl_ext::ReleaseCommandBufferName, &clReleaseCommandBufferKHR);
75
-
76
- if (!clReleaseCommandBufferKHR || Res != CL_SUCCESS)
77
- return UR_RESULT_ERROR_INVALID_OPERATION;
70
+ cl_ext::ReleaseCommandBufferName, &clReleaseCommandBufferKHR));
78
71
79
72
CL_RETURN_ON_FAILURE (
80
73
clReleaseCommandBufferKHR (hCommandBuffer->CLCommandBuffer ));
@@ -85,13 +78,10 @@ UR_APIEXPORT ur_result_t UR_APICALL
85
78
urCommandBufferFinalizeExp (ur_exp_command_buffer_handle_t hCommandBuffer) {
86
79
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
87
80
cl_ext::clFinalizeCommandBufferKHR_fn clFinalizeCommandBufferKHR = nullptr ;
88
- cl_int Res =
81
+ UR_RETURN_ON_FAILURE (
89
82
cl_ext::getExtFuncFromContext<decltype (clFinalizeCommandBufferKHR)>(
90
83
CLContext, cl_ext::ExtFuncPtrCache->clFinalizeCommandBufferKHRCache ,
91
- cl_ext::FinalizeCommandBufferName, &clFinalizeCommandBufferKHR);
92
-
93
- if (!clFinalizeCommandBufferKHR || Res != CL_SUCCESS)
94
- return UR_RESULT_ERROR_INVALID_OPERATION;
84
+ cl_ext::FinalizeCommandBufferName, &clFinalizeCommandBufferKHR));
95
85
96
86
CL_RETURN_ON_FAILURE (
97
87
clFinalizeCommandBufferKHR (hCommandBuffer->CLCommandBuffer ));
@@ -109,13 +99,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
109
99
110
100
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
111
101
cl_ext::clCommandNDRangeKernelKHR_fn clCommandNDRangeKernelKHR = nullptr ;
112
- cl_int Res =
102
+ UR_RETURN_ON_FAILURE (
113
103
cl_ext::getExtFuncFromContext<decltype (clCommandNDRangeKernelKHR)>(
114
104
CLContext, cl_ext::ExtFuncPtrCache->clCommandNDRangeKernelKHRCache ,
115
- cl_ext::CommandNRRangeKernelName, &clCommandNDRangeKernelKHR);
116
-
117
- if (!clCommandNDRangeKernelKHR || Res != CL_SUCCESS)
118
- return UR_RESULT_ERROR_INVALID_OPERATION;
105
+ cl_ext::CommandNRRangeKernelName, &clCommandNDRangeKernelKHR));
119
106
120
107
CL_RETURN_ON_FAILURE (clCommandNDRangeKernelKHR (
121
108
hCommandBuffer->CLCommandBuffer , nullptr , nullptr ,
@@ -157,12 +144,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp(
157
144
158
145
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
159
146
cl_ext::clCommandCopyBufferKHR_fn clCommandCopyBufferKHR = nullptr ;
160
- cl_int Res = cl_ext::getExtFuncFromContext<decltype (clCommandCopyBufferKHR)>(
161
- CLContext, cl_ext::ExtFuncPtrCache->clCommandCopyBufferKHRCache ,
162
- cl_ext::CommandCopyBufferName, &clCommandCopyBufferKHR);
163
-
164
- if (!clCommandCopyBufferKHR || Res != CL_SUCCESS)
165
- return UR_RESULT_ERROR_INVALID_OPERATION;
147
+ UR_RETURN_ON_FAILURE (
148
+ cl_ext::getExtFuncFromContext<decltype (clCommandCopyBufferKHR)>(
149
+ CLContext, cl_ext::ExtFuncPtrCache->clCommandCopyBufferKHRCache ,
150
+ cl_ext::CommandCopyBufferName, &clCommandCopyBufferKHR));
166
151
167
152
CL_RETURN_ON_FAILURE (clCommandCopyBufferKHR (
168
153
hCommandBuffer->CLCommandBuffer , nullptr ,
@@ -193,13 +178,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp(
193
178
194
179
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
195
180
cl_ext::clCommandCopyBufferRectKHR_fn clCommandCopyBufferRectKHR = nullptr ;
196
- cl_int Res =
181
+ UR_RETURN_ON_FAILURE (
197
182
cl_ext::getExtFuncFromContext<decltype (clCommandCopyBufferRectKHR)>(
198
183
CLContext, cl_ext::ExtFuncPtrCache->clCommandCopyBufferRectKHRCache ,
199
- cl_ext::CommandCopyBufferRectName, &clCommandCopyBufferRectKHR);
200
-
201
- if (!clCommandCopyBufferRectKHR || Res != CL_SUCCESS)
202
- return UR_RESULT_ERROR_INVALID_OPERATION;
184
+ cl_ext::CommandCopyBufferRectName, &clCommandCopyBufferRectKHR));
203
185
204
186
CL_RETURN_ON_FAILURE (clCommandCopyBufferRectKHR (
205
187
hCommandBuffer->CLCommandBuffer , nullptr ,
@@ -283,12 +265,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp(
283
265
284
266
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
285
267
cl_ext::clCommandFillBufferKHR_fn clCommandFillBufferKHR = nullptr ;
286
- cl_int Res = cl_ext::getExtFuncFromContext<decltype (clCommandFillBufferKHR)>(
287
- CLContext, cl_ext::ExtFuncPtrCache->clCommandFillBufferKHRCache ,
288
- cl_ext::CommandFillBufferName, &clCommandFillBufferKHR);
289
-
290
- if (!clCommandFillBufferKHR || Res != CL_SUCCESS)
291
- return UR_RESULT_ERROR_INVALID_OPERATION;
268
+ UR_RETURN_ON_FAILURE (
269
+ cl_ext::getExtFuncFromContext<decltype (clCommandFillBufferKHR)>(
270
+ CLContext, cl_ext::ExtFuncPtrCache->clCommandFillBufferKHRCache ,
271
+ cl_ext::CommandFillBufferName, &clCommandFillBufferKHR));
292
272
293
273
CL_RETURN_ON_FAILURE (clCommandFillBufferKHR (
294
274
hCommandBuffer->CLCommandBuffer , nullptr ,
@@ -339,13 +319,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp(
339
319
340
320
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
341
321
cl_ext::clEnqueueCommandBufferKHR_fn clEnqueueCommandBufferKHR = nullptr ;
342
- cl_int Res =
322
+ UR_RETURN_ON_FAILURE (
343
323
cl_ext::getExtFuncFromContext<decltype (clEnqueueCommandBufferKHR)>(
344
324
CLContext, cl_ext::ExtFuncPtrCache->clEnqueueCommandBufferKHRCache ,
345
- cl_ext::EnqueueCommandBufferName, &clEnqueueCommandBufferKHR);
346
-
347
- if (!clEnqueueCommandBufferKHR || Res != CL_SUCCESS)
348
- return UR_RESULT_ERROR_INVALID_OPERATION;
325
+ cl_ext::EnqueueCommandBufferName, &clEnqueueCommandBufferKHR));
349
326
350
327
const uint32_t NumberOfQueues = 1 ;
351
328
@@ -382,13 +359,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp(
382
359
383
360
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext );
384
361
cl_ext::clGetCommandBufferInfoKHR_fn clGetCommandBufferInfoKHR = nullptr ;
385
- cl_int Res =
362
+ UR_RETURN_ON_FAILURE (
386
363
cl_ext::getExtFuncFromContext<decltype (clGetCommandBufferInfoKHR)>(
387
364
CLContext, cl_ext::ExtFuncPtrCache->clGetCommandBufferInfoKHRCache ,
388
- cl_ext::GetCommandBufferInfoName, &clGetCommandBufferInfoKHR);
389
-
390
- if (!clGetCommandBufferInfoKHR || Res != CL_SUCCESS)
391
- return UR_RESULT_ERROR_INVALID_OPERATION;
365
+ cl_ext::GetCommandBufferInfoName, &clGetCommandBufferInfoKHR));
392
366
393
367
if (propName != UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT) {
394
368
return UR_RESULT_ERROR_INVALID_ENUMERATION;
0 commit comments