[Openmp-commits] [PATCH] D132660: [openmp][amdgpu] Implement target_alloc_host as fine grain HSA memory

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Aug 25 08:30:03 PDT 2022


jhuber6 added a comment.

In D132660#3749148 <https://reviews.llvm.org/D132660#3749148>, @JonChesterfield wrote:

> Why is managed of particular interest? Especially if it's going to be mapped onto the same thing as host

See the test file, it lets use use the same pointer on the host and device. We have some work that wants to use this to track information from the device but can't because AMDGPU doesn't support it.

    // Allocates device managed memory that is shared between the host and device.
    int *shared_ptr =
        omp_alloc(N * sizeof(int), llvm_omp_target_shared_mem_alloc);
  
  #pragma omp target teams distribute parallel for is_device_ptr(shared_ptr)
    for (int i = 0; i < N; ++i) {
      shared_ptr[i] = 1;
    }
  
    int sum = 0;
    for (int i = 0; i < N; ++i)
      sum += shared_ptr[i];


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132660/new/

https://reviews.llvm.org/D132660



More information about the Openmp-commits mailing list