Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / ompt / veccopy_disallow_both.c
blobb531a628803e46f6de6e798477c7ba593d520024
1 // RUN: %libomptarget-compile-run-and-check-generic
2 // REQUIRES: ompt
3 // REQUIRES: gpu
5 /*
6 * Example OpenMP program that shows that both EMI and non-EMI
7 * callbacks cannot be registered for the same type. In the
8 * current implementation, the EMI callback overrides the non-EMI
9 * callback.
12 #include <omp.h>
13 #include <stdio.h>
15 #include "callbacks.h"
16 #include "register_both.h"
18 int main() {
19 int N = 100000;
21 int a[N];
22 int b[N];
24 int i;
26 for (i = 0; i < N; i++)
27 a[i] = 0;
29 for (i = 0; i < N; i++)
30 b[i] = i;
32 #pragma omp target parallel for
34 for (int j = 0; j < N; j++)
35 a[j] = b[j];
38 #pragma omp target teams distribute parallel for
40 for (int j = 0; j < N; j++)
41 a[j] = b[j];
44 int rc = 0;
45 for (i = 0; i < N; i++)
46 if (a[i] != b[i]) {
47 rc++;
48 printf("Wrong value: a[%d]=%d\n", i, a[i]);
51 if (!rc)
52 printf("Success\n");
54 return rc;
57 /// CHECK: Callback Init:
58 /// CHECK: Callback Load:
59 /// CHECK: Callback Target EMI: kind=1 endpoint=1
60 /// CHECK: Callback DataOp EMI: endpoint=1 optype=1
61 /// CHECK: Callback DataOp EMI: endpoint=2 optype=1
62 /// CHECK-NOT: dest=(nil)
63 /// CHECK: Callback DataOp EMI: endpoint=1 optype=2
64 /// CHECK: Callback DataOp EMI: endpoint=2 optype=2
65 /// CHECK: Callback DataOp EMI: endpoint=1 optype=1
66 /// CHECK: Callback DataOp EMI: endpoint=2 optype=1
67 /// CHECK-NOT: dest=(nil)
68 /// CHECK: Callback DataOp EMI: endpoint=1 optype=2
69 /// CHECK: Callback DataOp EMI: endpoint=2 optype=2
70 /// CHECK: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=1
71 /// CHECK: Callback DataOp EMI: endpoint=1 optype=3
72 /// CHECK: Callback DataOp EMI: endpoint=2 optype=3
73 /// CHECK: Callback DataOp EMI: endpoint=1 optype=3
74 /// CHECK: Callback DataOp EMI: endpoint=2 optype=3
75 /// CHECK: Callback DataOp EMI: endpoint=1 optype=4
76 /// CHECK: Callback DataOp EMI: endpoint=2 optype=4
77 /// CHECK: Callback DataOp EMI: endpoint=1 optype=4
78 /// CHECK: Callback DataOp EMI: endpoint=2 optype=4
79 /// CHECK: Callback Target EMI: kind=1 endpoint=2
80 /// CHECK: Callback Target EMI: kind=1 endpoint=1
81 /// CHECK: Callback DataOp EMI: endpoint=1 optype=1
82 /// CHECK: Callback DataOp EMI: endpoint=2 optype=1
83 /// CHECK-NOT: dest=(nil)
84 /// CHECK: Callback DataOp EMI: endpoint=1 optype=2
85 /// CHECK: Callback DataOp EMI: endpoint=2 optype=2
86 /// CHECK: Callback DataOp EMI: endpoint=1 optype=1
87 /// CHECK: Callback DataOp EMI: endpoint=2 optype=1
88 /// CHECK-NOT: dest=(nil)
89 /// CHECK: Callback DataOp EMI: endpoint=1 optype=2
90 /// CHECK: Callback DataOp EMI: endpoint=2 optype=2
91 /// CHECK: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=0
92 /// CHECK: Callback DataOp EMI: endpoint=1 optype=3
93 /// CHECK: Callback DataOp EMI: endpoint=2 optype=3
94 /// CHECK: Callback DataOp EMI: endpoint=1 optype=3
95 /// CHECK: Callback DataOp EMI: endpoint=2 optype=3
96 /// CHECK: Callback DataOp EMI: endpoint=1 optype=4
97 /// CHECK: Callback DataOp EMI: endpoint=2 optype=4
98 /// CHECK: Callback DataOp EMI: endpoint=1 optype=4
99 /// CHECK: Callback DataOp EMI: endpoint=2 optype=4
100 /// CHECK: Callback Target EMI: kind=1 endpoint=2
101 /// CHECK: Callback Fini: