Skip to content

Conversation

@mehrdadh
Copy link
Member

This PR:

  • adds platform version check to both Arduino and Zephyr
  • adds macro for version in different files to make it easier to find when update is needed.

@mehrdadh
Copy link
Member Author

cc @areusch @gromero @guberti

def generate_project(self, model_library_format_path, standalone_crt_dir, project_dir, options):
# Check Arduino version
version = self._get_platform_version(options["arduino_cli_cmd"])
if version != ARDUINO_CLI_VERSION:
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not sure we should do an exact match check. cc @guberti do you have a better suggestion as to how loose we should be? i could even just be okay with a warning

Copy link
Member Author

Choose a reason for hiding this comment

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

I think two levels of version, Major + Minor, is enough. We don't need to check the patch level version since they usually don't change interfaces. I discussed this with @gromero and that seems to be the case for Zephyr. For Arduino I got the same impression based on their release messages: https://github.com/arduino/arduino-cli/releases
@guberti probably has more info here.

Copy link
Member

Choose a reason for hiding this comment

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

Yea the Arduino CLI seems to be relatively stable - this looks fine to me.

Copy link
Contributor

@gromero gromero left a comment

Choose a reason for hiding this comment

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

Hi @mehrdadh Only regarding the Zephyr platform changes and considering the nit pointed by Andrew is fixed, LGTM! I think that's a nice enhancement and that it's right for now to match exactly against Zephyr MAJOR and MINOR versions and so treat the version as a string. In the future if 2.5 becomes the minimum version supported on microTVM (not an exact match) we can easily adapt the code to match against, for instance, a float, like it's done in https://github.com/apache/tvm/blob/main/python/tvm/topi/arm_cpu/arm_utils.py#L24

Thanks!

@mehrdadh mehrdadh force-pushed the add_platform_version branch from 8c73aed to 1b0077c Compare October 15, 2021 19:16
@mehrdadh
Copy link
Member Author

@gromero thanks for the review.
I changed the versions to float so we could do comparison in future. Since we only tested Zephyr/Arduino with the current versions (2.5/0.18), we just compare with the exact version for now. In future, we can change this to be like >= MIN_VERSION_SUPPORTED.

Copy link
Contributor

@gromero gromero left a comment

Choose a reason for hiding this comment

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

I missed these two typos on my last review. Could you please fix them?

Otherwise LGTM!

Copy link
Contributor

@gromero gromero left a comment

Choose a reason for hiding this comment

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

I can't comment on Arduino versioning, but since we now just warn when versions don't match rather than abort by default I'm ok with it. Plus the versioning mechanism can now be used for non exact matches, so LGTM. Thanks.

@mehrdadh
Copy link
Member Author

@areusch PTAL when you have time.
thanks!

Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

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

@mehrdadh sorry for delay--mostly small things here.

Copy link
Member

@guberti guberti left a comment

Choose a reason for hiding this comment

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

Looks good to me! Sorry about the delay caused by my midterms and being sick.

def generate_project(self, model_library_format_path, standalone_crt_dir, project_dir, options):
# Check Arduino version
version = self._get_platform_version(options["arduino_cli_cmd"])
if version != ARDUINO_CLI_VERSION:
Copy link
Member

Choose a reason for hiding this comment

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

Yea the Arduino CLI seems to be relatively stable - this looks fine to me.

def _get_platform_version(self, arduino_cli_path: str) -> float:
version_output = subprocess.check_output([arduino_cli_path, "version"], encoding="utf-8")
version_output = (
version_output.replace("\n", "").replace("\r", "").replace(":", "").lower().split(" ")
Copy link
Member

Choose a reason for hiding this comment

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

What exactly is this line stripping out? Can we use a regex or .strip()? I'd love to see a comment here with the standard output of arduino-cli version so I can better understand what's happening here.

Copy link
Member Author

@mehrdadh mehrdadh Oct 22, 2021

Choose a reason for hiding this comment

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

thanks for the review. I will add the format as a comment and change it to use regex in the following PR which is waiting for this:
#9309

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

I'm not an expert in microTVM, but the other parts LGTM

@junrushao
Copy link
Member

Given @areusch is out this week, and it's been approved by multiple contributors in our community, I believe we can go ahead to merge this PR to unblock a subsequent one. What do you think @mehrdadh

@mehrdadh
Copy link
Member Author

@junrushao1994 sounds good to me. thanks!

@junrushao junrushao merged commit 133a7dc into apache:main Oct 25, 2021
@junrushao
Copy link
Member

Thanks @mehrdadh @guberti @gromero! The PR is merged

@mehrdadh mehrdadh deleted the add_platform_version branch October 25, 2021 18:19
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* add platform version to project template

* fix arduino cli version on qemu

* specify arduino/zephyr version everywhere

* cleanup

* address comments

* fix warning message

* fix typo

* trigger

* trigger

* address comments

* trigger

* trigger
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* add platform version to project template

* fix arduino cli version on qemu

* specify arduino/zephyr version everywhere

* cleanup

* address comments

* fix warning message

* fix typo

* trigger

* trigger

* address comments

* trigger

* trigger
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.

5 participants