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 common pool handle and memory provider classes to the common umf helpers #1248

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

aarongreig
Copy link
Contributor

No description provided.

@aarongreig
Copy link
Contributor Author

@kswiecicki obviously this patch isn't finished (especially on the l0 side) but just a heads up that I started working on adding pool support to the CL adapter and due to the greater need there to support arbitrary allocation flags I ended up making a bunch of changes to the UMF helper stuff in common/, which turned into this PR. No pressure to properly review it yet but if you find the time I would value your feedback on the approach I've taken to the common pool handle and memory provider classes

@codecov-commenter
Copy link

Codecov Report

Attention: 124 lines in your changes are missing coverage. Please review.

Comparison is base (9f14fed) 15.73% compared to head (d08cad4) 15.76%.
Report is 56 commits behind head on main.

Files Patch % Lines
source/common/ur_pool_manager.hpp 0.00% 58 Missing ⚠️
source/common/umf_helpers.hpp 0.00% 35 Missing ⚠️
source/common/umf_helpers.cpp 0.00% 28 Missing ⚠️
test/usm/usmPoolManager.cpp 0.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1248      +/-   ##
==========================================
+ Coverage   15.73%   15.76%   +0.02%     
==========================================
  Files         223      224       +1     
  Lines       31478    31573      +95     
  Branches     3558     3563       +5     
==========================================
+ Hits         4954     4977      +23     
- Misses      26473    26545      +72     
  Partials       51       51              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aarongreig aarongreig force-pushed the aaron/USMPoolsCommon branch 3 times, most recently from ca61b08 to 1d81e64 Compare January 16, 2024 17:00
@@ -158,63 +194,83 @@ inline bool pool_descriptor::operator==(const pool_descriptor &other) const {
}
}

if (lhs.allocLocation.has_value()) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think you can simplify it to: if (lhs.allocLocation != rhs.allocLocation) return false;

Copy link
Member

Choose a reason for hiding this comment

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

Ah, nevermind, pNext might be different. I'm wondering if we should perhaps implement operator== for ur_usm_alloc_location_desc_t ...

}
}

return {ret, descriptors};
}

inline usm::DisjointPoolMemType
urTypeToDisjointPoolType(const ur_usm_type_t &type) {
Copy link
Member

Choose a reason for hiding this comment

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

What about SharedReadOnly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think only having these three types makes sense because they correspond to the three allocation entry points in UR, read only pools will still be distinct by the fact that they're TYPE_SHARED and pass the appropriate read only alloc flag

Copy link
Member

Choose a reason for hiding this comment

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

The problem is that Shared and SharedReadOnly pools have different defaults (specifically, for Shared pooling is disabled by default) and we also allow users to change the pooling behavior for each of those 4 types separately through UR_L0_USM_ALLOCATOR (aka SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR). This env variable is not very well documented and is still considered 'experimental' but it's been useful for some applications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I see.. I was worried that the extra type was more than it first seemed. This aspect probably needs a re-design in that case, I'll be revisiting this PR once the pool manager PRs merge and I can rebase

source/common/ur_pool_manager.hpp Show resolved Hide resolved
throw umf::UsmAllocationException(Ret);
}

PoolManager.addPool(desc, newPool);
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think it would be less error-prone to make addPool accept uniquq_ptr by value so that the caller would need to std::move() the argument.

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