Skip to content

Use base allocator in the tracking provider #170

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

Merged

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented Jan 24, 2024

No description provided.

@igchor
Copy link
Member

igchor commented Jan 24, 2024

Just FYI (it doesn't need to be in this PR) we also need to use ba_allocator in critnib to avoid the issues with jemalloc.

@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch 2 times, most recently from 995c6bb to 8c8e024 Compare January 24, 2024 17:21
@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch 7 times, most recently from bcbb979 to 9d7e19d Compare January 25, 2024 22:32
@ldorau ldorau mentioned this pull request Jan 26, 2024
@ldorau
Copy link
Contributor Author

ldorau commented Jan 26, 2024

Just FYI (it doesn't need to be in this PR) we also need to use ba_allocator in critnib to avoid the issues with jemalloc.

Done: #178

@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch 2 times, most recently from 4b0e902 to 7ccda59 Compare January 26, 2024 10:55
@ldorau ldorau marked this pull request as ready for review January 26, 2024 13:28
@ldorau ldorau requested a review from a team as a code owner January 26, 2024 13:28
@ldorau ldorau changed the title [DRAFT] Use base allocator in the tracking provider Use base allocator in the tracking provider Jan 26, 2024
@ldorau ldorau requested review from bratpiorka and igchor January 26, 2024 13:29
@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch 2 times, most recently from fba26dc to 480eaa7 Compare January 29, 2024 12:00
@igchor
Copy link
Member

igchor commented Jan 29, 2024

@ldorau do you think we could create a simple benchmark for memory tracker so that we could see how the performance looks like after applying #170 and #178? Memory tracking is already used in UR so I wouldn't want to introduce a regression.

@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch from 480eaa7 to 226a268 Compare January 29, 2024 17:16
@ldorau
Copy link
Contributor Author

ldorau commented Jan 29, 2024

@ldorau do you think we could create a simple benchmark for memory tracker so that we could see how the performance looks like after applying #170 and #178? Memory tracking is already used in UR so I wouldn't want to introduce a regression.

What API do you want to benchmark ?

@ldorau
Copy link
Contributor Author

ldorau commented Jan 29, 2024

@ldorau do you think we could create a simple benchmark for memory tracker so that we could see how the performance looks like after applying #170 and #178? Memory tracking is already used in UR so I wouldn't want to introduce a regression.

@igchor Benchmark on the main branch (UMF_ENABLE_POOL_TRACKING==ON):

[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 1.021ms, confidence interval +- 1.597071%)

with base allocator (UMF_ENABLE_POOL_TRACKING==ON):

[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 976.713us, confidence interval +- 1.603028%)

Is it enough?

@igchor
Copy link
Member

igchor commented Jan 29, 2024

@ldorau do you think we could create a simple benchmark for memory tracker so that we could see how the performance looks like after applying #170 and #178? Memory tracking is already used in UR so I wouldn't want to introduce a regression.

@igchor Benchmark on the main branch (UMF_ENABLE_POOL_TRACKING==ON):

[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 1.021ms, confidence interval +- 1.597071%)

with base allocator (UMF_ENABLE_POOL_TRACKING==ON):

[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 976.713us, confidence interval +- 1.603028%)

Is it enough?

I don't think the os_memory_provider benchmark does any memory tracking (tracking is only enabled when there is a memory pool). I think what we should implement is a benchmark with a 'proxy pool' - that way we can reuse the existing code and we won't have any impact from an actual pool implementation. Also, UR does use 'proxy pool' for certain scenarios.

@ldorau ldorau dismissed bratpiorka’s stale review February 1, 2024 13:53

All issues fixed

@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch from 226a268 to 9408546 Compare February 1, 2024 14:01
@ldorau
Copy link
Contributor Author

ldorau commented Feb 1, 2024

I don't think the os_memory_provider benchmark does any memory tracking (tracking is only enabled when there is a memory pool). I think what we should implement is a benchmark with a 'proxy pool' - that way we can reuse the existing code and we won't have any impact from an actual pool implementation. Also, UR does use 'proxy pool' for certain scenarios.

@igchor
Results of benchmark of proxy pool WITHOUT the base allocator in the tracking provider:

[==========] Running 3 benchmarks.
[ RUN      ] simple.glibc_malloc
[       OK ] simple.glibc_malloc (mean 1.774ms, confidence interval +- 0.671806%)
[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 992.191us, confidence interval +- 1.602488%)
[ RUN      ] simple.proxy_pool_with_os_memory_provider
[       OK ] simple.proxy_pool_with_os_memory_provider (mean 738.283us, confidence interval +- 0.920939%)
[==========] 3 benchmarks ran.
[  PASSED  ] 3 benchmarks.

Results of benchmark of proxy pool WITH the base allocator in the tracking provider (see https://github.com/ldorau/unified-memory-framework/tree/base_alloc):

[==========] Running 3 benchmarks.
[ RUN      ] simple.glibc_malloc
[       OK ] simple.glibc_malloc (mean 1.808ms, confidence interval +- 0.688160%)
[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 989.281us, confidence interval +- 1.545102%)
[ RUN      ] simple.proxy_pool_with_os_memory_provider
[       OK ] simple.proxy_pool_with_os_memory_provider (mean 728.101us, confidence interval +- 1.210658%)
[==========] 3 benchmarks ran.
[  PASSED  ] 3 benchmarks.

(see #198)

@ldorau ldorau requested a review from igchor February 1, 2024 15:10
if (!handle->map) {
free(handle);
return NULL;
umf_ba_pool_t *pool_tracker = umf_ba_create(sizeof(struct tracker_value_t));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: pool_tracker sounds like it's something that tracks pools ;d Can we rename it to tracker_allocator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@igchor
Copy link
Member

igchor commented Feb 1, 2024

I don't think the os_memory_provider benchmark does any memory tracking (tracking is only enabled when there is a memory pool). I think what we should implement is a benchmark with a 'proxy pool' - that way we can reuse the existing code and we won't have any impact from an actual pool implementation. Also, UR does use 'proxy pool' for certain scenarios.

@igchor Results of benchmark of proxy pool WITHOUT the base allocator in the tracking provider:

[==========] Running 3 benchmarks.
[ RUN      ] simple.glibc_malloc
[       OK ] simple.glibc_malloc (mean 1.774ms, confidence interval +- 0.671806%)
[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 992.191us, confidence interval +- 1.602488%)
[ RUN      ] simple.proxy_pool_with_os_memory_provider
[       OK ] simple.proxy_pool_with_os_memory_provider (mean 738.283us, confidence interval +- 0.920939%)
[==========] 3 benchmarks ran.
[  PASSED  ] 3 benchmarks.

Results of benchmark of proxy pool WITH the base allocator in the tracking provider (see https://github.com/ldorau/unified-memory-framework/tree/base_alloc):

[==========] Running 3 benchmarks.
[ RUN      ] simple.glibc_malloc
[       OK ] simple.glibc_malloc (mean 1.808ms, confidence interval +- 0.688160%)
[ RUN      ] simple.os_memory_provider
[       OK ] simple.os_memory_provider (mean 989.281us, confidence interval +- 1.545102%)
[ RUN      ] simple.proxy_pool_with_os_memory_provider
[       OK ] simple.proxy_pool_with_os_memory_provider (mean 728.101us, confidence interval +- 1.210658%)
[==========] 3 benchmarks ran.
[  PASSED  ] 3 benchmarks.

(see #198)

Great. It would be good to also have multithreaded benchmark, but I think this is good enough for now.

@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch from 9408546 to 4fefff6 Compare February 1, 2024 21:24
@ldorau
Copy link
Contributor Author

ldorau commented Feb 1, 2024

nit: pool_tracker sounds like it's something that tracks pools ;d Can we rename it to tracker_allocator?

Renamed

@ldorau
Copy link
Contributor Author

ldorau commented Feb 1, 2024

@bratpiorka review please :-)

@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch from 4fefff6 to 96897cb Compare February 5, 2024 06:45
@ldorau ldorau force-pushed the Use_base_allocator_in_the_tracking_provider branch from 96897cb to faa65ee Compare February 5, 2024 08:59
@bratpiorka bratpiorka merged commit aff94a2 into oneapi-src:main Feb 5, 2024
@ldorau ldorau deleted the Use_base_allocator_in_the_tracking_provider branch February 5, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants