brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 9d88614 Raw
38 lines · c
1// clang-format off2// RUN: %libomptarget-compileopt-generic3// RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_ALLOCATION_TRACES=1 LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD=1024 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK4// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK-PASS5// clang-format on6 7// If offload memory pooling is enabled for a large allocation, reuse error is8// not detected. Run the test w/ and w/o ENV var override on memory pooling9// threshold. REQUIRES: large_allocation_memory_pool10 11#include <omp.h>12#include <stdio.h>13 14int main() {15  int N = (1 << 30);16  char *A = (char *)malloc(N);17  char *P;18#pragma omp target map(A[ : N]) map(from : P)19  {20    P = &A[N / 2];21    *P = 3;22  }23  // clang-format off24// CHECK: OFFLOAD ERROR: memory access fault by GPU {{.*}} (agent 0x{{.*}}) at virtual address [[PTR:0x[0-9a-z]*]]. Reasons: {{.*}}25// CHECK: Device pointer [[PTR]] points into prior host-issued allocation:26// CHECK: Last deallocation:27// CHECK: Last allocation of size 107374182428// clang-format on29#pragma omp target30  {31    *P = 5;32  }33 34  // CHECK-PASS: PASS35  printf("PASS\n");36  return 0;37}38