Skip to content

Commit 7727056

Browse files
committed
merge main into amd-staging
lands and reverts: [OpenMP] Enable automatic unified shared memory on MI300A. (llvm#77512) Change-Id: I69d3d09d7aad0b0f1709f30ee0a940ec2b202b83
2 parents ff737f0 + ae99966 commit 7727056

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// clang-format off
2+
// RUN: %libomptarget-compilexx-generic
3+
// RUN: env OMPX_APU_MAPS=1 HSA_XNACK=1 LIBOMPTARGET_INFO=30 %libomptarget-run-generic 2>&1 \
4+
// RUN: | %fcheck-generic -check-prefix=INFO_ZERO -check-prefix=CHECK
5+
6+
// RUN: %libomptarget-compilexx-generic
7+
// RUN: env HSA_XNACK=0 LIBOMPTARGET_INFO=30 %libomptarget-run-generic 2>&1 \
8+
// RUN: | %fcheck-generic -check-prefix=INFO_COPY -check-prefix=CHECK
9+
10+
// UNSUPPORTED: aarch64-unknown-linux-gnu
11+
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
12+
// UNSUPPORTED: nvptx64-nvidia-cuda
13+
// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
14+
// UNSUPPORTED: x86_64-pc-linux-gnu
15+
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
16+
17+
// REQUIRES: unified_shared_memory
18+
19+
// clang-format on
20+
21+
#include <cstdio>
22+
23+
int main() {
24+
int n = 1024;
25+
26+
// test various mapping types
27+
int *a = new int[n];
28+
int k = 3;
29+
int b[n];
30+
31+
for (int i = 0; i < n; i++)
32+
b[i] = i;
33+
34+
// clang-format off
35+
// INFO_ZERO: Return HstPtrBegin 0x{{.*}} Size=4096 for unified shared memory
36+
// INFO_ZERO: Return HstPtrBegin 0x{{.*}} Size=4096 for unified shared memory
37+
38+
// INFO_COPY: Creating new map entry with HstPtrBase=0x{{.*}}, HstPtrBegin=0x{{.*}}, TgtAllocBegin=0x{{.*}}, TgtPtrBegin=0x{{.*}}, Size=4096,
39+
// INFO_COPY: Creating new map entry with HstPtrBase=0x{{.*}}, HstPtrBegin=0x{{.*}}, TgtAllocBegin=0x{{.*}}, TgtPtrBegin=0x{{.*}}, Size=4096,
40+
// INFO_COPY: Mapping exists with HstPtrBegin=0x{{.*}}, TgtPtrBegin=0x{{.*}}, Size=4096, DynRefCount=1 (update suppressed)
41+
// INFO_COPY: Mapping exists with HstPtrBegin=0x{{.*}}, TgtPtrBegin=0x{{.*}}, Size=4096, DynRefCount=1 (update suppressed)
42+
// clang-format on
43+
#pragma omp target teams distribute parallel for map(tofrom : a[ : n]) \
44+
map(to : b[ : n])
45+
for (int i = 0; i < n; i++)
46+
a[i] = i + b[i] + k;
47+
48+
int err = 0;
49+
for (int i = 0; i < n; i++)
50+
if (a[i] != i + b[i] + k)
51+
err++;
52+
53+
// CHECK: PASS
54+
if (err == 0)
55+
printf("PASS\n");
56+
return err;
57+
}

revert_patches.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ revert: breaks MIOpen composableKernel build
55
Reverts: breaks HIP tests in wPSDB and nPSDB
66
[AMDGPU] Add dynamic LDS size implicit kernel argument t
77

8+
Reverts: lands and reverts in place to allow post merge land of patch
9+
[OpenMP] Enable automatic unified shared memory on MI300A. (#77512)

0 commit comments

Comments
 (0)