Skip to content

Commit 838451c

Browse files
committed
applied Łukasz S. comments
1 parent 56c9e9a commit 838451c

File tree

5 files changed

+29
-27
lines changed

5 files changed

+29
-27
lines changed

src/libumf.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ EXPORTS
4242
umfLevelZeroMemoryProviderParamsSetDevice
4343
umfLevelZeroMemoryProviderParamsSetMemoryType
4444
umfLevelZeroMemoryProviderParamsSetResidentDevices
45-
umfLevelZeroMemoryProviderResidentDeviceChange
4645
umfMemoryProviderAlloc
4746
umfMemoryProviderAllocationMerge
4847
umfMemoryProviderAllocationSplit
@@ -155,6 +154,7 @@ EXPORTS
155154
umfGetMemoryPropertySize
156155
umfJemallocPoolParamsSetName
157156
umfLevelZeroMemoryProviderParamsSetName
157+
umfLevelZeroMemoryProviderResidentDeviceChange
158158
umfOsMemoryProviderParamsSetName
159159
umfPoolTrimMemory
160160
umfScalablePoolParamsSetName

src/provider/provider_level_zero.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetResidentDevices(
368368
for (uint32_t first_idx = 0; first_idx < deviceCount; first_idx++) {
369369
for (uint32_t second_idx = 0; second_idx < first_idx; second_idx++) {
370370
if (hDevices[first_idx] == hDevices[second_idx]) {
371-
LOG_ERR("resident devices are not unique, idx:%u and "
372-
"idx:%u both point to device:%p",
371+
LOG_ERR("resident devices are not unique, idx: %u and "
372+
"idx: %u both point to device: %p",
373373
first_idx, second_idx, (void *)hDevices[first_idx]);
374374
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
375375
}
@@ -513,9 +513,10 @@ static umf_result_t ze_memory_provider_alloc_helper(void *provider, size_t size,
513513
}
514514

515515
if (ze_result != ZE_RESULT_SUCCESS) {
516-
LOG_ERR("failed to allocate memory, type:%d, size:%lu, alignment:%lu, "
517-
"result:%d",
518-
ze_provider->memory_type, size, alignment, ze_result);
516+
LOG_ERR(
517+
"failed to allocate memory, type: %d, size: %lu, alignment: %lu, "
518+
"result: %d",
519+
ze_provider->memory_type, size, alignment, ze_result);
519520
return ze2umf_result(ze_result);
520521
}
521522

@@ -526,7 +527,7 @@ static umf_result_t ze_memory_provider_alloc_helper(void *provider, size_t size,
526527
*resultPtr, size);
527528
if (ze_result != ZE_RESULT_SUCCESS) {
528529
utils_read_unlock(&ze_provider->resident_device_rwlock);
529-
LOG_ERR("making resident allocation %p of size:%lu on device %p "
530+
LOG_ERR("making resident allocation %p of size: %lu on device %p "
530531
"failed with 0x%x",
531532
*resultPtr, size,
532533
(void *)ze_provider->resident_device_handles[i], ze_result);
@@ -539,7 +540,7 @@ static umf_result_t ze_memory_provider_alloc_helper(void *provider, size_t size,
539540
}
540541
return ze2umf_result(ze_result);
541542
}
542-
LOG_DEBUG("allocation %p of size:%lu made resident on device %p",
543+
LOG_DEBUG("allocation %p of size: %lu made resident on device %p",
543544
*resultPtr, size,
544545
(void *)ze_provider->resident_device_handles[i]);
545546
}
@@ -575,7 +576,7 @@ static umf_result_t query_min_page_size(ze_memory_provider_t *ze_provider,
575576
ze_provider->context, ptr, &properties, NULL);
576577

577578
*min_page_size = properties.pageSize;
578-
LOG_DEBUG("Querying minimum page size, got:%lu", properties.pageSize);
579+
LOG_DEBUG("Querying minimum page size, got: %lu", properties.pageSize);
579580

580581
ze_memory_provider_free_helper(ze_provider, ptr, 1, 0);
581582

@@ -614,7 +615,7 @@ static umf_result_t ze_memory_provider_initialize(const void *params,
614615

615616
if (ze_params->resident_device_count > 0 &&
616617
ze_params->resident_device_handles == NULL) {
617-
LOG_ERR("Device handler should be non-NULL if device_count:%d is "
618+
LOG_ERR("Device handler should be non-NULL if device_count: %d is "
618619
"greater than 0",
619620
ze_params->resident_device_count);
620621
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
@@ -682,7 +683,7 @@ static umf_result_t ze_memory_provider_initialize(const void *params,
682683
ze_params->resident_device_handles,
683684
sizeof(ze_device_handle_t) * ze_params->resident_device_count);
684685

685-
LOG_INFO("L0 memory provider:%p have %d resident device(s)",
686+
LOG_INFO("L0 memory provider: %p have %d resident device(s)",
686687
(void *)ze_provider, ze_params->resident_device_count);
687688
} else {
688689
LOG_INFO("L0 memory provider has no resident devices");
@@ -1016,15 +1017,16 @@ static int ze_memory_provider_resident_device_change_helper(uintptr_t key,
10161017
}
10171018

10181019
if (result != ZE_RESULT_SUCCESS) {
1019-
LOG_ERR("ze_memory_provider_resident_device_change found our pointer "
1020-
"%p but failed to make it resident on device:%p due to err:%d",
1021-
(void *)key, (void *)change_data->peer_device, result);
1020+
LOG_ERR(
1021+
"ze_memory_provider_resident_device_change found our pointer "
1022+
"%p but failed to make it resident on device: %p due to err: %d",
1023+
(void *)key, (void *)change_data->peer_device, result);
10221024
++change_data->failed_changes;
10231025
return 1;
10241026
}
10251027

10261028
LOG_DEBUG("ze_memory_provider_resident_device_change found our pointer %p "
1027-
"and made it resident on device:%p",
1029+
"and made it resident on device: %p",
10281030
(void *)key, (void *)change_data->peer_device);
10291031
++change_data->success_changes;
10301032
return 0;
@@ -1035,8 +1037,8 @@ umf_result_t umfLevelZeroMemoryProviderResidentDeviceChange(
10351037
bool is_adding) {
10361038
ze_memory_provider_t *ze_provider = umfMemoryProviderGetPriv(provider);
10371039

1038-
LOG_INFO("%s resident device %p, src_provider:%p, existing peers "
1039-
"count:%d",
1040+
LOG_INFO("%s resident device %p, src_provider: %p, existing peers "
1041+
"count: %d",
10401042
(is_adding ? "adding" : "removing"), (void *)device,
10411043
(void *)provider, ze_provider->resident_device_count);
10421044

@@ -1054,7 +1056,7 @@ umf_result_t umfLevelZeroMemoryProviderResidentDeviceChange(
10541056
if (!is_adding) {
10551057
utils_write_unlock(&ze_provider->resident_device_rwlock);
10561058
LOG_ERR("trying to remove resident device %p but the device "
1057-
"is not a peer of provider:%p currently",
1059+
"is currently not a peer of provider: %p",
10581060
(void *)device, (void *)provider);
10591061
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
10601062
}
@@ -1091,8 +1093,8 @@ umf_result_t umfLevelZeroMemoryProviderResidentDeviceChange(
10911093
// found
10921094
if (is_adding) {
10931095
utils_write_unlock(&ze_provider->resident_device_rwlock);
1094-
LOG_ERR("trying to add resident device:%p but the device is "
1095-
"already a peer of provider:%p",
1096+
LOG_ERR("trying to add resident device: %p but the device is "
1097+
"already a peer of provider: %p",
10961098
(void *)device, (void *)provider);
10971099
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
10981100
}
@@ -1119,19 +1121,19 @@ umf_result_t umfLevelZeroMemoryProviderResidentDeviceChange(
11191121
&ze_memory_provider_resident_device_change_helper, &privData);
11201122
if (result != UMF_RESULT_SUCCESS) {
11211123
LOG_ERR("umfMemoryTrackerIterateAll failed during resident device "
1122-
"change with result:%d numFailed:%d, numSuccess:%d",
1124+
"change with result: %d numFailed: %d, numSuccess: %d",
11231125
result, privData.success_changes, privData.failed_changes);
11241126
return result;
11251127
}
11261128

11271129
if (privData.failed_changes > 0) {
11281130
LOG_ERR("umfMemoryTrackerIterateAll did not manage to do some change "
1129-
"numFailed:%d, numSuccess:%d",
1131+
"numFailed: %d, numSuccess: %d",
11301132
privData.success_changes, privData.failed_changes);
11311133
return UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC;
11321134
}
11331135

1134-
LOG_INFO("ze_memory_provider_resident_device_change done, numSuccess:%d",
1136+
LOG_INFO("ze_memory_provider_resident_device_change done, numSuccess: %d",
11351137
privData.success_changes);
11361138
return UMF_RESULT_SUCCESS;
11371139
}

src/provider/provider_tracking.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ umf_result_t umfMemoryTrackerIterateAll(int (*func)(uintptr_t key, void *value,
15431543

15441544
for (int level = 0; level < MAX_LEVELS_OF_ALLOC_SEGMENT_MAP; level++) {
15451545
critnib *alloc_segment = TRACKER->alloc_segments_map[level];
1546-
LOG_DEBUG("iterating tracker's %d segment:%p", level,
1546+
LOG_DEBUG("iterating tracker's %d segment: %p", level,
15471547
(void *)alloc_segment);
15481548
critnib_iter_all(alloc_segment, func, privdata);
15491549
}

test/common/level_zero_mocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ void MockedLevelZeroTestEnvironment::TearDown() {
117117
utils_close_library(lib_handle);
118118
}
119119

120-
LevelZero **MockedLevelZeroTestEnvironment::l0interface;
120+
LevelZero **MockedLevelZeroTestEnvironment::l0interface;

test/common/level_zero_mocks.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class LevelZeroMock : public LevelZero {
6666
MOCK_METHOD2(zeMemFree,
6767
ze_result_t(ze_context_handle_t hContext, void *ptr));
6868

69-
// helper setting all expects related to successful l0 provider creation
70-
// and initialization and calling its creation and initialization
69+
// A helper function that (1) sets all EXPECT_CALLs related to successful l0 provider creation
70+
// and initialization (2) calls l0 provider creation and initialization
7171
umf_memory_provider_handle_t initializeMemoryProviderWithResidentDevices(
7272
ze_device_handle_t device,
7373
std::vector<ze_device_handle_t> residentDevices,

0 commit comments

Comments
 (0)