Skip to content

[OpenMP] 6.0 (TR11) Memory Management Update #97106

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 4 commits into from
Apr 2, 2025

Conversation

hansangbae
Copy link
Contributor

TR11 introduced changes to support target memory management in a unified way by defining a series of API routines and additional traits. Host runtime is oblivious to how actual memory resources are mapped when using the new API routines, so it can only support how the composed memory space is maintained, and the offload backend must handle which memory resources are actually used to allocate memory from the memory space.

Here is summary of the implementation.

  • Implemented 12 API routines to get/mainpulate memory space/allocator.
  • Memory space composed with a list of devices has a state with resource description, and runtime is responsible for maintaining the allocated memory space objects.
  • Defined interface with offload runtime to access memory resource list, and to redirect calls to omp_alloc/omp_free since it requires backend-specific information.
  • Value of omp_default_mem_space changed from 0 to 99, and omp_null_mem_space took the value 0 as defined in the language.
  • New allocator traits were introduced, but how to use them is up to the offload backend.
  • Added basic tests for the new API routines.

TR11 introduced changes to support target memory management in a unified
way by defining a series of API routines and additional traits.
Host runtime is oblivious to how actual memory resources are mapped when
using the new API routines, so it can only support how the composed
memory space is maintained, and the offload backend must handle which
memory resources are actually used to allocate memory from the memory
space.

Here is summary of the implementation.
* Implemented 12 API routines to get/mainpulate memory space/allocator.
* Memory space composed with a list of devices has a state with resource
  description, and runtime is responsible for maintaining the allocated
  memory space objects.
* Defined interface with offload runtime to access memory resource list,
  and to redirect calls to omp_alloc/omp_free since it requires
  backend-specific information.
* Value of omp_default_mem_space changed from 0 to 99, and
  omp_null_mem_space took the value 0 as defined in the language.
* New allocator traits were introduced, but how to use them is up to the
  offload backend.
* Added basic tests for the new API routines.
@hansangbae hansangbae added the openmp:libomp OpenMP host runtime label Jun 28, 2024
@hansangbae hansangbae marked this pull request as ready for review June 28, 2024 20:15
Copy link
Contributor

@nawrinsu nawrinsu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

github-actions bot commented Apr 1, 2025

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

@hansangbae hansangbae merged commit 8100bd5 into llvm:main Apr 2, 2025
9 checks passed
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Apr 3, 2025
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Apr 3, 2025
TR11 introduced changes to support target memory management in a unified
way by defining a series of API routines and additional traits. Host
runtime is oblivious to how actual memory resources are mapped when
using the new API routines, so it can only support how the composed
memory space is maintained, and the offload backend must handle which
memory resources are actually used to allocate memory from the memory
space.

Here is summary of the implementation.
* Implemented 12 API routines to get/mainpulate memory space/allocator.
* Memory space composed with a list of devices has a state with resource
description, and runtime is responsible for maintaining the allocated
memory space objects.
* Defined interface with offload runtime to access memory resource list,
and to redirect calls to omp_alloc/omp_free since it requires
backend-specific information.
* Value of omp_default_mem_space changed from 0 to 99, and
omp_null_mem_space took the value 0 as defined in the language.
* New allocator traits were introduced, but how to use them is up to the
offload backend.
* Added basic tests for the new API routines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp:libomp OpenMP host runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants