llvm-project/offload/test/mapping/declare_mapper_nested_default_mappers.cpp
Nick Sarnie 26b777444b
[offload][lit] XFAIL all failing tests on the Level Zero plugin (#174804)
We finally got our buildbot added (to staging, at least) so we want to
start running L0 tests in CI.
We need `check-offload` to pass though, so XFAIL everything failing.
There's a couple `UNSUPPORTED` as well, those are for sporadic fails.

Also make set the `gpu` and `intelgpu` LIT variables when testing the
`spirv64-intel` triple.

We have no DeviceRTL yet so basically everything fails, but we manage to
get

```
Total Discovered Tests: 432
Unsupported      : 169 (39.12%)
Passed           :  67 (15.51%)
Expectedly Failed: 196 (45.37%)
```

We still don't build the level zero plugin by default and these tests
don't run unless the plugin was built, so this has no effect on most
builds.

---------

Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
2026-01-07 19:20:30 +00:00

67 lines
1.6 KiB
C++

// RUN: %libomptarget-compilexx-run-and-check-generic
// XFAIL: intelgpu
#include <cstdio>
#include <cstdlib>
typedef struct {
int a;
double *b;
} C1;
#pragma omp declare mapper(C1 s) map(to : s.a) map(from : s.b[0 : 2])
typedef struct {
int a;
double *b;
C1 c;
} C;
#pragma omp declare mapper(C s) map(to : s.a, s.c) map(from : s.b[0 : 2])
typedef struct {
int e;
C f;
int h;
} D;
int main() {
constexpr int N = 10;
D s;
s.e = 111;
s.f.a = 222;
s.f.c.a = 777;
double x[2];
double x1[2];
x[1] = 20;
s.f.b = &x[0];
s.f.c.b = &x1[0];
s.h = N;
D *sp = &s;
D **spp = &sp;
printf("%d %d %d %4.5f %d\n", spp[0][0].e, spp[0][0].f.a, spp[0][0].f.c.a,
spp[0][0].f.b[1], spp[0][0].f.b == &x[0] ? 1 : 0);
// CHECK: 111 222 777 20.00000 1
int spp00fa = -1, spp00fca = -1, spp00fb_r = -1;
__intptr_t p = reinterpret_cast<__intptr_t>(&x[0]);
#pragma omp target map(tofrom : spp[0][0]) map(alloc : spp[0]) firstprivate(p) \
map(from : spp00fa, spp00fca, spp00fb_r)
{
spp00fa = spp[0][0].f.a;
spp00fca = spp[0][0].f.c.a;
spp00fb_r = spp[0][0].f.b == reinterpret_cast<void *>(p) ? 1 : 0;
printf("%d %d %d\n", spp00fa, spp00fca, spp00fb_r);
// XCHECK: 222 777 0
spp[0][0].e = 333;
spp[0][0].f.a = 444;
spp[0][0].f.c.a = 555;
spp[0][0].f.b[1] = 40;
}
printf("%d %d %d\n", spp00fa, spp00fca, spp00fb_r);
// CHECK: 222 777 0
printf("%d %d %d %4.5f %d\n", spp[0][0].e, spp[0][0].f.a, spp[0][0].f.c.a,
spp[0][0].f.b[1], spp[0][0].f.b == &x[0] ? 1 : 0);
// CHECK: 333 222 777 40.00000 1
}