Skip to content

Commit

Permalink
Merge pull request #437 from saiislam/saiislam-multi-image
Browse files Browse the repository at this point in the history
[Smoke] Add tests for TargetID Support
  • Loading branch information
saiislam authored Oct 20, 2022
2 parents 0e794bd + ac46d0d commit 7adc54b
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 1 deletion.
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;
}

0 comments on commit 7adc54b

Please sign in to comment.