
Having nvptx offloading configured doesn't imply being able to run nvptx
offloading test cases on the test host.
Also, make 'libgomp.c/declare-variant-3.c' work for all non-offloading and
offloading cases.
Fix-up for commit 59b8ade887
"[libgomp, testsuite, nvptx] Add libgomp.c/declare-variant-3-sm*.c".
libgomp/
* testsuite/libgomp.c/declare-variant-3-sm30.c: Turn 'dg-do run'
into 'dg-do link'.
* testsuite/libgomp.c/declare-variant-3.c: New.
* testsuite/libgomp.c/declare-variant-3.h: Extend.
79 lines
1.1 KiB
C
79 lines
1.1 KiB
C
#pragma omp declare target
|
|
|
|
__attribute__ ((noipa))
|
|
int
|
|
f30 (void)
|
|
{
|
|
return 30;
|
|
}
|
|
|
|
__attribute__ ((noipa))
|
|
int
|
|
f35 (void)
|
|
{
|
|
return 35;
|
|
}
|
|
|
|
__attribute__ ((noipa))
|
|
int
|
|
f53 (void)
|
|
{
|
|
return 53;
|
|
}
|
|
|
|
__attribute__ ((noipa))
|
|
int
|
|
f70 (void)
|
|
{
|
|
return 70;
|
|
}
|
|
|
|
__attribute__ ((noipa))
|
|
int
|
|
f75 (void)
|
|
{
|
|
return 75;
|
|
}
|
|
|
|
__attribute__ ((noipa))
|
|
int
|
|
f80 (void)
|
|
{
|
|
return 80;
|
|
}
|
|
|
|
#pragma omp declare variant (f30) match (device={isa("sm_30")})
|
|
#pragma omp declare variant (f35) match (device={isa("sm_35")})
|
|
#pragma omp declare variant (f53) match (device={isa("sm_53")})
|
|
#pragma omp declare variant (f70) match (device={isa("sm_70")})
|
|
#pragma omp declare variant (f75) match (device={isa("sm_75")})
|
|
#pragma omp declare variant (f80) match (device={isa("sm_80")})
|
|
__attribute__ ((noipa))
|
|
int
|
|
f (void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#pragma omp end declare target
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int v = 0;
|
|
|
|
#pragma omp target map(from:v)
|
|
v = f ();
|
|
|
|
#ifdef OFFLOAD_DEVICE_NVPTX
|
|
if (v == 0)
|
|
__builtin_abort ();
|
|
|
|
__builtin_printf ("Nvptx accelerator: sm_%d\n", v);
|
|
#else
|
|
if (v != 0)
|
|
__builtin_abort ();
|
|
#endif
|
|
|
|
return 0;
|
|
}
|