Skip to content

Fix windows iree+tensorflow build and verify tests.#2035

Closed
stellaraccident wants to merge 5 commits intoiree-org:masterfrom
stellaraccident:winfix2
Closed

Fix windows iree+tensorflow build and verify tests.#2035
stellaraccident wants to merge 5 commits intoiree-org:masterfrom
stellaraccident:winfix2

Conversation

@stellaraccident
Copy link
Copy Markdown
Collaborator

  • Switches us to MSVC for the supported windows compiler.
  • Uses a couple of magic flags that keep the TF kernels from taking a lot of time to compile and inlining the world to bloat the binary size.
  • The whole shebang builds for me now in a few minutes and produces a ~76MB compiler binary. While large, this is manageable for now.
  • We still have a fragile relationship with which TF kernels are compiled in and what we can subsequently handle (relying on constant folding to paper over op support issues). We'll need to triage these one by one.
  • There are a couple of bugs that seem MSVC/Windows specific -- will need to track down.

* Switches us to MSVC for the supported windows compiler.
* Uses a couple of magic flags that keep the TF kernels from taking a lot of time to compile and inlining the world to bloat the binary size.
* The whole shebang builds for me now in a few minutes and produces a ~76MB compiler binary. While large, this is manageable for now.
* We still have a fragile relationship with which TF kernels are compiled in and what we can subsequently handle (relying on constant folding to paper over op support issues). We'll need to triage these one by one.
* There are a couple of bugs that seem MSVC/Windows specific -- will need to track down.
Comment thread .bazelrc Outdated
Comment thread .bazelrc
Comment thread .bazelrc Outdated
Comment thread .bazelrc
Comment thread .bazelrc Outdated
Comment thread configure_bazel.py
@stellaraccident
Copy link
Copy Markdown
Collaborator Author

PTAL

@antiagainst
Copy link
Copy Markdown
Member

Yay! No need to set the env beforehand is nice. I kinda always forget that. (Mostly using CMake though.)

@ScottTodd ScottTodd added bazel integrations/tensorflow TensorFlow model import and conversion platform/windows 🚪 Windows-specific build, execution, benchmarking, and deployment labels May 28, 2020
Comment thread configure_bazel.py
Comment thread .bazelrc
build:rs --project_id=iree-oss

###############################################################################
# Windows specific flags for building with VC.
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.

This is awesome :D

I tested locally (threadripper 3970x so unfair comparison with other CPUs).

My builds before this were ~1h, with nearly all of the time spent compiling a long tail of TF kernels on a few threads. The build would run in parallel efficiently for ~10 minutes then be basically idle working on ~8 kernel files for 50 minutes.

Test steps (using Colab as the target since it pulls in most of the relevant deps):

bazel clean --expunge
python3 configure_bazel.py
python3 .\colab\start_colab_kernel.py

user.bazelrc (note that I use separate caches and output_user_root for separate repositories/branches to try to keep as much state cached per branch as possible)

startup --output_user_root=D:/dev/cache/bazeluserroot
build --disk_cache=D:/dev/cache/bazelcache --experimental_guard_against_concurrent_changes
build:debug --compilation_mode=dbg --copt=/O2 --per_file_copt=iree@/Od --strip=never
build --define=iree_tensorflow=true

Timing:

8:58 start
  300s "Fetching @aws;"
9:03 finished fetching, build running (128 actions in parallel)
9:04 821/2656
9:05 3747/4793 (working on tf targets)
9:06 4005/4793 (tf kernels, core/util/batch_util.cc)
9:07 4885/5342 (starting llvm/lib/CodeGen/...)
9:08 5275/5726 (more LLVM)
9:09 5893/6256 (LLVM, MLIR, IREE)
9:10 6693/6842 (IREE, XLA, MLIR, linking IREE python bindings)
finished 9:10

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.

(super scientific :P looks like https://docs.bazel.build/versions/master/skylark/performance.html#profile-and-analyze-profile would give more concrete data)

Comment thread docs/GetStarted/getting_started_linux_bazel.md
Comment thread docs/GetStarted/getting_started_windows_bazel.md
$ git clone https://github.com/google/iree.git
$ cd iree
$ git submodule update --init
$ git submodule update --initss
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.

Is there a typo here now? (this is pending merge, can fixup after)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ugh. for some reason vscode stopped accepting ctrl+s and I was looking everywhere for where the extra 's''s went. sorry :(

@GMNGeoffrey GMNGeoffrey added the infrastructure Relating to build systems, CI, or testing label May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Relating to build systems, CI, or testing integrations/tensorflow TensorFlow model import and conversion platform/windows 🚪 Windows-specific build, execution, benchmarking, and deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants