Skip to content

Remove TF dependency from IREE core - #4450

Merged
GMNGeoffrey merged 17 commits into
iree-org:mainfrom
GMNGeoffrey:no-tf-in-core
Jan 13, 2021
Merged

GMNGeoffrey merged 17 commits into
iree-org:mainfrom
GMNGeoffrey:no-tf-in-core

Conversation

@GMNGeoffrey

@GMNGeoffrey GMNGeoffrey commented Jan 9, 2021 •

Copy link
Copy Markdown
Member

This completely strips TensorFlow as a dependency of the core part of
IREE (basically everything other than integrations/). TF integrations
are in a separate workspace under integrations/tensorflow.

We still depend on mlir-hlo, which is exported as part of the TF repo,
but also available as the https://github.com/tensorflow/mlir-hlo
repository, which we use here as a submodule. To avoid ODR issues, when
built with integrations TensorFlow we define @mlir-hlo to contain
aliases for the rules present in TF.

Fixes #4480
Fixes #3312
Most of #3311 (leaving open for
cleanup work)

@google-cla google-cla Bot added the cla: yes label Jan 9, 2021
@benvanik

benvanik commented Jan 9, 2021

Copy link
Copy Markdown
Collaborator

mmmm

@benvanik

benvanik commented Jan 9, 2021

Copy link
Copy Markdown
Collaborator

LGTM - this makes it really clear where the entire integrations/tensorflow/ dir could be split (if/when we want to) - very cool!

@GMNGeoffrey
GMNGeoffrey marked this pull request as draft January 9, 2021 02:13
// limitations under the License.

#include "integrations/tensorflow/compiler/Passes.h"
#include "compiler/Passes.h"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not great. We probably want to deepen the directory path by one level so we have a unique-ish top-level path segment. ie. move everything in integrations/tensorflow down by one level under a new iree_tensorflow directory.

Can do in a follow-up if needed, I guess.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed. I was just doing the changes to make it build, but I don't like this at all

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just renaming the compiler/ directory to iree_tf_compiler?

@GMNGeoffrey

GMNGeoffrey commented Jan 11, 2021 •

Copy link
Copy Markdown
Member Author

Still TODO:

  • Better include paths in integrations. Bare "compiler/" is icky
  • Probably want to make the cmake target names include TF in there somewhere as well.
  • Clean up commit history after the next google -> main (I need the latest mlir-hlo)
  • Encapsulate some of the iree-dep creation in macros. Lot of copypasta there
  • Rebase after Delete obsolete Bazel Python configuration #4431 is merged

@GMNGeoffrey

Copy link
Copy Markdown
Member Author

I gave up on preserving history and squashed this down to a single commit

@GMNGeoffrey
GMNGeoffrey marked this pull request as ready for review January 12, 2021 07:25

@stellaraccident stellaraccident left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. If it works, I have nothing to add :)

@marbre

marbre commented Jan 12, 2021

Copy link
Copy Markdown
Member

Awesome Geoffrey! One minor remark: Also with the alias set, does @mlir-hlo//:hlo needs to be handled in bazel_to_cmake?

@GMNGeoffrey

Copy link
Copy Markdown
Member Author

Awesome Geoffrey! One minor remark: Also with the alias set, does @mlir-hlo//:hlo needs to be handled in bazel_to_cmake?

Huh... yeah it should be. I'm confused why the bazel_to_cmake check isn't failing though...

@marbre

marbre commented Jan 12, 2021

Copy link
Copy Markdown
Member

Awesome Geoffrey! One minor remark: Also with the alias set, does @mlir-hlo//:hlo needs to be handled in bazel_to_cmake?

Huh... yeah it should be. I'm confused why the bazel_to_cmake check isn't failing though...

Well I think we only check if there is a diff. bazel_to_cmake just skips those files e.g.:

 Failed to convert iree/compiler/Dialect/VMLA/Conversion/HLOToVMLA/BUILD. Missing a conversion in bazel_to_cmake_targets.py?
  Reason: `KeyError: "No conversion found for target '@mlir-hlo//:hlo'"`

@GMNGeoffrey

Copy link
Copy Markdown
Member Author

Awesome Geoffrey! One minor remark: Also with the alias set, does @mlir-hlo//:hlo needs to be handled in bazel_to_cmake?

Huh... yeah it should be. I'm confused why the bazel_to_cmake check isn't failing though...

Well I think we only check if there is a diff. bazel_to_cmake just skips those files e.g.:

 Failed to convert iree/compiler/Dialect/VMLA/Conversion/HLOToVMLA/BUILD. Missing a conversion in bazel_to_cmake_targets.py?
  Reason: `KeyError: "No conversion found for target '@mlir-hlo//:hlo'"`

ARGH it should be failing on those I thought. Thanks for catching this

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread .gitignore Resolved
Comment thread build_tools/bazel/workspace.bzl Resolved
@GMNGeoffrey

Copy link
Copy Markdown
Member Author

Just scanned a few files...

Do you expect this to change the developer instructions for building IREE with Bazel/CMake?

e.g.
google.github.io/iree/get-started/getting-started-linux-bazel
google.github.io/iree/get-started/getting-started-linux-cmake

(the python docs are due for a total rewrite anyway :P)

Neither of those docs should require a change other than we might be able to get rid of some dependencies (which I'm planning to do there and in our docker containers as part of the follow-on cleanup to this).

@GMNGeoffrey
GMNGeoffrey merged commit f5b323e into iree-org:main Jan 13, 2021
@GMNGeoffrey
GMNGeoffrey deleted the no-tf-in-core branch January 13, 2021 02:32
@GMNGeoffrey GMNGeoffrey mentioned this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bazel-inside-Cmake breaks Bazel interactive builds Integrate mlir-hlo repository

5 participants