Skip to content

[OpenMP][libomptarget] Enable lazy device initialization #76832

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

doru1004
Copy link
Contributor

@doru1004 doru1004 commented Jan 3, 2024

Enable lazy device initialization. This addresses this issue: #75677

This is a runtime feature which can be enabled using the following environment variable when running an OpenMP program:

LIBOMPTARGET_LAZY_DEVICE_INIT=1

@doru1004 doru1004 requested review from jdoerfert and jhuber6 January 3, 2024 16:33
@llvmbot llvmbot added the openmp:libomptarget OpenMP offload runtime label Jan 3, 2024
@doru1004 doru1004 force-pushed the optional-lazy-device-init branch from 9db4a91 to cb8e098 Compare January 3, 2024 16:46
@doru1004 doru1004 requested a review from ronlieb January 3, 2024 16:54
Copy link
Member

@jdoerfert jdoerfert left a comment

Choose a reason for hiding this comment

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

I mark this as requests changes until we resolve the conversation on the issue. It looks like we are still seeing different profile results, right?

@doru1004
Copy link
Contributor Author

doru1004 commented Jan 3, 2024

Whether we can reproduce upstream or not I think we should allow for the user to choose which way the device initialization happens eager or lazy.
As a side effect it will provide a resolution to the issue hence the link to the issue.

@jdoerfert
Copy link
Member

Whether we can reproduce upstream or not I think we should allow for the user to choose which way the device initialization happens eager or lazy. As a side effect it will provide a resolution to the issue hence the link to the issue.

Could you clarify why we would carry more code to give the user this choice if upstream does not experience the same issue?

@doru1004 doru1004 force-pushed the optional-lazy-device-init branch from cb8e098 to d206282 Compare January 4, 2024 15:39
@doru1004
Copy link
Contributor Author

doru1004 commented Jan 4, 2024

Whether we can reproduce upstream or not I think we should allow for the user to choose which way the device initialization happens eager or lazy. As a side effect it will provide a resolution to the issue hence the link to the issue.

Could you clarify why we would carry more code to give the user this choice if upstream does not experience the same issue?

It's not about the amount of code (which is minimal) it's about providing a choice. There's no clear choice between the two strategies so we need to provide both. Moreover we would find this addition useful so even more reason to add it.

@doru1004
Copy link
Contributor Author

doru1004 commented Jan 5, 2024

Can confirm that this patch does indeed help with PCIe interconnects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp:libomptarget OpenMP offload runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants