New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XLA/AOT Windows support #15213
Comments
/CC @tatatodd |
@rongjiecomputer seems you can compile tensorflow with bazel on windows, can you share how you get that? |
@argman Building Tensorflow with Bazel on Windows should work out of the box now.
If the build seems to stuck at compiling |
@tatatodd I managed to build First two PRs are at #15310 and #15335, but no reviews received. Can you help me to assign them to suitable reviewers? I can only send the third PR when #15229, #14893 and #14531 get merged (not by me). Once these PRs are merged, I will post a guide on how to write new Caveat:
|
@rongjiecomputer Thanks very much for all the work on Windows! I've responded to the outstanding PRs that I know of; feel free to ping if I've missed any. |
It has been 14 days with no activity and the |
Marking as community support, since @rongjiecomputer has already been sending many great PRs. |
Status update: Most of the changes needed to make https://github.com/rongjiecomputer/tensorflow-xla-aot-windows There are some obstacles that prevent XLA/AOT to work out of the box for Windows users:
It should be possible to build components of XLA/AOT with CMake, but unfortunately Tensorflow's CMake build scripts are written specifically for MSBuild. It just won't work with Ninja which I prefer. Any CMake expert is welcomed to bring XLA/AOT to CMake so that both LLVM and Tensorflow can be built together in CMake directly.
Any thoughts on this? My handcrafted BUILD.bazel is quite similar to the auto-generated llvm.BUILD. Since its purpose is to import prebuilt libraries, headers and some defines to Tensorflow, I think it is possible to make it works on Linux and Mac OS as well (the only problem is I don't have machines to test). Please do not close this issue yet. It is far from being "fixed". |
I previously use hacky BUILD file to import prebuilt LLVM binaries from CMake to Bazel so that I can build `tfcompile` with Bazel on Windows, but since Tensorflow updates the LLVM revision used very frequently, this method is too troublesome. I am trying to make XLA/AOT to work out-of-the-box on Windows with Bazel, then convince Tensorflow team to create a presubmit so that no one can break XLA/AOT on Windows anymore. Summary: - Remove unused `llvm_host_triple`. - Rename `cmake_vars` to `posix_cmake_vars` and create a new `win32_cmake_vars` as Windows is sufficiently different from other platforms. - Create `LLVM_DEFINES`, `LLVM_COPTS` and `LLVM_LINKOPTS` in `llvm.bzl` to set global compile/link flags for LLVM. - Create macro `llvm_cc_library` that wrap around `cc_library` to ensure that all targets receive `LLVM_COPTS` consistently. Replace all `cc_library` with `llvm_cc_library`. - For `support` library, include `lib/Support/Windows/*` for Windows and `lib/Support/Unix/*` for others. If `llvm.BUILD` is not to be edited manually no matter what, can the script used to generate `llvm.BUILD` be open-sourced? #15213 /cc @tatatodd Imported from GitHub PR #18293 Copybara import of the project: - a5e7b84 [XLA/AOT] Build LLVM with Bazel on Windows by Loo Rong Jie <loorongjie@gmail.com> - b3a20c7 Add back LLVM_ENABLE_STATS by Loo Rong Jie <loorongjie@gmail.com> - 787d451 Merge b3a20c7 into 6a1ff... by Loo Rong Jie <loorongjie@gmail.com> COPYBARA_INTEGRATE_REVIEW=#18293 from rongjiecomputer:llvm b3a20c7 PiperOrigin-RevId: 208073601
@rongjiecomputer @tatatodd @hawkinsp Any thoughts on possible next steps? |
@tellarin There was an issue in highwayhash in rongjiecomputer/tensorflow-xla-aot-windows#1 (comment) but I have not sent out the PR yet. I have not build XLA/AOT on Windows for awhile, so not sure if current master can be built with MSVC or not. (internal team occasionally write some template code that behaves differently with MSVC) |
It seems the function AllOf(...) in pattern_matcher.h doesn't compile with MSVC (in VS2017 or VS2019) or LLVM 8. |
I use |
/permissive- did the trick, the code can be compiled, thanks. |
In VS2019 /permissive does not work as of this post & master branch commit bd67e65 . |
@rongjiecomputer,
Please have a look and move this issue to closed status, if the issue was resolved. Thank you! |
This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. |
System information
Similar to #8310, but specifically about running
tfCompile
on Windows rather than Linux to producex86_64-windows-msvc
binaries.XLA/AOT depends on LLVM which has excellent Windows support via CMake, but Bazel cannot interop with CMake. llvm.BUILD is auto-generated and the script to generate it is not open-sourced, this make it difficult for external contributor to make improvement. tensorflow/compiler might not need too much changes as #9908 already addressed some of them.
One possible path is to let user to run CMake in host machine when invoking
configure.py
, then feed CMake generated files into custom script to generateLLVM.BUILD
.Note:
Rumour has it that there is a Google-internal tool called
tfNative
to generate.h/.cpp
files instead of.lib
binaries, though I suspect that even if the tool is open-sourced, it might not be immediately available for Windows developers.The text was updated successfully, but these errors were encountered: