Skip to content

[SYCL][CUDA] Add mem_advise reset and managed mem check #5536

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

Merged
merged 14 commits into from
Jul 29, 2022

Conversation

AidanBeltonS
Copy link
Contributor

@AidanBeltonS AidanBeltonS commented Feb 10, 2022

This PR adds the mem_advise reset case and a managed memory check in cuda_piextUSMEnqueueMemAdvise.

cuMemAdvise only works on managed memory and returns an error if host or device memory is passed.
The SYCL-CTS tests mem_advise with host and device memory, which are not managed. This PR prevents an error from being thrown in the cts usm test.

In addition, the sycl spec specifies for mem_advise A value of 0 reverts the advice for ptr to the default behavior, currently a value of 0 is treated as unknown and throws an error in the cts as well. This reset case is added to mem_advise.

This patch along with #5446 resolves issue #5209

This change breaks the ABI

Copy link
Contributor

@s-kanaev s-kanaev left a comment

Choose a reason for hiding this comment

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

Please, don't change user-visible enum values. Only add new ones.

@AidanBeltonS
Copy link
Contributor Author

AidanBeltonS commented Jun 9, 2022

Non ABI breaking changes also being proposed in: #6281

@steffenlarsen
Copy link
Contributor

Non ABI breaking changes also being proposed in: #6281

Sorry @AidanBeltonS . I completely missed this PR. Does #6281 cover everything that this changes or should we coordinate the patches?

@AidanBeltonS
Copy link
Contributor Author

Sorry @AidanBeltonS . I completely missed this PR. Does #6281 cover everything that this changes or should we coordinate the patches?

No worries. I think #6281 covers all everything that does not require an ABI breaking window so I don't think anything needs to be coordinated. I can update this PR later so that it just makes the enum changes.

@AidanBeltonS
Copy link
Contributor Author

The alternative is to translate a 0 in mem_advise to whatever value we give PI_MEM_ADVICE_RESET here. Since ABI/API breaks are allowed currently I think it's fine to do like this, though I wonder if we should take the opportunity and move PI_MEM_ADVICE_UNKNOWN to a value that is unlikely to conflict with future advice.

I have set PI_MEM_ADVICE_UNKNOWN to 999, so this should hopefully be a value such that it does not cause any conflicts.

Either way, if this changes ABI/API we need to increment the version number.

Done

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Thanks, @AidanBeltonS! Changes look good to me, but since it changes the PI API and break backwards compatability, the PI version should be incremented as detailed at the top of pi.h.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM!

@steffenlarsen
Copy link
Contributor

Test failure in Basic/image/image_write_fp16.cpp. @AidanBeltonS - Is this related to this patch?

@AidanBeltonS
Copy link
Contributor Author

It appears to be unrelated to this patch. There is no use of mem_advice or USM within the test.

@steffenlarsen
Copy link
Contributor

Do you know if it's a known failure? If not, could you please open an issue for investigating it?

@AidanBeltonS
Copy link
Contributor Author

I do not think it is a known problem. I have created an issue to track it #6491.

@steffenlarsen
Copy link
Contributor

Perfect, thank you! In that case, let's get this merged.

@steffenlarsen steffenlarsen merged commit fe18839 into intel:sycl Jul 29, 2022
@AidanBeltonS AidanBeltonS deleted the cuda_memadvise branch July 29, 2022 10:53
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