This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Don't make the ROCm conversions depend on the execution engine
ClosedPublic

Authored by krzysz00 on Jul 13 2023, 11:57 AM.

Details

Summary

During a conversion to MLIR_ENABLE_EXECUTION_ENGINE from checking for
the native target, the ROCm conversion passes (--serialize-to-hsaco)
were mistakenly flagged for being disabled if the execution ending is
not being built.

These passes use LLVM to build binaries for AMD GPUs, and so require
that backend to be enabled. However, they do not produce native code,
nor do they interact with the JIT or any of the execution engine
support libraries.

When building MLIR into a compiler library that's intended to produce
GPU binaries, we want to build only the AMDGPU backend and have the
binary serialization passes available. This change makes that
possible.

It looks like the CUDA path might currently require a native target,
it's hard to tell, so this commit leaves that if statement untouched.

Diff Detail

Event Timeline

krzysz00 created this revision.Jul 13 2023, 11:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 11:57 AM
krzysz00 requested review of this revision.Jul 13 2023, 11:57 AM
fmorac accepted this revision.Jul 13 2023, 12:20 PM

It looks good to me.

I think that condition was imposed at a time were OptUtils was a part of the ExecutionEngine lib see this comment:
https://github.com/llvm/llvm-project/blob/main/mlir/lib/ExecutionEngine/CMakeLists.txt#L17

Because it doesn't look like the serialization passes are dependent on the ExecutionEngine lib:
https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/GPU/CMakeLists.txt

This revision is now accepted and ready to land.Jul 13 2023, 12:20 PM
This revision was landed with ongoing or failed builds.Jul 13 2023, 1:40 PM
This revision was automatically updated to reflect the committed changes.