Skip to content
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

Add a basic pool manager for memory providers #562

Closed
wants to merge 1 commit into from

Conversation

kswiecicki
Copy link
Contributor

No description provided.


public:
std::pair<uma_result_t, std::optional<pool_manager>>
create(std::vector<std::pair<D, uma_memory_provider_handle_t>>
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we should pass memory providers to this function. The descriptor should contain enough information to create a memory_provider on the fly.

Since we templatized the descriptor, I think we could require descriptor to implement a function like createProvider and just call it here.

}

void *alloc(D desc, size_t size) noexcept {
auto poolHandleOpt = getPool(desc);
Copy link
Member

Choose a reason for hiding this comment

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

I think the pool_manager can be just a container abstraction with API like: getPool, create (and perhaps addPool,). The rest (actual allocation API) can be implemented on top of that.

You will need some extra code to get an instance of a pool manager anyway (assuming we'll have pool_manager per ur_usm_pool_handle_t) so you can just put that code in one place (above pool_manager).

pool_manager<D> poolManager;
for (auto &[desc, memProvider] : descHandlePairs) {
auto [ret, hPool] =
uma::poolMakeUnique<proxy_pool>(&memProvider, 1, desc);
Copy link
Member

Choose a reason for hiding this comment

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

The type of the pool should be parametrized, right? Also, the pool can take some extra arguments (pool-specific). Perhaps we should pass a callback to the create function that actually creates the pool?

{UR_USM_TYPE_SHARED, {8, 4, 256}}};
} PoolConfig;

struct proxy_pool {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the responsibility of this struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was meant to forward the alloc/dealloc calls to the memory provider and perform pooling.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, is it an alternative to the disjoint pool? Is it just one more implementation of the heap manager?

Copy link
Member

@igchor igchor Jun 14, 2023

Choose a reason for hiding this comment

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

I think this implementation is no longer needed (at least for now), the PR just hasn't been updated yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. It was an intermediate solution while we deal with license issues.

@kswiecicki
Copy link
Contributor Author

Closed in favor of #630.

@kswiecicki kswiecicki closed this Jun 16, 2023
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