-
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
[Hexagon] Support fetching and building Hexagon runtime with external runtime sources #13138
Conversation
…ware features used by external libs.
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment. Generated by tvm-bot |
|
||
# Include hexagon external library runtime sources | ||
if(DEFINED USE_HEXAGON_EXTERNAL_LIBS) | ||
if (EXISTS ${USE_HEXAGON_EXTERNAL_LIBS}) |
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 a bit confused here. If we get here, USE_HEXAGON_EXTERNAL_LIBS exists, yes? When would line 188 be false?
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 should clear this up with a comment, thank you. EXISTS here is checking to see if USE_HEXAGON_EXTERNAL_LIBS is a path that is resolvable on the system. If it is a local path then it will use the path to the local install of external libs. EXISTS will return false when it's not a path, e.g. if it is a git url or malformed.
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.
Looks good, with a question and a comment
cmake/modules/Hexagon.cmake
Outdated
list(APPEND RUNTIME_HEXAGON_SRCS "${HEXAGON_EXTERNAL_RUNTIME_SRCS}") | ||
set_source_files_properties( | ||
"${HEXAGON_EXTERNAL_RUNTIME_SRCS}" | ||
PROPERTIES COMPILE_FLAGS "-mhvx -mhmx" |
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.
Could these properties specific to the external private repro be define there, and this pulls them in from a known sub-location within an external repo? (So that each private repo could customize flags inside itself.)
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 was wondering the same also yesterday.
One option, that I personally prefer not to rely on, is to not allow external sources and require the external libs to fully manage their own build to object files which are linked in.
Another option that comes to mind would be to do a cmake include on a required hexagon_external.cmake in the external lib. I haven't explored the feasibility of this option but it could work.
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.
Thank you for the good feedback, 18fe01c takes your suggestion of optionally including an external library defined cmake config file which defines these compiler flags. The risk we run is keeping these synchronized across repos, but as long as the footprint stays microscopic (ie just a single shared variable name) it should be manageable.
by defining HEXAGON_EXTERNAL_LIBS_COMPILE_FLAGS in a top level HexagonExternalCompileFlags.cmake config file which is conditionally included if it exists.
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!
… runtime sources (apache#13138) * Support fetching and building Hexagon runtime with external runtime sources. * Ensure compiler flags are set to cover potential uses of Hexagon hardware features used by external libs. * Add libinfo entries for USE_HEXAGON_EXTERNAL_LIBS. * Better document options for external libs. * Allow external hexagon libs to specify their own compile flags by defining HEXAGON_EXTERNAL_LIBS_COMPILE_FLAGS in a top level HexagonExternalCompileFlags.cmake config file which is conditionally included if it exists. * Check for USE_HEXAGON_EXTERNAL_LIBS triviality.
… runtime sources (apache#13138) * Support fetching and building Hexagon runtime with external runtime sources. * Ensure compiler flags are set to cover potential uses of Hexagon hardware features used by external libs. * Add libinfo entries for USE_HEXAGON_EXTERNAL_LIBS. * Better document options for external libs. * Allow external hexagon libs to specify their own compile flags by defining HEXAGON_EXTERNAL_LIBS_COMPILE_FLAGS in a top level HexagonExternalCompileFlags.cmake config file which is conditionally included if it exists. * Check for USE_HEXAGON_EXTERNAL_LIBS triviality.
It can be desirable to incorporate external source libraries for Hexagon which are maintained outside of upstream TVM. This PR enables the cmake tvm option
USE_HEXAGON_EXTERNAL_LIBS
which can point to an external git repo containing runtime sources insrc/runtime/hexagon
for compilation along with the Hexagon TVM runtime.When a git repo url is used, a SHA is required to be specified as well. Any source controlled use of TVM for benchmarking should commit the SHA used for reproducibility in the respective benchmarking repository -- and explicitly not in TVM.
cc @kparzysz-quic @mehrdadh @adstraw @janetsc @supersat @nverke