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