<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 - declare target device_type not work as expected"
   href="https://bugs.llvm.org/show_bug.cgi?id=47158">47158</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>declare target device_type not work as expected
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>cchen@cray.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>1. Clang emit "error: function with 'device_type(host)' is not available on
device" when `nohost` is specified in device_type
(<a href="https://godbolt.org/z/zb5frT">https://godbolt.org/z/zb5frT</a>):

```
// clang -fopenmp -fopenmp-version=50 -fopenmp-targets=nvptx64 -emit-llvm -S
nohost.c
int device_fun() { return 100; }
#pragma omp declare target to(device_fun) device_type(nohost)

int main() {
#pragma omp target
    {
        device_fun();
    }
}
```

2. Clang emit "function with 'device_type(host)' is not available on device"
when `host` is specified in device_type (<a href="https://godbolt.org/z/4M7j8E">https://godbolt.org/z/4M7j8E</a>)

```
// clang -fopenmp -fopenmp-version=50 -fopenmp-targets=nvptx64 -emit-llvm -S
host.c
int host_fun() { return 100; }
#pragma omp declare target to(host_fun) device_type(host)

int main() {
    host_fun();
}
```</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>