d97364aab1
After recent commitbe661959a6
"libgomp/testsuite: Improve omp_get_device_num() tests", we're now iterating over all OpenMP target devices. Intel MIC (emulated) offloading still doesn't properly implement device-side 'omp_get_device_num', and we thus regress: PASS: libgomp.c/../libgomp.c-c++-common/target-45.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/target-45.c execution test PASS: libgomp.c++/../libgomp.c-c++-common/target-45.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c++/../libgomp.c-c++-common/target-45.c execution test PASS: libgomp.fortran/target10.f90 -O0 (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O0 execution test PASS: libgomp.fortran/target10.f90 -O1 (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O1 execution test PASS: libgomp.fortran/target10.f90 -O2 (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O2 execution test PASS: libgomp.fortran/target10.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test PASS: libgomp.fortran/target10.f90 -O3 -g (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -O3 -g execution test PASS: libgomp.fortran/target10.f90 -Os (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.fortran/target10.f90 -Os execution test Improve the XFAILing added in commitbb75b22aba
"Allow matching Intel MIC in OpenMP 'declare variant'" for the case that *any* Intel MIC offload device is available. libgomp/ * testsuite/libgomp.c-c++-common/on_device_arch.h (any_device_arch, any_device_arch_intel_mic): New. * testsuite/lib/libgomp.exp (check_effective_target_offload_device_any_intel_mic): New. * testsuite/libgomp.c-c++-common/target-45.c: Use it. * testsuite/libgomp.fortran/target10.f90: Likewise.
67 lines
1.1 KiB
C
67 lines
1.1 KiB
C
#include <omp.h>
|
|
#include <gomp-constants.h>
|
|
|
|
/* static */ int
|
|
device_arch_nvptx (void)
|
|
{
|
|
return GOMP_DEVICE_NVIDIA_PTX;
|
|
}
|
|
|
|
/* static */ int
|
|
device_arch_intel_mic (void)
|
|
{
|
|
return GOMP_DEVICE_INTEL_MIC;
|
|
}
|
|
|
|
#pragma omp declare variant (device_arch_nvptx) match(construct={target},device={arch(nvptx)})
|
|
#pragma omp declare variant (device_arch_intel_mic) match(construct={target},device={arch(intel_mic)})
|
|
/* static */ int
|
|
device_arch (void)
|
|
{
|
|
return GOMP_DEVICE_DEFAULT;
|
|
}
|
|
|
|
static int
|
|
on_device_arch (int d)
|
|
{
|
|
int d_cur;
|
|
#pragma omp target map(from:d_cur)
|
|
d_cur = device_arch ();
|
|
|
|
return d_cur == d;
|
|
}
|
|
|
|
int
|
|
on_device_arch_nvptx ()
|
|
{
|
|
return on_device_arch (GOMP_DEVICE_NVIDIA_PTX);
|
|
}
|
|
|
|
int
|
|
on_device_arch_intel_mic ()
|
|
{
|
|
return on_device_arch (GOMP_DEVICE_INTEL_MIC);
|
|
}
|
|
|
|
static int
|
|
any_device_arch (int d)
|
|
{
|
|
int nd = omp_get_num_devices ();
|
|
for (int i = 0; i < nd; ++i)
|
|
{
|
|
int d_cur;
|
|
#pragma omp target device(i) map(from:d_cur)
|
|
d_cur = device_arch ();
|
|
if (d_cur == d)
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
any_device_arch_intel_mic ()
|
|
{
|
|
return any_device_arch (GOMP_DEVICE_INTEL_MIC);
|
|
}
|