Skip to content

Commit 937bc22

Browse files
committed
apply comments
1 parent daaba27 commit 937bc22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1059
-1046
lines changed

unified-runtime/scripts/templates/trcddi.cpp.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace ur_tracing_layer
4848
uint64_t instance = getContext()->notify_begin(${th.make_func_etor(n, tags, obj)}, "${th.make_func_name(n, tags, obj)}", &params);
4949

5050
auto &logger = getContext()->logger;
51-
UR_LOG_L(logger, Info, " ---> ${th.make_func_name(n, tags, obj)}\n");
51+
UR_LOG_L(logger, INFO, " ---> ${th.make_func_name(n, tags, obj)}\n");
5252

5353
${x}_result_t result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} );
5454

@@ -57,7 +57,7 @@ namespace ur_tracing_layer
5757
if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) {
5858
std::ostringstream args_str;
5959
ur::extras::printFunctionParams(args_str, ${th.make_func_etor(n, tags, obj)}, &params);
60-
UR_LOG_L(logger, Info, " <--- ${th.make_func_name(n, tags, obj)}({}) -> {};\n", args_str.str(), result);
60+
UR_LOG_L(logger, INFO, " <--- ${th.make_func_name(n, tags, obj)}({}) -> {};\n", args_str.str(), result);
6161
}
6262

6363
return result;

