|
8 | 8 | // |
9 | 9 | //===----------------------------------------------------------------------===// |
10 | 10 | #include "command_buffer.hpp" |
| 11 | +#include "logger/ur_logger.hpp" |
11 | 12 | #include "ur_level_zero.hpp" |
12 | 13 |
|
13 | 14 | /* L0 Command-buffer Extension Doc see: |
@@ -140,16 +141,16 @@ ur_result_t calculateKernelWorkDimensions( |
140 | 141 | while (GlobalWorkSize3D[I] % GroupSize[I]) { |
141 | 142 | --GroupSize[I]; |
142 | 143 | } |
143 | | - if (GlobalWorkSize3D[I] / GroupSize[I] > UINT32_MAX) { |
144 | | - urPrint("calculateKernelWorkDimensions: can't find a WG size " |
145 | | - "suitable for global work size > UINT32_MAX\n"); |
| 144 | + if (GlobalWorkSize[I] / GroupSize[I] > UINT32_MAX) { |
| 145 | + logger::debug("calculateKernelWorkDimensions: can't find a WG size " |
| 146 | + "suitable for global work size > UINT32_MAX"); |
146 | 147 | return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; |
147 | 148 | } |
148 | 149 | WG[I] = GroupSize[I]; |
149 | 150 | } |
150 | | - urPrint("calculateKernelWorkDimensions: using computed WG size = {%d, " |
151 | | - "%d, %d}\n", |
152 | | - WG[0], WG[1], WG[2]); |
| 151 | + logger::debug("calculateKernelWorkDimensions: using computed WG " |
| 152 | + "size = {{{}, {}, {}}}", |
| 153 | + WG[0], WG[1], WG[2]); |
153 | 154 | } |
154 | 155 | } |
155 | 156 |
|
@@ -177,30 +178,27 @@ ur_result_t calculateKernelWorkDimensions( |
177 | 178 | break; |
178 | 179 |
|
179 | 180 | default: |
180 | | - urPrint("calculateKernelWorkDimensions: unsupported work_dim\n"); |
| 181 | + logger::error("calculateKernelWorkDimensions: unsupported work_dim"); |
181 | 182 | return UR_RESULT_ERROR_INVALID_VALUE; |
182 | 183 | } |
183 | 184 |
|
184 | 185 | // Error handling for non-uniform group size case |
185 | 186 | if (GlobalWorkSize3D[0] != |
186 | 187 | size_t(ZeThreadGroupDimensions.groupCountX) * WG[0]) { |
187 | | - urPrint("calculateKernelWorkDimensions: invalid work_dim. The range " |
188 | | - "is not a " |
189 | | - "multiple of the group size in the 1st dimension\n"); |
| 188 | + logger::error("calculateKernelWorkDimensions: invalid work_dim. The range " |
| 189 | + "is not a multiple of the group size in the 1st dimension"); |
190 | 190 | return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; |
191 | 191 | } |
192 | 192 | if (GlobalWorkSize3D[1] != |
193 | 193 | size_t(ZeThreadGroupDimensions.groupCountY) * WG[1]) { |
194 | | - urPrint("calculateKernelWorkDimensions: invalid work_dim. The range " |
195 | | - "is not a " |
196 | | - "multiple of the group size in the 2nd dimension\n"); |
| 194 | + logger::error("calculateKernelWorkDimensions: invalid work_dim. The range " |
| 195 | + "is not a multiple of the group size in the 2nd dimension"); |
197 | 196 | return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; |
198 | 197 | } |
199 | 198 | if (GlobalWorkSize3D[2] != |
200 | 199 | size_t(ZeThreadGroupDimensions.groupCountZ) * WG[2]) { |
201 | | - urPrint("calculateKernelWorkDimensions: invalid work_dim. The range " |
202 | | - "is not a " |
203 | | - "multiple of the group size in the 3rd dimension\n"); |
| 200 | + logger::error("calculateKernelWorkDimensions: invalid work_dim. The range " |
| 201 | + "is not a multiple of the group size in the 3rd dimension"); |
204 | 202 | return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; |
205 | 203 | } |
206 | 204 |
|
@@ -268,9 +266,9 @@ static ur_result_t enqueueCommandBufferMemCopyHelper( |
268 | 266 | (CommandBuffer->ZeCommandList, Dst, Src, Size, |
269 | 267 | LaunchEvent->ZeEvent, ZeEventList.size(), ZeEventList.data())); |
270 | 268 |
|
271 | | - urPrint("calling zeCommandListAppendMemoryCopy() with" |
272 | | - " ZeEvent %#" PRIxPTR "\n", |
273 | | - ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
| 269 | + logger::debug("calling zeCommandListAppendMemoryCopy() with" |
| 270 | + " ZeEvent {}", |
| 271 | + ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
274 | 272 |
|
275 | 273 | return UR_RESULT_SUCCESS; |
276 | 274 | } |
@@ -335,9 +333,9 @@ static ur_result_t enqueueCommandBufferMemCopyRectHelper( |
335 | 333 | DstSlicePitch, Src, &ZeSrcRegion, SrcPitch, SrcSlicePitch, |
336 | 334 | LaunchEvent->ZeEvent, ZeEventList.size(), ZeEventList.data())); |
337 | 335 |
|
338 | | - urPrint("calling zeCommandListAppendMemoryCopyRegion() with" |
339 | | - " ZeEvent %#" PRIxPTR "\n", |
340 | | - ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
| 336 | + logger::debug("calling zeCommandListAppendMemoryCopyRegion() with" |
| 337 | + " ZeEvent {}", |
| 338 | + ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
341 | 339 |
|
342 | 340 | return UR_RESULT_SUCCESS; |
343 | 341 | } |
@@ -378,9 +376,9 @@ static ur_result_t enqueueCommandBufferFillHelper( |
378 | 376 | (CommandBuffer->ZeCommandList, Ptr, Pattern, PatternSize, Size, |
379 | 377 | LaunchEvent->ZeEvent, ZeEventList.size(), ZeEventList.data())); |
380 | 378 |
|
381 | | - urPrint("calling zeCommandListAppendMemoryFill() with" |
382 | | - " ZeEvent %#lx\n", |
383 | | - ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
| 379 | + logger::debug("calling zeCommandListAppendMemoryFill() with" |
| 380 | + " ZeEvent {}", |
| 381 | + ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
384 | 382 |
|
385 | 383 | return UR_RESULT_SUCCESS; |
386 | 384 | } |
@@ -519,7 +517,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( |
519 | 517 | if (GlobalWorkOffset != NULL) { |
520 | 518 | if (!CommandBuffer->Context->getPlatform() |
521 | 519 | ->ZeDriverGlobalOffsetExtensionFound) { |
522 | | - urPrint("No global offset extension found on this driver\n"); |
| 520 | + logger::debug("No global offset extension found on this driver"); |
523 | 521 | return UR_RESULT_ERROR_INVALID_VALUE; |
524 | 522 | } |
525 | 523 |
|
@@ -606,9 +604,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( |
606 | 604 | &ZeThreadGroupDimensions, LaunchEvent->ZeEvent, |
607 | 605 | ZeEventList.size(), ZeEventList.data())); |
608 | 606 |
|
609 | | - urPrint("calling zeCommandListAppendLaunchKernel() with" |
610 | | - " ZeEvent %#" PRIxPTR "\n", |
611 | | - ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
| 607 | + logger::debug("calling zeCommandListAppendLaunchKernel() with" |
| 608 | + " ZeEvent {}", |
| 609 | + ur_cast<std::uintptr_t>(LaunchEvent->ZeEvent)); |
612 | 610 |
|
613 | 611 | return UR_RESULT_SUCCESS; |
614 | 612 | } |
@@ -1068,7 +1066,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( |
1068 | 1066 | if (NewGlobalWorkOffset && Dim > 0) { |
1069 | 1067 | if (!CommandBuffer->Context->getPlatform() |
1070 | 1068 | ->ZeDriverGlobalOffsetExtensionFound) { |
1071 | | - urPrint("No global offset extension found on this driver\n"); |
| 1069 | + logger::error("No global offset extension found on this driver"); |
1072 | 1070 | return UR_RESULT_ERROR_INVALID_VALUE; |
1073 | 1071 | } |
1074 | 1072 | auto MutableGroupOffestDesc = |
@@ -1277,8 +1275,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( |
1277 | 1275 | // Zero. |
1278 | 1276 | continue; |
1279 | 1277 | } else { |
1280 | | - urPrint("urCommandBufferUpdateKernelLaunchExp: unsupported name of " |
1281 | | - "execution attribute.\n"); |
| 1278 | + logger::error("urCommandBufferUpdateKernelLaunchExp: unsupported name of " |
| 1279 | + "execution attribute."); |
1282 | 1280 | return UR_RESULT_ERROR_INVALID_VALUE; |
1283 | 1281 | } |
1284 | 1282 | } |
|
0 commit comments