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

[UR] Add support for bidirectional USM prefetching #2312

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

Conversation

ianayl
Copy link

@ianayl ianayl commented Nov 11, 2024

This PR implements the previously unimplemented ur_usm_migration_flags_t enum, and adds the logic for prefetching for from the device to host for each implemented adapter.

Note that level zero currently does not support this behavior: it remains unimplemented for now until level zero implements a way to prefetch from device to host.

Corresponding intel/llvm PR for testing: intel/llvm#16047

@ianayl ianayl changed the title [WIP][UR] Add support for bidirectional USM prefetching [UR] Add support for bidirectional USM prefetching Dec 20, 2024
@ianayl ianayl marked this pull request as ready for review December 20, 2024 22:00
@ianayl ianayl requested review from a team as code owners December 20, 2024 22:00
@ianayl ianayl requested review from reble and jchlanda December 20, 2024 22:00
Comment on lines 1304 to 1308
if (Flags == UR_USM_MIGRATION_FLAG_DEVICE_TO_HOST) {
logger::warning("USM migration from device to host is not currently "
"supported by level zero.");
return UR_RESULT_SUCCESS;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This early return is a problem for out-of-order command-lists in that it doesn't respect the command dependencies or signal dependent commands when finished.

In the else branch below think we just want to opt-out of the actual zeCommandListAppendMemoryPrefetch but keep the zeCommandListAppendWaitOnEvents and zeCommandListAppendSignalEvent commnads.

Copy link
Author

Choose a reason for hiding this comment

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

Hey thanks for reviewing! Admittedly I'm not the most familiar with how things work in L0; would I also need to do this for source/adapters/level_zero/memory.cpp:1243?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I think that the same issue with an early return, the OutEvent output parameter won't be set and it's not respecting EventWaitList dependencies

Copy link
Contributor

@jchlanda jchlanda left a comment

Choose a reason for hiding this comment

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

CUDA/HIP 👍

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