Skip to content

Commit 206b03e

Browse files
authored
[Test] Add smoke test to cover new runtime envar (#1209)
* [Test] Add smoke test to cover new runtime envar This smoke test is to cover the new runtime envar OMPX_AMD_MEMORY_MANAGER_THRESHOLD_EXP_2 which is designed for users to specify the threshold for the memory size handled by AMDGPUMemoryManager. * Resolved comment
1 parent 54822c3 commit 206b03e

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <omp.h>
2+
#include <stdio.h>
3+
4+
int main() {
5+
int N = 10;
6+
7+
int a[N];
8+
int b[N];
9+
10+
int i;
11+
12+
for (i = 0; i < N; i++)
13+
a[i] = 0;
14+
15+
for (i = 0; i < N; i++)
16+
b[i] = i;
17+
18+
#pragma omp target parallel for
19+
{
20+
for (int j = 0; j < N; j++)
21+
a[j] = b[j];
22+
}
23+
24+
int rc = 0;
25+
for (i = 0; i < N; i++)
26+
if (a[i] != b[i]) {
27+
rc++;
28+
printf("Wrong varlue: a[%d]=%d\n", i, a[i]);
29+
}
30+
31+
if (!rc)
32+
printf("Success\n");
33+
34+
return rc;
35+
}
36+
37+
/// CHECK: TARGET AMDGPU RTL --> AMDGPUMemoryManager threshhold was set to: 1048576 B
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
include ../../Makefile.defs
2+
3+
TESTNAME = AMDGPUMemoryManager_threshold_env
4+
TESTSRC_MAIN = AMDGPUMemoryManager_threshold_env.c
5+
TESTSRC_AUX =
6+
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
7+
RUNENV += LIBOMPTARGET_DEBUG=1
8+
# This runtime flag sets the memory manager threshold to 2^20 = 1048576 B.
9+
RUNENV += OMPX_AMD_MEMORY_MANAGER_THRESHOLD_EXP_2=20
10+
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
11+
12+
CLANG ?= clang
13+
OMP_BIN = $(AOMP)/bin/$(CLANG)
14+
CC = $(OMP_BIN) $(VERBOSE)
15+
#-ccc-print-phases
16+
#"-\#\#\#"
17+
18+
include ../Makefile.rules

0 commit comments

Comments
 (0)