Skip to content
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

Bazel build #155

Closed
wpieterse2825 opened this issue Feb 27, 2020 · 7 comments
Closed

Bazel build #155

wpieterse2825 opened this issue Feb 27, 2020 · 7 comments
Labels
bazel "Peripheral" support tier build system: utils/bazel question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@wpieterse2825
Copy link

Hi there, this is more a question than an issue. Would you people accept pull requests that makes it possible to build LLVM via Bazel? I know it's a long shot, and a lot of work, just wondering.

@r4nt
Copy link
Collaborator

r4nt commented Feb 27, 2020

I think this will be a "this depends" and the best way to get a feeling is to discuss what exactly you're planing on the llvm-dev mailing list.

@jpienaar
Copy link
Member

+1, looking forward to the discussion.

@samolisov
Copy link
Contributor

samolisov commented Feb 29, 2020

Dear all,

About a half of a year ago, there was a discussion in the dev list about using Bazel to build LLVM and someone (my apologies, I don't remember who exactly) proposed the following solution: to use CMake to build LLVM and then integrate the libraries into Bazel. This inspired me to develop a Bazel repository rule implementing this solution: https://github.com/samolisov/bazel-llvm-bridge

My goal was to use this in Tensorflow to speed up the build process: if you already have a local LLVM installation you don't need to build it again so that I support the same target names as tensorflow uses. Unfortunately this goal is not reachable: a RTTI-enabled build is required for TF while usually LLVM is built w/o RTTI and, what is more important, official releases are built in the same way. This was the reason for me to not support MLIR's target names from TF and to use the same schema as for LLVM.

What the project can: generate a Bazel workspace that contains all the LLVM, Clang and MLIR libraries including headers and supporting the dependency graph for them. A set of configuration .bzl files are generated to provide the user access to the details of the local installation, for example a set of supported backends (LLVM targets). Tablegen also can be used via a custom Bazel rule, I've tested it building the Toy examples with Bazel. Also a configuration header with the path to your local installation is also generated what can be usable for clang tools working on LLVM itself. More information you can find in Readme.md

Any your feedback is more than welcome. Thank you for your attention.

@joker-eph
Copy link
Collaborator

Is this bridge allowing to build LLVM or only use a prebuilt LLVM in a Bazel-based project?

@samolisov
Copy link
Contributor

samolisov commented Feb 29, 2020

@joker-eph both, the main idea is to use pre-built LLVM, but you can provide a name of the BUILD file and the bridge will use it to build LLVM from sources but the file is not shipped with the bridge. The BUILD file can be found in Tensorflow: https://github.com/tensorflow/tensorflow/blob/master/third_party/llvm/llvm.autogenerated.BUILD I document the use-cases in Readme.

@arsenm
Copy link
Contributor

arsenm commented Aug 14, 2023

Something like this would need to be an RFC to discourse

@arsenm arsenm closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2023
@EugeneZelenko EugeneZelenko added question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! bazel "Peripheral" support tier build system: utils/bazel and removed cmake Build system in general and CMake in particular labels Aug 14, 2023
@joker-eph
Copy link
Collaborator

This has been implemented since I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

9 participants