-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add dependencies for onnx-mlir to tt-mlir project linked aga… #261
Conversation
env/build-requirements.txt
Outdated
@@ -6,3 +6,4 @@ wheel | |||
setuptools | |||
black | |||
pre-commit | |||
onnx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onnx is a dependency for onnx-mlir project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not listed as a dependency in their project requirements. They really require python to run their optimizer driver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something I found by building it that it requires onnx at least for Mac OSX build, I suspect they forgot to mention in the project requirements.
env/CMakeLists.txt
Outdated
GIT_TAG ${ONNX_MLIR_VERSION} | ||
GIT_SUBMODULES_RECURSE true | ||
DEPENDS python-venv | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ExternalProject_Add
should be moved to the third_party
subdirectory. I think we should:
git mv third_party/CMakeLists.txt third_party/tt-metal.cmake
You should create third_party/onnx-mlir.cmake
along with a new CMakeLists.txt
:
include(tt-metal)
if (TTMLIR_ENABLE_ONNX_MLIR)
include(onnx-mlir)
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok got it, let me update with the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uazizTT, this is awesome! A few requests inline. The env
and third_party
directories are a bit confusing, but generally I split it up this way:
env
: Hard dependencies of tt-mlir, infrequently update. Should be thought of as the toolchain needed to do any development with tt-mlir.third_party
: Soft dependencies that add functionality to tt-mlir, potentially frequently updated.
Another reason, is that the idea for env
is that it could be cached (and it is in GitHub CI). If any file changes under env/
then the hash changes, so we really want to be deliberate in adding / updating files in this area because llvm is relatively expensive to rebuild.
Ok thanks for the breakdown. I don't think onnx-mlir will be updated frequently but yes we can categorize it as a soft dependency. Let me move it to third-party directory. |
env/CMakeLists.txt
Outdated
-DCMAKE_CXX_COMPILER=/usr/bin/c++ | ||
-DPython3_ROOT_DIR=$pythonLocation | ||
-DMLIR_DIR=${TTMLIR_TOOLCHAIN_DIR}/llvm-project/build/lib/cmake/mlir | ||
-DCMAKE_INSTALL_PREFIX=${TTMLIR_TOOLCHAIN_DIR} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also add -DONNX_MLIR_BUILD_TESTS=OFF -DONNX_MLIR_ENABLE_JAVA=OFF
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since build tests are disable, so package onnx is not required anymore, so I removed it from dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with requested changes.
env/build-requirements.txt
Outdated
@@ -6,3 +6,4 @@ wheel | |||
setuptools | |||
black | |||
pre-commit | |||
onnx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not listed as a dependency in their project requirements. They really require python to run their optimizer driver?
third_party/tt-metal.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's just the way that GitHub renders the PR, but this should be a git mv third_party/CMakeLists.txt third_party/tt-metal.cmake
so that the blame and history remains intact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I am moving content from CMakeLists to tt-metal.cmake and at the same time adding new content to CMakeLists, so that's why it is not recognizing it as a move.
third_party/CMakeLists.txt
Outdated
@@ -1,73 +1,6 @@ | |||
include(ExternalProject) | |||
option(TTMLIR_ENABLE_ONNX_MLIR "Enable ONNX MLIR support" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this option to the top level CMakeLists.txt
and also enable it in the "Configure CMake" step of .github/workflows/build.yml
so that CI can test onnx conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I can move it to CMakeLists.txt. I will add it to build.yml in order to guard against any future changes to LLVM versions that might break the onnx-mlir build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the requested changes
Nice changes, please fix the PR title and description. Same goes for the first commit. Here is a guide I usually follow. |
third_party/onnx-mlir.cmake
Outdated
PREFIX ${TTMLIR_TOOLCHAIN_DIR} | ||
CMAKE_GENERATOR Ninja | ||
CMAKE_ARGS | ||
-DCMAKE_CXX_COMPILER=/usr/bin/c++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be ${CMAKE_CXX_COMPILER}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the onnx build docs they suggest using this compiler on macOS, I think it's just clang, but in some kind of compatibility mode. That said we should see test we really need it, might be sufficient to use regular clang.
96a7c41
to
2e7b420
Compare
third_party/onnx-mlir.cmake
Outdated
CMAKE_GENERATOR Ninja | ||
CMAKE_ARGS | ||
-DCMAKE_CXX_COMPILER=/usr/bin/c++ | ||
-DPython3_ROOT_DIR=$pythonLocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this line is legal cmake syntax. I think $pythonLocation
refers to some environment variable the suggest setting in their build docs, but they were running a bash command, I think this line gets evaluated by cmake before it constructs the underlying shell string.
third_party/tt-metal.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, this should be a git mv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did use 'git mv' for this but it doesn't show as such, probably because I am not just moving content from CMakeLists to tt-metal.cmake but also adding new content to CMakeLists at the same time.
2e7b420
to
c5d652b
Compare
…tor third_party build to accomodate multiple soft dependencies.
c5d652b
to
3b19a4d
Compare
c49499d
to
d213074
Compare
d213074
to
1a321b6
Compare
@@ -45,6 +45,7 @@ ExternalProject_Add( | |||
-DPython3_EXECUTABLE=${TTMLIR_TOOLCHAIN_DIR}/venv/bin/python | |||
-DCMAKE_INSTALL_PREFIX=${TTMLIR_TOOLCHAIN_DIR} | |||
-DLLVM_ENABLE_PROJECTS=mlir | |||
-DLLVM_ENABLE_RTTI=ON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooof, this sucks :(
Ok this is actually in deal breaker territory, let's meet next week to discuss our options. I'll also file an issue on onnx-mlir to see if they ever plan on removing this requirement: onnx/onnx-mlir#2897
…inst a specific version of llvm