[MLIR][GPU] Run generic LLVM optimizations when serializing (on AMD)

- Adds hooks that allow SerializeTo* passes to arbitrarily transform
the produced LLVM Module before it is passed to the code generation
passes.

- Uses these hooks within the SerializeToHsaco pass in order to run
LLVM optimizations and to set the optimization level on the
TargetMachine.

- Adds an optLevel parameter to SerializeToHsaco

Future work may include moving much of what's been added to
SerializeToHsaco to SerializeToBlob, but that would require
confirmation from the NVVM backend maintainers that it would be
appropriate to do so.

Depends on D114107

Reviewed By: mehdi_amini

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

GitOrigin-RevId: bd22554af06e1f16dc9ff12eac8987f0ceebe8c1
4 files changed
tree: 363918332fe9acb863050dcc822bd9c56f649303
  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.