<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - USM not working"
   href="https://bugs.llvm.org/show_bug.cgi?id=49874">49874</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>USM not working
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Clang Compiler Support
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>itaru.kitayama@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>```
#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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>