You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Good catches! We are still working to get the public build working (mostly stalled on figuring out a good way to build Tensorflow via cmake, as it currently only has bazel files), and once we have it working we'll be setting up a CI to ensure it remains buildable on Windows, Linux, and MacOS.
We use bazel internally and will be adding the build files to the public repo, but wanted to force ourselves to get cmake working first so that it's easier to consume the project (at least the runtime parts) from a non-bazel world. Worst case if we can't get Tensorflow building from cmake we'll have the compiler build with bazel but the runtime parts linked into applications will not need bazel at all.
We hope to have the compiler figured out in the next week or so (unless you or someone who has done things like this knows of any solutions!), and we'll update this issue as we make progress.
Update: much closer to building now - the iree-translate binary should build (at least on Windows) but there are still a few missing pieces:
SPIR-V translation (needs glslang CMake build/rules for handwritten kernels)
Flatbuffer writing/embedding rules to run the samples (invoke iree-translate and then embed the resulting binary in a header)
Non-TODO'ed ALWAYSLINK to prevent the need to pass all libs everywhere (for static registration)
lit test wrapper that makes proper ctests for CMake testing
I'll try to get these in this weekend at which point we should have the full end-to-end going. @ScottTodd is working on getting Swiftshader setup so that we can have the full Vulkan + SPIR-V path tested on CI's without GPUs, at which point we'll setup github actions (probably) for all platforms that perform the builds and run all tests.
You're correct about the flow - we lower through XLA HLO and then allow the backends to do what they want with that. So for the dot in your example above we lower that to an interpreter matmul_f op when we are running on the CPU (which then uses Ruy to perform the GEMM) but in SPIR-V land we (today) lower it to a handwritten kernel (https://github.com/google/iree/blob/master/iree/compiler/Translation/SPIRV/Kernels/matmul.comp). xla_hlo.dot is special, though, and currently the only op we have a handwritten kernel for. All other ops are automatically generated into SPIR-V.
This is because GEMMs are the most performance heavy op we have and it's not clear that the automatic lowering will be able to achieve matching performance for awhile (if ever). There's also a lot of vendor-specific magic that we want to take advantage of such as Nvidia's cooperative matrix extension (which would be even more difficult to generate code for).
So the idea is that we can optionally have handwritten implementations but default to generating automatically. An improvement that will be added soon is fusing into the handwritten kernels so that we can merge generated and handwritten IR. Over time we could hopefully remove all handwritten kernels (which, again today is just xla_hlo.dot).
cc1plus: warning: command line option ‘-Wno-strict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: unrecognized command line option ‘-Wno-documentation-unknown-command’
cc1plus: warning: unrecognized command line option ‘-Wno-documentation’
cc1plus: warning: unrecognized command line option ‘-Wno-gnu-label-as-value’
cc1plus: warning: unrecognized command line option ‘-Wno-missing-variable-declarations’
cc1plus: warning: unrecognized command line option ‘-Wno-unused-private-field’
cc1plus: warning: unrecognized command line option ‘-Wno-unreachable-code-return’
cc1plus: warning: unrecognized command line option ‘-Wno-shadow-field-in-constructor’
cc1plus: warning: unrecognized command line option ‘-Wno-gnu-zero-variadic-macro-arguments’
cc1plus: warning: unrecognized command line option ‘-Wno-shadow-uncaptured-local’
cc1plus: warning: unrecognized command line option ‘-Wno-unused-local-typedef’
the problem accurs when some third party package has "Werror" flag, in this case the build fails.
My workaround was to add "-Wno-error" to the end of the CMAKE_CXX_FLAGS.
@benvanik The iree-translate binary also builds under Linux (using clang). Anyway, the CMakeLists.txt files need some tweaking to get the build running. If there is interested, I can submit PRs within the next week for the patches I have written so far.
If you've got tweaks to the cmake configs to make things build with clang, we'd happily accept PRs. I'm working on getting us some proper CI on the OSS side so that we can stay on top of these.
FYI we now have a cmake CI, although it excludes the compiler portion of IREE (and therefore the MLIR dependencies). When we do get them working, I can change the option to add these to the CI.
Activity
[-]CMale build issues on Linux.[/-][+]CMake build issues on Linux.[/+]benvanik commentedon Oct 1, 2019
Hi! Good catches! We are still working to get the public build working (mostly stalled on figuring out a good way to build Tensorflow via cmake, as it currently only has bazel files), and once we have it working we'll be setting up a CI to ensure it remains buildable on Windows, Linux, and MacOS.
We use bazel internally and will be adding the build files to the public repo, but wanted to force ourselves to get cmake working first so that it's easier to consume the project (at least the runtime parts) from a non-bazel world. Worst case if we can't get Tensorflow building from cmake we'll have the compiler build with bazel but the runtime parts linked into applications will not need bazel at all.
We hope to have the compiler figured out in the next week or so (unless you or someone who has done things like this knows of any solutions!), and we'll update this issue as we make progress.
denis0x0D commentedon Oct 1, 2019
@benvanik thanks for the quick reply! This is good to know!
Rollup of fixes for MSVC and CMake build.
benvanik commentedon Oct 3, 2019
Update: much closer to building now - the iree-translate binary should build (at least on Windows) but there are still a few missing pieces:
I'll try to get these in this weekend at which point we should have the full end-to-end going. @ScottTodd is working on getting Swiftshader setup so that we can have the full Vulkan + SPIR-V path tested on CI's without GPUs, at which point we'll setup github actions (probably) for all platforms that perform the builds and run all tests.
denis0x0D commentedon Oct 4, 2019
@benvanik can you please clarify on "handwritten" kernels, sorry if it's a not right thread.
As far as I understood, plese fix me if I'm wrong, in general, loweing pipeline is:
TF Dialect (legalize, full convertion) -> XLA Dialect (legalize, partial convertion) -> IREE High level (legalize, full) -> IREE Low level.
I've skipped some passes which are described here https://github.com/google/iree/blob/master/iree/compiler/Translation/Sequencer/SequencerModuleTranslation.cpp#L217
The result module is splitted on regions and for example some region could have math operation like "dot"
So, on the next stage of lowering it could be possible to lower "dot" into MLIR SPIR-V or instead specify to use "handwritten" kernel?
Thanks.
benvanik commentedon Oct 4, 2019
You're correct about the flow - we lower through XLA HLO and then allow the backends to do what they want with that. So for the dot in your example above we lower that to an interpreter matmul_f op when we are running on the CPU (which then uses Ruy to perform the GEMM) but in SPIR-V land we (today) lower it to a handwritten kernel (https://github.com/google/iree/blob/master/iree/compiler/Translation/SPIRV/Kernels/matmul.comp). xla_hlo.dot is special, though, and currently the only op we have a handwritten kernel for. All other ops are automatically generated into SPIR-V.
This is because GEMMs are the most performance heavy op we have and it's not clear that the automatic lowering will be able to achieve matching performance for awhile (if ever). There's also a lot of vendor-specific magic that we want to take advantage of such as Nvidia's cooperative matrix extension (which would be even more difficult to generate code for).
So the idea is that we can optionally have handwritten implementations but default to generating automatically. An improvement that will be added soon is fusing into the handwritten kernels so that we can merge generated and handwritten IR. Over time we could hopefully remove all handwritten kernels (which, again today is just xla_hlo.dot).
denis0x0D commentedon Oct 4, 2019
@benvanik thanks for detailed explanation!
denis0x0D commentedon Oct 19, 2019
@benvanik I'm not sure is ok to report some build issue or not, since it still under development, please let me know if it's not needed.
the problem accurs when some third party package has "Werror" flag, in this case the build fails.
My workaround was to add "-Wno-error" to the end of the CMAKE_CXX_FLAGS.
ScottTodd commentedon Oct 22, 2019
Build issues are still useful to track, thanks for trying what exists so far!
Yes, the flags aren't compatible with gcc. We've primarily been using clang.
denis0x0D commentedon Oct 22, 2019
@ScottTodd got it, thanks!
marbre commentedon Nov 15, 2019
@benvanik The iree-translate binary also builds under Linux (using clang). Anyway, the CMakeLists.txt files need some tweaking to get the build running. If there is interested, I can submit PRs within the next week for the patches I have written so far.
GMNGeoffrey commentedon Nov 15, 2019
If you've got tweaks to the cmake configs to make things build with clang, we'd happily accept PRs. I'm working on getting us some proper CI on the OSS side so that we can stay on top of these.
GMNGeoffrey commentedon Nov 21, 2019
FYI we now have a cmake CI, although it excludes the compiler portion of IREE (and therefore the MLIR dependencies). When we do get them working, I can change the option to add these to the CI.
Fix compiler flags for GCC
ScottTodd commentedon Mar 24, 2020
Let's close this issue, as most of the problems in the initial report have been resolved.
Sign-aware Op Value Predemotion (iree-org#6)
Fail the build to post to discord (iree-org#6)
Fix bytecode module leak in iree-run-mlir. (#14774)
some changes to enable python package without wheel (iree-org#6)
Address crash in iree-reduce with complex tensors (#24674)