-
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
allow libbacktrace to be used when cross compiling the runtime #7917
allow libbacktrace to be used when cross compiling the runtime #7917
Conversation
@areusch @tkonolige @leandron please help to review this PR |
CC @tkonolige @xiebaiyuan The issue is possibly related to #7705. |
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.
Thanks for this PR. As the default value for libbacktrace is AUTO
, this patch enables cross-compilation of the source in the original cloning state - great!
On a broader view, it would be awesome to also update the documentation such as https://tvm.apache.org/docs/install/from_source.html, with some guidance for cross-compilation as there are non-obvious steps to be taken, such as the need for -DCMAKE_HOST=...
to be populated, for example.
What do you think?
Yes, that would be really useful, specially if it uses TVMC rather than low level APIs, IMHO. |
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.
These changes look good to me.
btw, I tried these same changes when debugging #7705 but they did not fix it. |
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.
thanks @mherkazandjian for the PR! just one question, I agree with @leandron that it would be great to provide some docs.
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.
A few suggestions on the tutorial wording, feel free to decide whether you want to use it. @hogepodge recently did some work on tutorials and might be interested as well.
Apart from the suggestions, LGTM.
@leandron tnx for the feedback. actually the CI build is failing, i think the in the CI we (I) should modify the cmake flags so that |
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 happy to approve this PR. Did you check @tkonolige's comment about building with debug flags?
great. thank you. i have a question though, in the CI it looks like the arm build is failing |
@mherkazandjian I'm sorry it took me so long to remember this, but I don't think this PR will work on macOS. Here is what I had in my version of this:
Note that this solution is not quite correct. You probably want to set the sdk path to whatever the user set it to. |
hi @tkonolige
ok tnx for the update. |
@mherkazandjian We should not require |
@tkonolige i fixed the issue with the CI, the the macOS build seems to be passing following up on your comment #7917 (comment) if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND (CMAKE_C_COMPILER MATCHES "^/Library"
OR CMAKE_C_COMPILER MATCHES "^/Applications"))
set(c_compiler "/usr/bin/cc")
else()
set(c_compiler "${CMAKE_C_COMPILER}")
endif() |
@tqchen it looks like the docker daemon did not start in the CI instance |
@mherkazandjian i think the CI is having some trouble now, feel free to push an empty commit to retriever |
We put images into the https://github.com/tlc-pack/web-data repository. |
@hogepodge did you get a chance to look at the changes? i think this PR is good to go (the CI tests pass too) |
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.
You need a couple of changes to make the macOS workaround work.
gentle ping @mherkazandjian please follow up on the review comments and let us merge soon ! |
Hi @tqchen |
@tqchen i finished all the requested 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.
Throughout this document, there's a mix of using "we" and "you" to describe the process of building TVM. This should be reconciled, preferably to use the 3rd person. That may be a larger task for another PR. A number of other comments to help clarify language and usage.
@@ -14,14 +14,39 @@ | |||
# KIND, either express or implied. See the License for the | |||
# specific language governing permissions and limitations | |||
# under the License. | |||
|
|||
# On MacOS, the default C compiler (/usr/bin/cc) is actually a small script that dispatches to a | |||
# compiler the default SDK (usually /Library/Developer/CommandLineTools/usr/bin/ or |
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.
On MacOS, the default C compiler (/usr/bin/cc) is script that dispatches to the compiler
provided by the default SDK (usually /Library/Developer/CommandLineTools/usr/bin/ or
# needs. CMake makes this second compiler avaliable through the CMAKE_C_COMPILER variable, but it | ||
# does not make the necessary flags available. This leads to configuration errors in libbacktrace | ||
# because it can't find system libraries. Our solution is to detect if CMAKE_C_COMPILER lives in | ||
# /Library or /Applications and switch to the default compiler instead. |
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.
Our solution is to detect if CMAKE_C_COMPILER is installed in
- TVM runtime, which runs on the target devices. | ||
|
||
In order to integrate the compiled module, we **do not** need to build entire TVM on the target device. You only need to build the TVM compiler stack on your desktop and use that to cross-compile modules that are deployed on the target device. | ||
In order to integrate the compiled module, we **do not** need to build entire | ||
TVM on the target device. You only need to build the TVM compiler stack on your |
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 do not need to build the entire TVM project on the target device. Rather, we only need to build the TVM compiler stack on a host device and use that to cross-compile modules that can be deployed to a target device.
Thank you @mherkazandjian ! Thanks @tkonolige @hogepodge @areusch @leandron for reviewing |
This PR fixes issue #7916
to build for aarch64 the cmake variable
-DCMAKE_HOST=aarch64-linux-gnu
should be passed thatis in turn propagated to the autotools (configure step) for libbacktrace.
I tested this to build the runtime for
aarch64
andriscv64
, the runtime.so
was produced in bothcases with no errors displayed during the build.