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] Add method to query template info without creating a project #8950

Merged
merged 1 commit into from Sep 8, 2021

Conversation

gromero
Copy link
Contributor

@gromero gromero commented Sep 7, 2021

Add info() method to TemplateProject class so it's possible to query all
available options for a given template project without creating a new
one. This is necessary because TVMC will query the available options for
a given template project to show them to the user so the user can use
them to finally create a new project dir.

That is also useful in general to query the available options for any
project type. For example, one can query all boards available on the
Zephyr platform with:

import tvm.micro.project as project_api

template = project_api.TemplateProject.from_directory(ZEPHYR_TEMPLATE_DIR)
boards = template.info()["project_options"][8]["choices"]

where 8 is refers to the "zephyr_board" option.

Signed-off-by: Gustavo Romero gustavo.romero@linaro.org

@gromero
Copy link
Contributor Author

gromero commented Sep 7, 2021

cc @mehrdadh @areusch , in the context of querying via the Project API the "choices" available on the platforms (zephyr, arduino, etc) - #8940 (comment)

Add info() method to TemplateProject class so it's possible to query all
available options for a given template project without creating a new
one. This is necessary because TVMC will query the available options for
a given template project to show them to the user so the user can use
them to finally create a new project dir.

That is also useful in general to query the available options for any
project type. For example, one can query all boards available on the
Zephyr platform with:

import tvm.micro.project as project_api

template = project_api.TemplateProject.from_directory(ZEPHYR_TEMPLATE_DIR)
boards = template.info()["project_options"][8]["choices"]

where 8 element refers to the "zephyr_board" option.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
self._info = self._api_client.server_info_query(__version__)
if not self._info["is_template"]:
raise NotATemplateProjectError()

def generate_project(self, graph_executor_factory, project_dir):
def generate_project(self, graph_executor_factory, project_dir, options):
Copy link
Contributor

Choose a reason for hiding this comment

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

just noting for posterity that originally i didn't do this because i wanted all calls to Project API server to use the same options, but since there is just one call used with TemplateProject, and you might actually want to examine self._info before constructing options, this makes more sense to me

Copy link
Contributor Author

@gromero gromero Sep 8, 2021

Choose a reason for hiding this comment

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

I see your point and that was exactly what I thought when I was going for that change. Thanks your comment, it really helps me to understand the design better and increases my confidence that I'm following the motivations behind it correctly :)

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.

thanks @gromero !

@masahi masahi merged commit af9d100 into apache:main Sep 8, 2021
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
…ct (apache#8950)

Add info() method to TemplateProject class so it's possible to query all
available options for a given template project without creating a new
one. This is necessary because TVMC will query the available options for
a given template project to show them to the user so the user can use
them to finally create a new project dir.

That is also useful in general to query the available options for any
project type. For example, one can query all boards available on the
Zephyr platform with:

import tvm.micro.project as project_api

template = project_api.TemplateProject.from_directory(ZEPHYR_TEMPLATE_DIR)
boards = template.info()["project_options"][8]["choices"]

where 8 element refers to the "zephyr_board" option.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
…ct (apache#8950)

Add info() method to TemplateProject class so it's possible to query all
available options for a given template project without creating a new
one. This is necessary because TVMC will query the available options for
a given template project to show them to the user so the user can use
them to finally create a new project dir.

That is also useful in general to query the available options for any
project type. For example, one can query all boards available on the
Zephyr platform with:

import tvm.micro.project as project_api

template = project_api.TemplateProject.from_directory(ZEPHYR_TEMPLATE_DIR)
boards = template.info()["project_options"][8]["choices"]

where 8 element refers to the "zephyr_board" option.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
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.

None yet

3 participants