-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[TVMC] add the support of the cross compiler options #7922
Conversation
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.
The change looks OK to me. Apart from my comments below, is there a chance to add a test case for this PR?
python/tvm/driver/tvmc/compiler.py
Outdated
@@ -271,7 +277,7 @@ def save_module(module_path, graph, lib, params, cross=None): | |||
The parameters (weights) for the TVM module. | |||
cross : str or callable object, optional | |||
Function that performs the actual compilation | |||
|
|||
cross_options : sst of cross compilation options |
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.
Modifying it to comply with Numpy docstring format.
cross_options : sst of cross compilation options | |
cross_options : str, optional | |
Command line options to be passed to the cross compiler. |
python/tvm/driver/tvmc/compiler.py
Outdated
@@ -283,7 +289,7 @@ def save_module(module_path, graph, lib, params, cross=None): | |||
lib.export_library(path_lib) | |||
else: | |||
logger.debug("exporting library to %s , using cross compiler %s", path_lib, cross) | |||
lib.export_library(path_lib, cc.cross_compiler(cross)) | |||
lib.export_library(path_lib, cc.cross_compiler(cross, options=cross_options.split(' '))) |
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.
Maybe it makes sense to add the command line options to the debug message on the line above?
python/tvm/driver/tvmc/compiler.py
Outdated
def save_module(module_path, graph, lib, params, cross=None, | ||
cross_options=None): |
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.
def save_module(module_path, graph, lib, params, cross=None, | |
cross_options=None): | |
def save_module(module_path, graph, lib, params, cross=None, cross_options=None): |
I will do the update of the patch. Vincent |
I was referring to unit tests, just to try validate the API changes. The unit tests are currently hosted at - https://github.com/apache/tvm/tree/main/tests/python/driver/tvmc |
@leandron how do you execute the tests? |
Hi, sorry for the delay. I don't think this error is related to tvmc specifically. It probably has something to do with the way your TVM was built. Which LLVM version are you linking TVM with? |
@leandron the LLVM version I use is the v6.0.0. |
I see. I appreciate the docs mention "LLVM 4.0 or higher is needed for build with LLVM. Note that version of LLVM from default apt may lower than 4.0.", but I don't think we test with anything < LLVM 9. Probably something to investigate in a separate issue. Is that possible at all for your to try with some newer LLVM, like LLVM 11, which is the one we use in most of the CI jobs here? |
I just tested with LLVM v10 and it seems to work. |
9e6dcf3
to
a06f7bf
Compare
I have rebase the patch on the main branch and add tests. |
I think the linter is complaining about formatting on your patch (the log is here). You can check some command lines to run the exact same linter locally on your machine here: https://tvm.apache.org/docs/contribute/pull_request.html#submit-a-pull-request |
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.
LGTM, pending on formatting/linter fixes.
Add the possibility to provide the cross compiler options when using the tvmc compile functionality. With some cross compiler, toolchains --sysroot option (at least) need to be defined. tvmc/test_compile.py as been updated to introduce simple tests to validate the cross options functionnality. Signed-off-by: Vincent ABRIOU <vincent.abriou@st.com>
a06f7bf
to
189f9bb
Compare
@leandron formatting/linter fixed |
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.
LGTM
Thanks @vinceab! |
Add the possibility to provide the cross compiler options when using the tvmc compile functionality. With some cross compiler, toolchains --sysroot option (at least) need to be defined. tvmc/test_compile.py as been updated to introduce simple tests to validate the cross options functionnality. Signed-off-by: Vincent ABRIOU <vincent.abriou@st.com>
Add the possibility to provide the cross compiler options when using the tvmc compile functionality. With some cross compiler, toolchains --sysroot option (at least) need to be defined. tvmc/test_compile.py as been updated to introduce simple tests to validate the cross options functionnality. Signed-off-by: Vincent ABRIOU <vincent.abriou@st.com>
Add the possibility to provide the cross compiler options when using the
tvmc compile functionality.
With some cross compiler toolchains --sysroot option (at least) need to be defined.
@leandron