[smoke-fort-dev] Add test for omp_get_mapped_ptr#2180
Merged
DominikAdamski merged 2 commits intoROCm:aomp-devfrom Apr 27, 2026
Merged
[smoke-fort-dev] Add test for omp_get_mapped_ptr#2180DominikAdamski merged 2 commits intoROCm:aomp-devfrom
DominikAdamski merged 2 commits intoROCm:aomp-devfrom
Conversation
omp_get_mapped ptr does not work as expected on MI210. The test case with omp_get_mapped_ptr should generate the same output as the test case with use_device_addr clause.
77d4452 to
126d2bc
Compare
mjklemm
requested changes
Apr 24, 2026
| #include <hip/hip_runtime.h> | ||
| #include <stdlib.h> | ||
|
|
||
| __global__ void bar_kernel(int *x, int *y, int *z) |
Contributor
There was a problem hiding this comment.
I'd pass n and not use 1000 as a fixed number. Does not much change the test, but makes it easier to use a bigger working set.
| { | ||
| int i = blockIdx.x * blockDim.x + threadIdx.x; | ||
|
|
||
| if (i < 1000) { |
|
|
||
| extern "C" { | ||
|
|
||
| void bar_GPU(int *x, int *y, int *z) |
Contributor
There was a problem hiding this comment.
Add n as a parameter to the function.
|
|
||
| void bar_GPU(int *x, int *y, int *z) | ||
| { | ||
| hipLaunchKernelGGL(bar_kernel, dim3(32), dim3(32), 0, 0, x, y, z); |
Contributor
There was a problem hiding this comment.
I haven't tested the test on my machine, but hipLaunchKernelGGL launches the kernel asynchronously. So, you need a hipDeviceSynchronize() after it. Otherwise, you might (and you likely are) returning back to Fortran too early and the !$omp end target data deletes the device buffer to early before the kernel is complete.
Contributor
Author
There was a problem hiding this comment.
Thanks for the hint. I added synchronization and I don't see data race.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Add test for
omp_get_mapped_ptr.Technical Details
The test case with
omp_get_mapped_ptrshouldgenerate the same output as the test case with
use_device_addrclause.