Skip to content
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

[microTVM] Build standalone_crt with cmake instead of makefile #13600

Merged
merged 5 commits into from
Jan 5, 2023
Merged

[microTVM] Build standalone_crt with cmake instead of makefile #13600

merged 5 commits into from
Jan 5, 2023

Conversation

alanmacd
Copy link
Contributor

@alanmacd alanmacd commented Dec 12, 2022

Build standalone_crt with cmake instead of makefile to allow for better portability of microTVM code to other build environments.

fixes #13533

@tvm-bot
Copy link
Collaborator

tvm-bot commented Dec 12, 2022

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

@alanmacd alanmacd changed the title Build standalone_crt with cmake instead of makefile [microTVM] Build standalone_crt with cmake instead of makefile Dec 12, 2022
Copy link
Contributor

@leandron leandron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alanmacd, I think this makes the build process for standalone_crt much cleaner.

One comment I have is related to the python packaging mechanism. As part of packaging TVM will look for the standalone_crt directory (I think it is the copied one, as referred in #13533) to add the static files to the package. Can you double check whether that behaviour is also kept while you propose these changes?

The static files are needed so that users can integrate embedded projects only with the TVM installed from the package, rather than requiring the package+cloning apache/tvm repo.

tvm/python/setup.py

Lines 59 to 64 in b7015bb

# Add standalone_crt, if present
for name in lib_path:
candidate_path = os.path.join(os.path.dirname(name), "standalone_crt")
if os.path.isdir(candidate_path):
libs.append(candidate_path)
break

@alanmacd
Copy link
Contributor Author

The static files are needed so that users can integrate embedded projects only with the TVM installed from the package, rather than requiring the package+cloning apache/tvm repo.

tvm/python/setup.py

Lines 59 to 64 in b7015bb

# Add standalone_crt, if present
for name in lib_path:
candidate_path = os.path.join(os.path.dirname(name), "standalone_crt")
if os.path.isdir(candidate_path):
libs.append(candidate_path)
break

Thanks @leandron I will verify that files are placed in the same locations as previous done with the makefile version (I may have stashed the library files in slightly different locations)

Is there a specific way you typically invoke setup.py to exercise this feature or an example command that I should use to test?

@leandron
Copy link
Contributor

Is there a specific way you typically invoke setup.py to exercise this feature or an example command that I should use to test?

Build TVM with USE_MICRO ON, then cd python; python setup.py bdist_wheel.

Also, if that helps with context, the real use case would be following tlcpack steps https://github.com/tlc-pack/tlcpack

@alanmacd
Copy link
Contributor Author

python setup.py bdist_wheel

@leandron ok, it looks like it's only copying the standalone_crt directory into the wheel, I've updated my PR to not put the library binaries in the standalone_crt directory (matching the current TVM main), all the other files should be the same as I didn't change the standalone_crt file copy code.

@leandron
Copy link
Contributor

@leandron ok, it looks like it's only copying the standalone_crt directory into the wheel, I've updated my PR to not put the library binaries in the standalone_crt directory (matching the current TVM main), all the other files should be the same as I didn't change the standalone_crt file copy code.

thanks @alanmacd

@alanmacd alanmacd marked this pull request as ready for review December 14, 2022 18:21
cmake/modules/StandaloneCrt.cmake Show resolved Hide resolved
@areusch
Copy link
Contributor

areusch commented Jan 3, 2023

@leandron can you explicit approve if you're good w/ this?

@mehrdadh mehrdadh merged commit 39dbce1 into apache:main Jan 5, 2023
@mehrdadh
Copy link
Member

mehrdadh commented Jan 5, 2023

Given the time that this PR was open I will merge it.
@leandron @areusch thanks for the reviews!

@alanmacd alanmacd deleted the cmake-standalone-crt branch January 26, 2023 23:57
fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
…e#13600)

Build standalone_crt with cmake instead of makefile to allow for better portability of microTVM code to other build environments.

fixes apache#13533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] StandaloneCrt.cmake limits ability to enable microTVM build on other platforms
5 participants