-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable tracker in ProxyLib by default #761
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,13 +48,14 @@ static umf_result_t umfMemoryTrackerAdd(umf_memory_tracker_handle_t hTracker, | |
int ret = critnib_insert(hTracker->map, (uintptr_t)ptr, value, 0); | ||
|
||
if (ret == 0) { | ||
LOG_DEBUG("memory region is added, tracker=%p, ptr=%p, size=%zu", | ||
(void *)hTracker, ptr, size); | ||
LOG_DEBUG( | ||
"memory region is added, tracker=%p, ptr=%p, pool=%p, size=%zu", | ||
(void *)hTracker, ptr, (void *)pool, size); | ||
return UMF_RESULT_SUCCESS; | ||
} | ||
|
||
LOG_ERR("failed to insert tracker value, ret=%d, ptr=%p, size=%zu", ret, | ||
ptr, size); | ||
LOG_ERR("failed to insert tracker value, ret=%d, ptr=%p, pool=%p, size=%zu", | ||
ret, ptr, (void *)pool, size); | ||
|
||
umf_ba_free(hTracker->tracker_allocator, value); | ||
|
||
|
@@ -161,11 +162,35 @@ static umf_result_t trackingAlloc(void *hProvider, size_t size, | |
return ret; | ||
} | ||
|
||
umf_result_t ret2 = umfMemoryTrackerAdd(p->hTracker, p->pool, *ptr, size); | ||
if (ret2 != UMF_RESULT_SUCCESS) { | ||
LOG_ERR("failed to add allocated region to the tracker, ptr = %p, size " | ||
// check if the allocation was already added to the tracker | ||
// (in case of using ProxyLib) | ||
tracker_value_t *value = | ||
(tracker_value_t *)critnib_get(p->hTracker->map, *(uintptr_t *)ptr); | ||
if (value) { | ||
assert(value->pool != p->pool); | ||
|
||
LOG_DEBUG("ptr already exists in the tracker (added by Proxy Lib) - " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please describe the case when memory already present in the tracker? |
||
"updating value, ptr=%p, size=%zu, old pool: %p, new pool %p", | ||
*ptr, size, (void *)value->pool, (void *)p->pool); | ||
|
||
// the allocation was made by the ProxyLib so we only update the tracker | ||
value->pool = p->pool; | ||
Comment on lines
+176
to
+177
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we assume that ProxyLib will not look for this pointer any more? Is it based on the fact that ProxyLib does not call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Also the proxy lib would not free this allocation - this would be done by the user created Pool |
||
int crit_ret = critnib_insert(p->hTracker->map, *(uintptr_t *)ptr, | ||
value, 1 /* update */); | ||
|
||
// this cannot fail since we know the element exists and there is | ||
// nothing to allocate | ||
assert(crit_ret == 0); | ||
(void)crit_ret; | ||
} else { | ||
umf_result_t ret2 = | ||
umfMemoryTrackerAdd(p->hTracker, p->pool, *ptr, size); | ||
if (ret2 != UMF_RESULT_SUCCESS) { | ||
LOG_ERR( | ||
"failed to add allocated region to the tracker, ptr = %p, size " | ||
"= %zu, ret = %d", | ||
*ptr, size, ret2); | ||
} | ||
} | ||
|
||
return ret; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,10 +334,7 @@ add_umf_test( | |
LIBS ${UMF_UTILS_FOR_TEST}) | ||
|
||
# tests for the proxy library | ||
if(UMF_PROXY_LIB_ENABLED | ||
AND UMF_BUILD_SHARED_LIBRARY | ||
AND NOT UMF_DISABLE_HWLOC | ||
AND NOT UMF_LINK_HWLOC_STATICALLY) | ||
if(UMF_PROXY_LIB_ENABLED AND UMF_BUILD_SHARED_LIBRARY) | ||
add_umf_test( | ||
NAME proxy_lib_basic | ||
SRCS ${BA_SOURCES_FOR_TEST} test_proxy_lib.cpp | ||
|
@@ -382,13 +379,14 @@ function(add_umf_ipc_test) | |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | ||
|
||
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "umf") | ||
set_tests_properties(${TEST_NAME} PROPERTIES TIMEOUT 60) | ||
if(NOT UMF_TESTS_FAIL_ON_SKIP) | ||
set_tests_properties(${TEST_NAME} PROPERTIES SKIP_RETURN_CODE 125) | ||
endif() | ||
endfunction() | ||
|
||
if(LINUX) | ||
if(NOT UMF_DISABLE_HWLOC) | ||
if(NOT UMF_DISABLE_HWLOC AND UMF_POOL_SCALABLE_ENABLED) | ||
build_umf_test( | ||
NAME | ||
ipc_os_prov_consumer | ||
|
@@ -406,6 +404,18 @@ if(LINUX) | |
add_umf_ipc_test(TEST ipc_os_prov_anon_fd) | ||
add_umf_ipc_test(TEST ipc_os_prov_shm) | ||
|
||
if(UMF_PROXY_LIB_ENABLED AND UMF_BUILD_SHARED_LIBRARY) | ||
build_umf_test( | ||
NAME | ||
ipc_os_prov_proxy | ||
SRCS | ||
ipc_os_prov_proxy.c | ||
common/ipc_common.c | ||
LIBS | ||
${UMF_UTILS_FOR_TEST}) | ||
add_umf_ipc_test(TEST ipc_os_prov_proxy) | ||
endif() | ||
|
||
build_umf_test( | ||
NAME | ||
ipc_devdax_prov_consumer | ||
|
@@ -436,13 +446,17 @@ if(LINUX) | |
ipc_file_prov_producer.c | ||
common/ipc_common.c | ||
common/ipc_os_prov_common.c) | ||
add_umf_ipc_test(TEST ipc_file_prov) | ||
add_umf_ipc_test(TEST ipc_file_prov_fsdax) | ||
|
||
# TODO - fix ipc_file_prov and ipc_file_prov_fsdax tests | ||
# add_umf_ipc_test(TEST ipc_file_prov) add_umf_ipc_test(TEST | ||
# ipc_file_prov_fsdax) | ||
Comment on lines
+450
to
+452
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An issue should be added for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
endif() | ||
|
||
# TODO add IPC tests for CUDA | ||
|
||
if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_LEVEL_ZERO_PROVIDER) | ||
if(UMF_BUILD_GPU_TESTS | ||
AND UMF_BUILD_LEVEL_ZERO_PROVIDER | ||
AND UMF_BUILD_LIBUMF_POOL_DISJOINT) | ||
Comment on lines
-445
to
+459
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does it belong to this PR? What does it have in common? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to use Disjoint Pool in GPU tests |
||
build_umf_test( | ||
NAME | ||
ipc_level_zero_prov_consumer | ||
|
@@ -453,6 +467,7 @@ if(LINUX) | |
providers/level_zero_helpers.cpp | ||
LIBS | ||
ze_loader | ||
disjoint_pool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does it belong to this PR? What does it have in common? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to use Disjoint Pool in GPU tests |
||
${UMF_UTILS_FOR_TEST}) | ||
build_umf_test( | ||
NAME | ||
|
@@ -464,6 +479,7 @@ if(LINUX) | |
providers/level_zero_helpers.cpp | ||
LIBS | ||
ze_loader | ||
disjoint_pool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does it belong to this PR? What does it have in common? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to use Disjoint Pool in GPU tests |
||
${UMF_UTILS_FOR_TEST}) | ||
target_include_directories(umf_test-ipc_level_zero_prov_producer | ||
PRIVATE ${LEVEL_ZERO_INCLUDE_DIRS}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does proxy lib require HWLOC to be linked dynamically?