Skip to content

Commit aec3fd5

Browse files
committed
Fixed formatting
Signed-off-by: Neil R. Spruit <[email protected]>
1 parent cad11ab commit aec3fd5

File tree

10 files changed

+52
-37
lines changed

10 files changed

+52
-37
lines changed

unified-runtime/source/adapters/level_zero/common.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
#include <unistd.h>
2626
#endif
2727

28+
#include <loader/ze_loader.h>
2829
#include <ur/ur.hpp>
2930
#include <ur_ddi.h>
30-
#include <loader/ze_loader.h>
3131
#include <ze_api.h>
3232
#include <zes_api.h>
3333

@@ -46,7 +46,8 @@ struct _ur_platform_handle_t;
4646
}
4747
} catch (...) {
4848
}
49-
logger::debug("ZE ---> checkL0LoaderTeardown: Loader is in teardown or is unstable");
49+
logger::debug(
50+
"ZE ---> checkL0LoaderTeardown: Loader is in teardown or is unstable");
5051
return false;
5152
}
5253

unified-runtime/source/adapters/level_zero/context.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,8 @@ ur_result_t ContextReleaseHelper(ur_context_handle_t Context) {
264264
Contexts.erase(It);
265265
}
266266
ze_context_handle_t DestroyZeContext =
267-
(Context->OwnNativeHandle && checkL0LoaderTeardown())
268-
? Context->ZeContext
269-
: nullptr;
267+
(Context->OwnNativeHandle && checkL0LoaderTeardown()) ? Context->ZeContext
268+
: nullptr;
270269

271270
// Clean up any live memory associated with Context
272271
ur_result_t Result = Context->finalize();
@@ -283,9 +282,10 @@ ur_result_t ContextReleaseHelper(ur_context_handle_t Context) {
283282
if (DestroyZeContext) {
284283
auto ZeResult = ZE_CALL_NOCHECK(zeContextDestroy, (DestroyZeContext));
285284
// Gracefully handle the case that L0 was already unloaded.
286-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
285+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
286+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
287287
return ze2urResult(ZeResult);
288-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
288+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
289289
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
290290
}
291291
}
@@ -311,9 +311,10 @@ ur_result_t ur_context_handle_t_::finalize() {
311311
if (checkL0LoaderTeardown()) {
312312
auto ZeResult = ZE_CALL_NOCHECK(zeEventDestroy, (Event->ZeEvent));
313313
// Gracefully handle the case that L0 was already unloaded.
314-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
314+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
315+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
315316
return ze2urResult(ZeResult);
316-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
317+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
317318
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
318319
}
319320
}
@@ -330,9 +331,10 @@ ur_result_t ur_context_handle_t_::finalize() {
330331
if (checkL0LoaderTeardown()) {
331332
auto ZeResult = ZE_CALL_NOCHECK(zeEventPoolDestroy, (ZePool));
332333
// Gracefully handle the case that L0 was already unloaded.
333-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
334+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
335+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
334336
return ze2urResult(ZeResult);
335-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
337+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
336338
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
337339
}
338340
}
@@ -345,9 +347,10 @@ ur_result_t ur_context_handle_t_::finalize() {
345347
// Destroy the command list used for initializations
346348
auto ZeResult = ZE_CALL_NOCHECK(zeCommandListDestroy, (ZeCommandListInit));
347349
// Gracefully handle the case that L0 was already unloaded.
348-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
350+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
351+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
349352
return ze2urResult(ZeResult);
350-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
353+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
351354
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
352355
}
353356
}
@@ -359,9 +362,10 @@ ur_result_t ur_context_handle_t_::finalize() {
359362
if (ZeCommandList && checkL0LoaderTeardown()) {
360363
auto ZeResult = ZE_CALL_NOCHECK(zeCommandListDestroy, (ZeCommandList));
361364
// Gracefully handle the case that L0 was already unloaded.
362-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
365+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
366+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
363367
return ze2urResult(ZeResult);
364-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
368+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
365369
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
366370
}
367371
}
@@ -373,9 +377,10 @@ ur_result_t ur_context_handle_t_::finalize() {
373377
if (ZeCommandList && checkL0LoaderTeardown()) {
374378
auto ZeResult = ZE_CALL_NOCHECK(zeCommandListDestroy, (ZeCommandList));
375379
// Gracefully handle the case that L0 was already unloaded.
376-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
380+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
381+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
377382
return ze2urResult(ZeResult);
378-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
383+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
379384
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
380385
}
381386
}

unified-runtime/source/adapters/level_zero/event.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,9 +1124,10 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
11241124
if (checkL0LoaderTeardown()) {
11251125
auto ZeResult = ZE_CALL_NOCHECK(zeEventDestroy, (Event->ZeEvent));
11261126
// Gracefully handle the case that L0 was already unloaded.
1127-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
1127+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
1128+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
11281129
return ze2urResult(ZeResult);
1129-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
1130+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
11301131
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
11311132
}
11321133
}

