This is an archive of the discontinued LLVM Phabricator instance.

[MLGO] Improved support for AOT cross-targeting scenarios
ClosedPublic

Authored by mtrofin on Jan 19 2022, 11:07 PM.

Details

Summary

The tensorflow AOT compiler can cross-target, but it can't run on (for
example) arm64. We added earlier support where the AOT-ed header and object
would be built on a separate builder and then passed at build time to
a build host where the AOT compiler can't run, but clang can be otherwise
built.

To simplify such scenarios given we now support more than one AOT-able
case (regalloc and inliner), we make the AOT scenario centered on whether
files are generated, case by case (this includes the "passed from a
different builder" scenario).
This means we shouldn't need an 'umbrella' LLVM_HAVE_TF_AOT, in favor of
case by case control. A builder can opt out of an AOT case by passing that case's
model path as none. Note that the overrides still take precedence.

This patch controls conditional compilation with case-specific flags,
which can be enabled locally, for the component where those are
available. We still keep an overall flag for some tests.

The 'development/training' mode is unchanged, because there the model is
passed from the command line and interpreted.

Diff Detail

Event Timeline

mtrofin created this revision.Jan 19 2022, 11:07 PM
mtrofin requested review of this revision.Jan 19 2022, 11:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2022, 11:08 PM
phosek accepted this revision.Jan 19 2022, 11:46 PM

LGTM

llvm/CMakeLists.txt
896–897

I think this could be elif?

904–905

The same here?

llvm/cmake/modules/TensorFlowCompile.cmake
47–59

This is unrelated to this change, but since you're already modifying this function, I'd also consider renaming it to tf_compile to match other tf_* functions.

85

I'd probably use STATUS level for this.

90

I'd probably use STATUS level for this.

This revision is now accepted and ready to land.Jan 19 2022, 11:46 PM
mtrofin updated this revision to Diff 401629.Jan 20 2022, 7:05 AM
mtrofin marked 5 inline comments as done.

feedback & rebase

This revision was landed with ongoing or failed builds.Jan 20 2022, 7:06 AM
This revision was automatically updated to reflect the committed changes.