<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/106403>106403</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            amdgpu openmp refuses to compile without rocm device libs, doesn't actually use rocm device libs
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            JonChesterfield,
            jhuber6
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          JonChesterfield
      </td>
    </tr>
</table>

<pre>
    If you don't have rocm device libs installed somewhere clang can find them, clang -fopenmp for amdgpu returns:

`clang: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library`

If you pass nogpulib, it doesn't link the openmp device runtime. If you pass rocm-path to somewhere with a collection of empty bitcode stubs I think it should succeed, but I haven't managed to guess the directory structure either option expects.

This issue is to add a flag "norocmlib" or "norocmgpulib" or similar which disables the error on failing to find rocm device libs and doesn't try to automatically link them into the program, but leaves the non-rocm gpu libraries alone. In particular, it shouldn't disable the openmp runtime bitcode.

I think the points to edit are `RocmInstallationDetector::checkCommonBitcodeLibs` and `AMDGPUOpenMPToolChain::getDeviceLibs` and ROcm.h `allGenericLibsValid()`. That's sufficient to let me build and run openmp programs without rocm device libs installed at least, may have missed some.

Tagging Joseph, I can see libc also wanting a concise way to say "I want GPU libs (such as libc) but not the rocm device libs"
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8Vc2O2zgTfBr60rChof8POkw8mMDBFyQIku9OkS2pE4oUyKa9fvsFKTnjJLt78Q_FLlZXVVMqRuocYi2274SUH7w79RgZQ0tojZBSyJOQ8nufGgy7_H_7slCJex_q3zYvGm9u9bmFm09gvBNyz9CrC0LwegCDF9IIlpoI5CIra9FA9ANeewwI2irXgVYOWnIGuMdByNO8vGz9iG4YofUB1GC6MUFATsFFsX4W1Yuo7p-7qpS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