Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Conversation

igchor
Copy link
Member

@igchor igchor commented Jan 3, 2024

This function is useful in tests and simplifies integration with UR. Without it, the logic for provider lifetime management is duplicated in several places.

@igchor igchor requested a review from a team as a code owner January 3, 2024 20:49
@igchor igchor requested a review from vinser52 January 3, 2024 20:49
@vinser52
Copy link
Contributor

vinser52 commented Jan 4, 2024

This function is useful in tests and simplifies integration with UR. Without it, the logic for provider lifetime management is duplicated in several places.

As I understand in tests we are using C++ wrappers to automatically destroy emory provider instance. Can we use the same in UR?

Copy link
Contributor

@ldorau ldorau left a 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

@igchor
Copy link
Member Author

igchor commented Jan 4, 2024

This function is useful in tests and simplifies integration with UR. Without it, the logic for provider lifetime management is duplicated in several places.

As I understand in tests we are using C++ wrappers to automatically destroy emory provider instance. Can we use the same in UR?

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.
@vinser52
Copy link
Contributor

vinser52 commented Jan 4, 2024

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).

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.

@igchor
Copy link
Member Author

igchor commented Jan 4, 2024

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).

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.

@igchor
Copy link
Member Author

igchor commented Jan 10, 2024

@vinser52 as discussed, here's the alternative approach : #126

@vinser52
Copy link
Contributor

@vinser52 as discussed, here's the alternative approach : #126

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 (umfMemoryProviderCreate) and I think it is clearer for the user.

So I vote for #126.
What do others think about it?

@bratpiorka
Copy link
Contributor

@vinser52 as discussed, here's the alternative approach : #126

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 (umfMemoryProviderCreate) and I think it is clearer for the user.

So I vote for #126. What do others think about it?

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

@igchor
Copy link
Member Author

igchor commented Jan 12, 2024

@vinser52 as discussed, here's the alternative approach : #126

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 (umfMemoryProviderCreate) and I think it is clearer for the user.
So I vote for #126. What do others think about it?

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.

@vinser52
Copy link
Contributor

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

@ldorau
Copy link
Contributor

ldorau commented Jan 15, 2024

@igchor Rebase please

@vinser52
Copy link
Contributor

So, @igchor, will you extend the umfPoolCreate function with an additional flag instead of adding a new API?

@igchor
Copy link
Member Author

igchor commented Jan 16, 2024

So, @igchor, will you extend the umfPoolCreate function with an additional flag instead of adding a new API?

Yes, I will change #126

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.

4 participants