-
Notifications
You must be signed in to change notification settings - Fork 35
Add the umfPoolCreateEx internal function #69
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
Conversation
d4d2953
to
de5cb60
Compare
FYI, this (or something similar) is needed if we want to implement |
I understand that this function is needed to implement |
I would prefer a function that combines pool and provider params so the provider would be both created and destroyed with the pool. Something like: umfPoolCreateEx(const struct umf_memory_pool_ops_t *pool_ops, void *pool_params, with this API we don't expose the handle to the provider to the user at all so it is obvious who is managing and controlling the live of the provider. |
It just proves the point that every time we want to extend public API we need to discuss it first. In that particular case, I think we can keep the proposed function internal. At least as a first step - there are no immediate need to make it public. |
Yes, I agree that we shouldn't expose this in public API if this is not needed. But also I think that we should follow the RAII concept - if the pool is an owner of the provider, the handle of provider should be hidden so no one could destroy the provider in the background |
Yes, I think both comments make sense. We can make it private for now and use the signature that Rafal suggested. However, we will need to expose it once we want to also expose memory_target_ops. |
de5cb60
to
82ecc38
Compare
Will you add the unit test? |
src/memory_pool.c
Outdated
@@ -15,6 +15,30 @@ | |||
#include <assert.h> | |||
#include <stdlib.h> | |||
|
|||
enum umf_result_t |
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.
Note that with recent Łukasz D. changes there is no need to use "enum" and "struct" keywords when you reference umf_result_t etc. Please remove them.
0031e80
to
102cfb2
Compare
I've added test that checks whether |
I think you could try enabling sanitizer, it should be pretty easy (just need to add flag to the compilation). And you can even reuse logic from UR: https://github.com/oneapi-src/unified-runtime/blob/4424195c7d5d990901f7343fa9e7ac500b03e38d/cmake/helpers.cmake#L45 |
We had plans to add various sanitizers - look for them in our JIRA (UMFW-130). If you want to take care of these please do it in separate PR. |
It creates a pool that owns a memory provider generated from the provided provider operations.
102cfb2
to
528e96d
Compare
I've assigned myself for this task. |
... that creates a pool owning the provided memory provider.