[MLIR][GPU] Link in device libraries during HSA compilation if needed

To perform some operations, such as sin() or printf(), code compiled
for AMD GPUs must be linked to a series of device libraries. This
commit adds support for linking in these libraries.

However, since these device libraries are delivered as LLVM bitcode,
raising the possibility of version incompatibilities, this commit only
links in libraries when the functions from those libraries are called
by the code being compiled.

This code also sets the math flags to their most conservative values,
as MLIR doesn't have a `-ffast-math` equivalent.

Depends on D114114

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D114117

GitOrigin-RevId: a6f53afbcb4d995139064276b5ad971ad7ced5e2
2 files changed
tree: 28cdc9e9c78955ae25e4da18e13b8f321a0b0962
  1. cmake/
  2. docs/
  3. examples/
  4. include/
  5. lib/
  6. python/
  7. test/
  8. tools/
  9. unittests/
  10. utils/
  11. .clang-format
  12. .clang-tidy
  13. CMakeLists.txt
  14. LICENSE.TXT
  15. README.md
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.