unified-runtime/source/adapters/level_zero/image.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ ur_result_t urBindlessImagesUnsampledImageHandleDestroyExp(
312312

313313
auto item = hDevice->ZeOffsetToImageHandleMap.find(hImage);
314314

315-
if (item != hDevice->ZeOffsetToImageHandleMap.end() && checkL0LoaderTeardown()) {
315+
if (item != hDevice->ZeOffsetToImageHandleMap.end() &&
316+
checkL0LoaderTeardown()) {
316317
ZE2UR_CALL(zeImageDestroy, (item->second));
317318
hDevice->ZeOffsetToImageHandleMap.erase(item);
318319
} else {

unified-runtime/source/adapters/level_zero/kernel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,9 +943,10 @@ ur_result_t urKernelRelease(
943943
if (checkL0LoaderTeardown()) {
944944
auto ZeResult = ZE_CALL_NOCHECK(zeKernelDestroy, (ZeKernel));
945945
// Gracefully handle the case that L0 was already unloaded.
946-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
946+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
947+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
947948
return ze2urResult(ZeResult);
948-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
949+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
949950
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
950951
}
951952
}

unified-runtime/source/adapters/level_zero/memory.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,9 +1667,10 @@ ur_result_t urMemRelease(
16671667
auto ZeResult = ZE_CALL_NOCHECK(
16681668
zeImageDestroy, (ur_cast<ze_image_handle_t>(ZeHandleImage)));
16691669
// Gracefully handle the case that L0 was already unloaded.
1670-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
1670+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
1671+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
16711672
return ze2urResult(ZeResult);
1672-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
1673+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
16731674
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
16741675
}
16751676
}

unified-runtime/source/adapters/level_zero/program.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,15 +1037,15 @@ ur_program_handle_t_::ur_program_handle_t_(ur_context_handle_t Context)
10371037
ur_program_handle_t_::ur_program_handle_t_(state, ur_context_handle_t Context,
10381038
ze_module_handle_t InteropZeModule)
10391039
: Context{Context}, NativeProperties{nullptr}, OwnZeModule{true},
1040-
AssociatedDevices({Context->getDevices()[0]}),
1041-
InteropZeModule{InteropZeModule} {}
1040+
AssociatedDevices({Context->getDevices()[0]}), InteropZeModule{
1041+
InteropZeModule} {}
10421042

10431043
ur_program_handle_t_::ur_program_handle_t_(state, ur_context_handle_t Context,
10441044
ze_module_handle_t InteropZeModule,
10451045
bool OwnZeModule)
10461046
: Context{Context}, NativeProperties{nullptr}, OwnZeModule{OwnZeModule},
1047-
AssociatedDevices({Context->getDevices()[0]}),
1048-
InteropZeModule{InteropZeModule} {
1047+
AssociatedDevices({Context->getDevices()[0]}), InteropZeModule{
1048+
InteropZeModule} {
10491049
// TODO: Currently it is not possible to understand the device associated
10501050
// with provided ZeModule. So we can't set the state on that device to Exe.
10511051
}

unified-runtime/source/adapters/level_zero/queue.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,12 +648,14 @@ ur_result_t urQueueRelease(
648648
// runtime. Destroy only if a queue is healthy. Destroying a fence may
649649
// cause a hang otherwise.
650650
// If the fence is a nullptr we are using immediate commandlists.
651-
if (Queue->Healthy && it->second.ZeFence != nullptr && checkL0LoaderTeardown()) {
651+
if (Queue->Healthy && it->second.ZeFence != nullptr &&
652+
checkL0LoaderTeardown()) {
652653
auto ZeResult = ZE_CALL_NOCHECK(zeFenceDestroy, (it->second.ZeFence));
653654
// Gracefully handle the case that L0 was already unloaded.
654-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
655+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
656+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
655657
return ze2urResult(ZeResult);
656-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
658+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
657659
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
658660
}
659661
}
@@ -1611,9 +1613,10 @@ ur_result_t urQueueReleaseInternal(ur_queue_handle_t Queue) {
16111613
if (checkL0LoaderTeardown()) {
16121614
auto ZeResult = ZE_CALL_NOCHECK(zeCommandQueueDestroy, (ZeQueue));
16131615
// Gracefully handle the case that L0 was already unloaded.
1614-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
1616+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
1617+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
16151618
return ze2urResult(ZeResult);
1616-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
1619+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
16171620
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
16181621
}
16191622
}

unified-runtime/source/adapters/level_zero/sampler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ ur_result_t urSamplerRelease(
132132
if (checkL0LoaderTeardown()) {
133133
auto ZeResult = ZE_CALL_NOCHECK(zeSamplerDestroy, (Sampler->ZeSampler));
134134
// Gracefully handle the case that L0 was already unloaded.
135-
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED || ZeResult != ZE_RESULT_ERROR_UNKNOWN))
135+
if (ZeResult && (ZeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
136+
ZeResult != ZE_RESULT_ERROR_UNKNOWN))
136137
return ze2urResult(ZeResult);
137-
if ( ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
138+
if (ZeResult == ZE_RESULT_ERROR_UNKNOWN) {
138139
ZeResult = ZE_RESULT_ERROR_UNINITIALIZED;
139140
}
140141
}

unified-runtime/source/adapters/level_zero/v2/common.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ struct ze_handle_wrapper {
8282
if (ownZeHandle && checkL0LoaderTeardown()) {
8383
auto zeResult = destroy(handle);
8484
// Gracefully handle the case that L0 was already unloaded.
85-
if (zeResult && (zeResult != ZE_RESULT_ERROR_UNINITIALIZED || zeResult != ZE_RESULT_ERROR_UNKNOWN))
85+
if (zeResult && (zeResult != ZE_RESULT_ERROR_UNINITIALIZED ||
86+
zeResult != ZE_RESULT_ERROR_UNKNOWN))
8687
throw ze2urResult(zeResult);
87-
if ( zeResult == ZE_RESULT_ERROR_UNKNOWN) {
88+
if (zeResult == ZE_RESULT_ERROR_UNKNOWN) {
8889
zeResult = ZE_RESULT_ERROR_UNINITIALIZED;
8990
}
9091
}

0 commit comments

Comments
 (0)