Skip to content
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

[Smoke] Add tests for TargetID Support #437

Merged
merged 1 commit into from
Oct 20, 2022
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
2 changes: 1 addition & 1 deletion test/smoke-fails/multi-image-long-format/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TESTSRC_MAIN = multi-image.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)

OMP_FLAGS = -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa,amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=$(AOMP_GPU) -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803
OMP_FLAGS = -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=$(AOMP_GPU) -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803
CLANG = clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
Expand Down
20 changes: 20 additions & 0 deletions test/smoke-fails/targetid/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include ../../Makefile.defs

TESTNAME = targetid
TESTSRC_MAIN = targetid.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)

OMP_FLAGS = -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx90a:sramecc-:xnack+
CLANG = clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
#"-\#\#\#"

include ../Makefile.rules
run: $(TESTNAME)
HSA_XNACK=1 ./$(TESTNAME)
# will pass only on machines where xnack+ is configured

strings $(TESTNAME) |grep -i gfx
20 changes: 20 additions & 0 deletions test/smoke-fails/targetid/targetid.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>
#include <omp.h>

int main(void) {
int isHost = 1;

#pragma omp target map(tofrom: isHost)
{
isHost = omp_is_initial_device();
printf("Hello world. %d\n", 100);
for (int i =0; i<5; i++) {
printf("Hello world. iteration %d\n", i);
}
}

printf("Target region executed on the %s\n", isHost ? "host" : "device");

return isHost;
}

21 changes: 21 additions & 0 deletions test/smoke-fails/targetid_multi_image/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include ../../Makefile.defs

TESTNAME = targetid-multi-image
TESTSRC_MAIN = targetid-multi-image.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)

OMP_FLAGS = -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx90a:xnack- -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx90a:xnack+
CLANG = clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
#"-\#\#\#"

include ../Makefile.rules
run: $(TESTNAME)
HSA_XNACK=1 ./$(TESTNAME)
# will pass only on machines where xnack+ is configured

HSA_XNACK=0 ./$(TESTNAME)
strings $(TESTNAME) |grep -i gfx
20 changes: 20 additions & 0 deletions test/smoke-fails/targetid_multi_image/targetid-multi-image.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>
#include <omp.h>

int main(void) {
int isHost = 1;

#pragma omp target map(tofrom: isHost)
{
isHost = omp_is_initial_device();
printf("Hello world. %d\n", 100);
for (int i =0; i<5; i++) {
printf("Hello world. iteration %d\n", i);
}
}

printf("Target region executed on the %s\n", isHost ? "host" : "device");

return isHost;
}