-
Notifications
You must be signed in to change notification settings - Fork 35
Make umfPoolCreateEx public #97
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
As I understand in tests we are using C++ wrappers to automatically destroy emory provider instance. Can we use the same in UR? |
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.
LGTM apart from one issue above to be fixed
In tests, we pretty much reimplement umfPoolCreateEx using C++ wrappers. In UR we can do the same but why reimplement it 2 times if we can just make this function public? Also, the wrappers itself would need to be reimplemented in UR since they are not a public API. I think this function is useful in general, especially for applications that are in C (and cannot use unique_ptrs). |
This function is useful in tests in in UR. Without it, the logic for provider lifetime management is duplicated in several places.
You got my point. We are using C++ in our tests, UR is also implemented in C++. The alternative approach could be to implement C++ wrappers for UMF (furthermore we have it mind anyway). I am not saying that I prefer this way or another, but let’s discuss it next week when I back from vacation. If we introduce new C API we have to guarantee backward compatibility and support it. |
Sure, let's do that. For public C++ wrappers, what we were considering was a more high level interface which we could not use in UR I think (at least not entirely). The wrappers we have implemented right now, are mostly the things we have in umf_helpers.hpp (a way to create pool/provider from a C++ class with appropriate methods + factory functions returning unique_ptr) and I don't thing we want those to be public. |
I like #126 better than this PR. In #126 the signature looks more generic and extensible (by adding new control flags). Also with #126 we keep a single entry point to create a memory provider ( So I vote for #126. |
hm but what do you think of keeping only umfPoolCreateEx but named as umfPoolCreate? I mean we could have only the function with flags that could be 0 as default |
Yeah, I think that would be pretty reasonable. |
I agree. it's a pity that the default arguments are not supported (without some tricks) in C |
@igchor Rebase please |
So, @igchor, will you extend the umfPoolCreate function with an additional flag instead of adding a new API? |
This function is useful in tests and simplifies integration with UR. Without it, the logic for provider lifetime management is duplicated in several places.