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

[SYCL][UR][L0] Access UMF pool handles through usm::pool_manager #905

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kswiecicki
Copy link
Contributor

This PR contains cherry-picked commits from #630.

@jandres742
Copy link

This PR contains cherry-picked commits from #630.

so should we wait for #630 to be merged?

@jandres742
Copy link

Please open draft PR in intel/llvm for pre-merge testing, as indicated here https://github.com/oneapi-src/unified-runtime/pull/902/files

@kswiecicki
Copy link
Contributor Author

Please open draft PR in intel/llvm for pre-merge testing, as indicated here https://github.com/oneapi-src/unified-runtime/pull/902/files

Draft for pre-merge testing: intel/llvm#11357

// Store the host memory pool. It does not depend on any device.
umf::pool_unique_handle_t HostMemPool;
usm::pool_manager<usm::pool_descriptor> PoolManager;
usm::pool_manager<usm::pool_descriptor> ProxyPoolManager;
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 wondering if it wouldn't be better to just have a flag in pool_descriptor to decide if we do any pooling. We could then have only a single pool manager.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But is it fitting to place such an option in the pool_descriptor?

Copy link
Member

Choose a reason for hiding this comment

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

Why not? I think in the future, we will want to have even more options in pool_descriptor, e.g. related to access characteristics, etc. that would influence pooling.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, this looks odd. If you decide to do otherwise, please add a comment.

@kswiecicki kswiecicki force-pushed the adapters-l0-pool-manager branch 2 times, most recently from 87f4bb1 to 1357d8b Compare October 2, 2023 11:00
@kswiecicki kswiecicki requested review from a team as code owners October 24, 2023 10:55
@kswiecicki kswiecicki force-pushed the adapters-l0-pool-manager branch 3 times, most recently from 7785d65 to 9bd5d0e Compare October 26, 2023 13:35
source/adapters/level_zero/context.cpp Outdated Show resolved Hide resolved
source/adapters/level_zero/context.cpp Show resolved Hide resolved
source/adapters/level_zero/usm.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@EwanC EwanC left a comment

Choose a reason for hiding this comment

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

I've only reviewed source/adapters/level_zero/command_buffer.cpp, but LGTM

@kswiecicki
Copy link
Contributor Author

I've only reviewed source/adapters/level_zero/command_buffer.cpp, but LGTM

Hey @EwanC, because of the scope of this PR I have created a separate PR for the min/max call fix #1045, could you take a look?

@kswiecicki kswiecicki force-pushed the adapters-l0-pool-manager branch 2 times, most recently from 227801c to 71cac2c Compare November 22, 2023 09:58
@fabiomestre fabiomestre changed the base branch from adapters to main December 5, 2023 16:55
@fabiomestre
Copy link
Contributor

I have updated the target branch of this PR from the adapters branch to the main branch.
Development in UR is moving back to main. The adapters branch will soon be deleted.

@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2023

Codecov Report

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

Comparison is base (5d5c810) 15.44% compared to head (174e2e4) 15.44%.
Report is 186 commits behind head on main.

Files Patch % Lines
source/common/ur_pool_manager.hpp 0.00% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #905      +/-   ##
==========================================
- Coverage   15.44%   15.44%   -0.01%     
==========================================
  Files         239      239              
  Lines       33970    33970              
  Branches     3758     3758              
==========================================
- Hits         5246     5245       -1     
- Misses      28673    28674       +1     
  Partials       51       51              

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

@@ -178,111 +183,120 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextSetExtendedDeleter(
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

// Template helper function for creating USM pools for given pool descriptor.
template <typename P, typename... Args>
std::pair<ur_result_t, umf::pool_unique_handle_t>
Copy link
Contributor

Choose a reason for hiding this comment

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

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 don't know if there's a benefit to using it since I call umf::poolMakeUnique that returns a pair anyway.

return (Desc.deviceReadOnly) ? usm::DisjointPoolMemType::SharedReadOnly
: usm::DisjointPoolMemType::Shared;
default:
// Added to suppress 'not all control paths return a value' warning.
Copy link
Contributor

Choose a reason for hiding this comment

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

ur::unreachable() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

// Store the host memory pool. It does not depend on any device.
umf::pool_unique_handle_t HostMemPool;
usm::pool_manager<usm::pool_descriptor> PoolManager;
usm::pool_manager<usm::pool_descriptor> ProxyPoolManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, this looks odd. If you decide to do otherwise, please add a comment.

@pbalcer
Copy link
Contributor

pbalcer commented Jan 24, 2024

@kswiecicki please create an intel/llvm PR to test the changes.

@kswiecicki
Copy link
Contributor Author

@kswiecicki please create an intel/llvm PR to test the changes.

There's one already: intel/llvm#11357

@kswiecicki kswiecicki force-pushed the adapters-l0-pool-manager branch 3 times, most recently from 2093065 to 174e2e4 Compare February 1, 2024 09:36
@kbenzie kbenzie added common Changes or additions to common utilities level-zero L0 adapter specific issues labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Changes or additions to common utilities level-zero L0 adapter specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants