Skip to content

[Test] Add smoke test to cover new runtime envar #1209

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 2 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <omp.h>
#include <stdio.h>

int main() {
int N = 10;

int a[N];
int b[N];

int i;

for (i = 0; i < N; i++)
a[i] = 0;

for (i = 0; i < N; i++)
b[i] = i;

#pragma omp target parallel for
{
for (int j = 0; j < N; j++)
a[j] = b[j];
}

int rc = 0;
for (i = 0; i < N; i++)
if (a[i] != b[i]) {
rc++;
printf("Wrong varlue: a[%d]=%d\n", i, a[i]);
}

if (!rc)
printf("Success\n");

return rc;
}

/// CHECK: TARGET AMDGPU RTL --> AMDGPUMemoryManager threshhold was set to: 1048576 B
18 changes: 18 additions & 0 deletions test/smoke-dev/rt-memory-threshold-env/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include ../../Makefile.defs

TESTNAME = AMDGPUMemoryManager_threshold_env
TESTSRC_MAIN = AMDGPUMemoryManager_threshold_env.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
RUNENV += LIBOMPTARGET_DEBUG=1
# This runtime flag sets the memory manager threshold to 2^20 = 1048576 B.
RUNENV += OMPX_AMD_MEMORY_MANAGER_THRESHOLD_EXP_2=20
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)

CLANG ?= clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
#"-\#\#\#"

include ../Makefile.rules