-
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
[microTVM] Add method to query template info without creating a project #8950
Conversation
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>
a5c3008
to
e50b5a8
Compare
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): |
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.
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
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 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 :)
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 @gromero !
…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>
…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>
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