unified-runtime/source/adapters/cuda/common.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void checkErrorUR(CUresult Result, const char *Function, int Line,
7171
<< "\n\tDescription: " << ErrorString
7272
<< "\n\tFunction: " << Function << "\n\tSource Location: " << File
7373
<< ":" << Line << "\n";
74-
UR_LOG(Error, "{}", SS.str());
74+
UR_LOG(ERROR, "{}", SS.str());
7575

7676
if (std::getenv("PI_CUDA_ABORT") != nullptr ||
7777
std::getenv("UR_CUDA_ABORT") != nullptr) {
@@ -95,7 +95,7 @@ void checkErrorUR(nvmlReturn_t Result, const char *Function, int Line,
9595
<< "\n\tDescription: " << ErrorString
9696
<< "\n\tFunction: " << Function << "\n\tSource Location: " << File
9797
<< ":" << Line << "\n";
98-
UR_LOG(Error, "{}", SS.str());
98+
UR_LOG(ERROR, "{}", SS.str());
9999

100100
if (std::getenv("PI_CUDA_ABORT") != nullptr ||
101101
std::getenv("UR_CUDA_ABORT") != nullptr) {
@@ -115,7 +115,7 @@ void checkErrorUR(ur_result_t Result, const char *Function, int Line,
115115
SS << "\nUR ERROR:"
116116
<< "\n\tValue: " << Result << "\n\tFunction: " << Function
117117
<< "\n\tSource Location: " << File << ":" << Line << "\n";
118-
UR_LOG(Error, "{}", SS.str());
118+
UR_LOG(ERROR, "{}", SS.str());
119119

120120
if (std::getenv("PI_CUDA_ABORT") != nullptr) {
121121
std::abort();

unified-runtime/source/adapters/cuda/enqueue.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ ur_result_t setCuMemAdvise(CUdeviceptr DevPtr, size_t Size,
9797

9898
for (auto &UnmappedFlag : UnmappedMemAdviceFlags) {
9999
if (URAdviceFlags & UnmappedFlag) {
100-
UR_LOG(Warning, "Memory advice ignored because the CUDA backend does not "
101-
"support some of the specified flags.");
100+
UR_LOG(WARN, "Memory advice ignored because the CUDA backend does not "
101+
"support some of the specified flags.");
102102
return UR_RESULT_SUCCESS;
103103
}
104104
}
@@ -1606,16 +1606,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
16061606
// for managed memory. Therefore, ignore prefetch hint if concurrent managed
16071607
// memory access is not available.
16081608
if (!getAttribute(Device, CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) {
1609-
UR_LOG(Warning, "Prefetch hint ignored as device does not support "
1610-
"concurrent managed access.");
1609+
UR_LOG(WARN, "Prefetch hint ignored as device does not support "
1610+
"concurrent managed access.");
16111611
return UR_RESULT_SUCCESS;
16121612
}
16131613

16141614
unsigned int IsManaged;
16151615
UR_CHECK_ERROR(cuPointerGetAttribute(
16161616
&IsManaged, CU_POINTER_ATTRIBUTE_IS_MANAGED, (CUdeviceptr)pMem));
16171617
if (!IsManaged) {
1618-
UR_LOG(Warning, "Prefetch hint ignored as prefetch only works with USM.");
1618+
UR_LOG(WARN, "Prefetch hint ignored as prefetch only works with USM.");
16191619
return UR_RESULT_SUCCESS;
16201620
}
16211621

@@ -1666,8 +1666,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size,
16661666
(advice & UR_USM_ADVICE_FLAG_DEFAULT)) {
16671667
ur_device_handle_t Device = hQueue->getDevice();
16681668
if (!getAttribute(Device, CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) {
1669-
UR_LOG(Warning, "Mem advise ignored as device does not support "
1670-
"concurrent managed access.");
1669+
UR_LOG(WARN, "Mem advise ignored as device does not support "
1670+
"concurrent managed access.");
16711671
return UR_RESULT_SUCCESS;
16721672
}
16731673

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
803803

804804
// we don't support copying between different image types.
805805
if (pSrcImageDesc->type != pDstImageDesc->type) {
806-
UR_LOG(Error,
806+
UR_LOG(ERROR,
807807
"Unsupported copy operation between different type of images");
808808
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
809809
}

unified-runtime/source/adapters/cuda/usm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context,
361361
// Otherwise, do nothing.
362362
// Set maximum size is effectively ignored.
363363
if (Limits->maxPoolableSize > 0)
364-
UR_LOG(Warning, "The memory pool maximum size feature requires CUDA "
365-
"12.2 or later.\n");
364+
UR_LOG(WARN, "The memory pool maximum size feature requires CUDA "
365+
"12.2 or later.\n");
366366
#endif
367367
maxSize = Limits->maxPoolableSize;
368368
size_t chunkSize = 33554432; // 32MB

unified-runtime/source/adapters/hip/common.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void checkErrorUR(amd_comgr_status_t Result, const char *Function, int Line,
8686
<< "\n\tDescription: " << ErrorString
8787
<< "\n\tFunction: " << Function << "\n\tSource Location: " << File
8888
<< ":" << Line << "\n";
89-
UR_LOG(Error, "{}", SS.str());
89+
UR_LOG(ERROR, "{}", SS.str());
9090

9191
if (std::getenv("PI_HIP_ABORT") != nullptr ||
9292
std::getenv("UR_HIP_ABORT") != nullptr) {
@@ -113,7 +113,7 @@ void checkErrorUR(hipError_t Result, const char *Function, int Line,
113113
<< "\n\tDescription: " << ErrorString
114114
<< "\n\tFunction: " << Function << "\n\tSource Location: " << File
115115
<< ":" << Line << "\n";
116-
UR_LOG(Error, "{}", SS.str());
116+
UR_LOG(ERROR, "{}", SS.str());
117117

118118
if (std::getenv("PI_HIP_ABORT") != nullptr ||
119119
std::getenv("UR_HIP_ABORT") != nullptr) {
@@ -133,7 +133,7 @@ void checkErrorUR(ur_result_t Result, const char *Function, int Line,
133133
SS << "\nUR HIP ERROR:"
134134
<< "\n\tValue: " << Result << "\n\tFunction: " << Function
135135
<< "\n\tSource Location: " << File << ":" << Line << "\n";
136-
UR_LOG(Error, "{}", SS.str());
136+
UR_LOG(ERROR, "{}", SS.str());
137137

138138
if (std::getenv("PI_HIP_ABORT") != nullptr ||
139139
std::getenv("UR_HIP_ABORT") != nullptr) {

unified-runtime/source/adapters/hip/enqueue.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,8 +1374,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
13741374
// mem_advise.
13751375
if (!Device->getManagedMemSupport()) {
13761376
releaseEvent();
1377-
UR_LOG(Warning, "mem_advise ignored as device does not support "
1378-
"managed memory access.");
1377+
UR_LOG(WARN, "mem_advise ignored as device does not support "
1378+
"managed memory access.");
13791379
return UR_RESULT_SUCCESS;
13801380
}
13811381

@@ -1389,7 +1389,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
13891389
// async prefetch requires USM pointer (or hip SVM) to work.
13901390
if (!attribs.isManaged) {
13911391
releaseEvent();
1392-
UR_LOG(Warning, "Prefetch hint ignored as prefetch only works with USM.");
1392+
UR_LOG(WARN, "Prefetch hint ignored as prefetch only works with USM.");
13931393
return UR_RESULT_SUCCESS;
13941394
}
13951395

@@ -1444,8 +1444,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size,
14441444
// mem_advise.
14451445
if (!Device->getManagedMemSupport()) {
14461446
releaseEvent();
1447-
UR_LOG(Warning, "mem_advise ignored as device does not support "
1448-
"managed memory access.");
1447+
UR_LOG(WARN, "mem_advise ignored as device does not support "
1448+
"managed memory access.");
14491449
return UR_RESULT_SUCCESS;
14501450
}
14511451

@@ -1461,8 +1461,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size,
14611461
UR_USM_ADVICE_FLAG_DEFAULT)) {
14621462
if (!Device->getConcurrentManagedAccess()) {
14631463
releaseEvent();
1464-
UR_LOG(Warning, "mem_advise ignored as device does not support "
1465-
"concurrent memory access.");
1464+
UR_LOG(WARN, "mem_advise ignored as device does not support "
1465+
"concurrent memory access.");
14661466
return UR_RESULT_SUCCESS;
14671467
}
14681468

@@ -1481,8 +1481,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size,
14811481
if (auto ptrAttribs = getPointerAttributes(pMem);
14821482
!ptrAttribs || !ptrAttribs->isManaged) {
14831483
releaseEvent();
1484-
UR_LOG(Warning, "mem_advise is ignored as the pointer argument is not "
1485-
"a shared USM pointer.");
1484+
UR_LOG(WARN, "mem_advise is ignored as the pointer argument is not "
1485+
"a shared USM pointer.");
14861486
return UR_RESULT_SUCCESS;
14871487
}
14881488

@@ -1510,8 +1510,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size,
15101510
// the runtime.
15111511
if (Result == UR_RESULT_ERROR_INVALID_ENUMERATION) {
15121512
releaseEvent();
1513-
UR_LOG(Warning, "mem_advise is ignored as the advice argument is not "
1514-
"supported by this device.");
1513+
UR_LOG(WARN, "mem_advise is ignored as the advice argument is not "
1514+
"supported by this device.");
15151515
return UR_RESULT_SUCCESS;
15161516
}
15171517
UR_CHECK_ERROR(Result);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
822822

823823
// we don't support copying between different image types.
824824
if (pSrcImageDesc->type != pDstImageDesc->type) {
825-
UR_LOG(Error,
825+
UR_LOG(ERROR,
826826
"Unsupported copy operation between different type of images");
827827
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
828828
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ ur_result_t initPlatforms(PlatformVec &platforms,
163163
ZE2UR_CALL(zeDriverGet, (&ZeDriverGetCount, ZeDriverGetHandles.data()));
164164
}
165165
if (ZeDriverGetCount == 0 && GlobalAdapter->ZeInitDriversCount == 0) {
166-
UR_LOG(Error, "\nNo Valid L0 Drivers found.\n");
166+
UR_LOG(ERROR, "\nNo Valid L0 Drivers found.\n");
167167
return UR_RESULT_SUCCESS;
168168
}
169169

@@ -188,7 +188,7 @@ ur_result_t initPlatforms(PlatformVec &platforms,
188188
// newer drivers.
189189
if (ZeDriverGetProperties.driverVersion !=
190190
ZeInitDriverProperties.driverVersion) {
191-
UR_LOG(Debug,
191+
UR_LOG(DEBUG,
192192
"\nzeDriverHandle {} added to the zeInitDrivers list "
193193
"of possible handles.\n",
194194
ZeDriverGetHandles[Y]);
@@ -202,7 +202,7 @@ ur_result_t initPlatforms(PlatformVec &platforms,
202202
ZeDrivers.assign(ZeDriverGetHandles.begin(), ZeDriverGetHandles.end());
203203
}
204204
ZeDriverCount = ZeDrivers.size();
205-
UR_LOG(Debug, "\n{} L0 Drivers found.\n", ZeDriverCount);
205+
UR_LOG(DEBUG, "\n{} L0 Drivers found.\n", ZeDriverCount);
206206
for (uint32_t I = 0; I < ZeDriverCount; ++I) {
207207
// Keep track of the first platform init for this Driver
208208
bool DriverPlatformInit = false;
@@ -361,7 +361,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
361361

362362
if (getenv("SYCL_ENABLE_PCI") != nullptr) {
363363
UR_LOG(
364-
Warning,
364+
WARN,
365365
"WARNING: SYCL_ENABLE_PCI is deprecated and no longer needed.\n");
366366
}
367367

@@ -383,13 +383,13 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
383383
if (UrL0InitAllDrivers) {
384384
L0InitFlags |= ZE_INIT_FLAG_VPU_ONLY;
385385
}
386-
UR_LOG(Debug, "\nzeInit with flags value of {}\n",
386+
UR_LOG(DEBUG, "\nzeInit with flags value of {}\n",
387387
static_cast<int>(L0InitFlags));
388388
GlobalAdapter->ZeInitResult = ZE_CALL_NOCHECK(zeInit, (L0InitFlags));
389389
if (GlobalAdapter->ZeInitResult != ZE_RESULT_SUCCESS) {
390390
const char *ErrorString = "Unknown";
391391
zeParseError(GlobalAdapter->ZeInitResult, ErrorString);
392-
UR_LOG(Error, "\nzeInit failed with {}\n", ErrorString);
392+
UR_LOG(ERROR, "\nzeInit failed with {}\n", ErrorString);
393393
}
394394

395395
bool useInitDrivers = false;
@@ -405,7 +405,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
405405
if (strncmp(versions[i].component_name, "loader",
406406
strlen("loader")) == 0) {
407407
loader_version = versions[i].component_lib_version;
408-
UR_LOG(Debug, "\nLevel Zero Loader Version: {}.{}.{}\n",
408+
UR_LOG(DEBUG, "\nLevel Zero Loader Version: {}.{}.{}\n",
409409
loader_version.major, loader_version.minor,
410410
loader_version.patch);
411411
break;
@@ -430,7 +430,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
430430
GlobalAdapter->processHandle, "zeInitDrivers");
431431
#endif
432432
if (GlobalAdapter->initDriversFunctionPtr) {
433-
UR_LOG(Debug, "\nzeInitDrivers with flags value of {}\n",
433+
UR_LOG(DEBUG, "\nzeInitDrivers with flags value of {}\n",
434434
static_cast<int>(GlobalAdapter->InitDriversDesc.flags));
435435
GlobalAdapter->ZeInitDriversResult =
436436
ZE_CALL_NOCHECK(GlobalAdapter->initDriversFunctionPtr,
@@ -441,7 +441,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
441441
} else {
442442
const char *ErrorString = "Unknown";
443443
zeParseError(GlobalAdapter->ZeInitDriversResult, ErrorString);
444-
UR_LOG(Error, "\nzeInitDrivers failed with {}\n", ErrorString);
444+
UR_LOG(ERROR, "\nzeInitDrivers failed with {}\n", ErrorString);
445445
}
446446
}
447447
}
@@ -459,12 +459,12 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
459459

460460
// Absorb the ZE_RESULT_ERROR_UNINITIALIZED and just return 0 Platforms.
461461
if (*GlobalAdapter->ZeResult == ZE_RESULT_ERROR_UNINITIALIZED) {
462-
UR_LOG(Error, "Level Zero Uninitialized\n");
462+
UR_LOG(ERROR, "Level Zero Uninitialized\n");
463463
result = std::move(platforms);
464464
return;
465465
}
466466
if (*GlobalAdapter->ZeResult != ZE_RESULT_SUCCESS) {
467-
UR_LOG(Error, "Level Zero initialization failure\n");
467+
UR_LOG(ERROR, "Level Zero initialization failure\n");
468468
result = ze2urResult(*GlobalAdapter->ZeResult);
469469

470470
return;
@@ -511,7 +511,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
511511
GlobalAdapter->getSysManDriversFunctionPtr &&
512512
GlobalAdapter->sysManInitFunctionPtr) {
513513
ze_init_flags_t L0ZesInitFlags = 0;
514-
UR_LOG(Debug, "\nzesInit with flags value of {}\n",
514+
UR_LOG(DEBUG, "\nzesInit with flags value of {}\n",
515515
static_cast<int>(L0ZesInitFlags));
516516
GlobalAdapter->ZesResult = ZE_CALL_NOCHECK(
517517
GlobalAdapter->sysManInitFunctionPtr, (L0ZesInitFlags));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static ur_result_t enqueueUSMAllocHelper(
9292
CommandType = UR_COMMAND_ENQUEUE_USM_SHARED_ALLOC_EXP;
9393
break;
9494
default:
95-
UR_LOG(Error, "enqueueUSMAllocHelper: unsupported USM type");
95+
UR_LOG(ERROR, "enqueueUSMAllocHelper: unsupported USM type");
9696
throw UR_RESULT_ERROR_UNKNOWN;
9797
}
9898
UR_CALL(createEventAndAssociateQueue(Queue, Event, CommandType, CommandList,

0 commit comments

Comments
 (0)