Skip to content

[OpenMP] Support for global variables when in auto zero-copy. #80876

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 1 commit into from
Feb 6, 2024

Conversation

carlobertolli
Copy link
Member

When building without unified_shared_memory, global variables are declared in the device binary and allocated upon loading onto GPU memory. However, when running in zero-copy mode (same as with unified_shared_memory) D2H and H2D copies for mapped local and global variables are turned off. This patch turns back on H2D and D2H copies when they refer to global variables, enabling an application built without unified_shared_memory to work correctly with global variables when run under automatic zero-copy.

@llvmbot llvmbot added the openmp:libomptarget OpenMP offload runtime label Feb 6, 2024
@carlobertolli carlobertolli requested a review from ronlieb February 6, 2024 17:22
Copy link

github-actions bot commented Feb 6, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

When building without unified_shared_memory, global variables
are declared in the device binary and allocated upon loading
onto GPU memory. However, when running in zero-copy mode
(same as with unified_shared_memory) D2H and H2D copies for
mapped local and global variables are turned off. This patch turns
back on H2D and D2H copies when they refer to global variables,
enabling an application built without unified_shared_memory to
work correctly with global variables when run under automatic zero-copy.

Co-authored-by: Doru Bercea <[email protected]>
Co-authored-by: Jan-Patrick Lehr <[email protected]>
@carlobertolli carlobertolli force-pushed the AutoZeroCopyGlobals.fork branch from 8dcc66f to 6918bde Compare February 6, 2024 20:52
@carlobertolli carlobertolli merged commit 12aad1a into llvm:main Feb 6, 2024
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