https://bugs.llvm.org/show_bug.cgi?id=49874

            Bug ID: 49874
           Summary: USM not working
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

```
#include <iostream>
#include <omp.h>

//#pragma omp requires unified_shared_memory
#define N 1024

void func(int p[N]) {
  std::cout << p << std::endl;
  std::cout << &p << std::endl;

#pragma omp target
  {
    for (int i = 0; i < N; i++) {
      p[0] = 123456;
    }
  }
  std::cout << p[0] << std::endl;
}

int main() {

  int a[N] = {0};
  std::cout << a << std::endl;
  std::cout << &a << std::endl;

#pragma omp target
  {
    for (int i = 0; i < N; i++) {
      a[0] = 123456;
    }
  }
  std::cout << a[0] << std::endl;

  func(a);

  int *b = new int[N];
  std::cout << b << std::endl;
  std::cout << &b << std::endl;

#pragma omp target
  {
    for (int i = 0; i < N; i++) {
      b[0] = 123456;
    }
  }
  std::cout << b[0] << std::endl;

  func(b);

  return 0;

}
```

The above test code in C++ fails at runtime on an A100 target.
The Linux kernel is enabled HMM, which is necessary for USM to work.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to