This is an automated email from the ASF dual-hosted git repository.
lukhut pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 26d3244fb8 Enhance the --help message of composite target (#13842)
26d3244fb8 is described below
commit 26d3244fb8e0bed5bf0bbf09ad2f88d2efc546a8
Author: MNGanesan <[email protected]>
AuthorDate: Wed Jan 25 19:19:55 2023 +0530
Enhance the --help message of composite target (#13842)
Presently --help for vitis displays the target and option string,
it has no description. Eg: target vitis-ai dpu<class 'str'>
This can be made more meaningful by fetching the description from
the config node of the target. Eg: Vitis AI DPU identifier
Signed-off-by: MNGanesan <[email protected]>
---
python/tvm/driver/tvmc/target.py | 2 +-
tests/python/driver/tvmc/test_target_options.py | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/python/tvm/driver/tvmc/target.py b/python/tvm/driver/tvmc/target.py
index a3602b4eb8..ec8215184e 100644
--- a/python/tvm/driver/tvmc/target.py
+++ b/python/tvm/driver/tvmc/target.py
@@ -72,7 +72,7 @@ def _generate_codegen_args(parser, codegen_name):
target_group.add_argument(
f"--target-{codegen_name}-{target_option}",
type=python_type,
- help=f"target {codegen_name}
{target_option}{python_type}",
+ help=field.description,
)
diff --git a/tests/python/driver/tvmc/test_target_options.py
b/tests/python/driver/tvmc/test_target_options.py
index 891df86f0c..8d11e44800 100644
--- a/tests/python/driver/tvmc/test_target_options.py
+++ b/tests/python/driver/tvmc/test_target_options.py
@@ -60,6 +60,29 @@ def test_mapping_target_args():
assert reconstruct_target_args(parsed) == {"llvm": {"mcpu": "cortex-m3"}}
[email protected]_vitis_ai
+def test_composite_target_cmd_line_help():
+ parser = argparse.ArgumentParser()
+ generate_target_args(parser)
+ assert parser._option_string_actions["--target-vitis-ai-dpu"].help ==
"Vitis AI DPU identifier"
+ assert (
+ parser._option_string_actions["--target-vitis-ai-build_dir"].help
+ == "Build directory to be used (optional, debug)"
+ )
+ assert (
+ parser._option_string_actions["--target-vitis-ai-work_dir"].help
+ == "Work directory to be used (optional, debug)"
+ )
+ assert (
+
parser._option_string_actions["--target-vitis-ai-export_runtime_module"].help
+ == "Export the Vitis AI runtime module to this file"
+ )
+ assert (
+
parser._option_string_actions["--target-vitis-ai-load_runtime_module"].help
+ == "Load the Vitis AI runtime module to this file"
+ )
+
+
@tvm.testing.requires_cmsisnn
def test_include_known_codegen():
parser = argparse.ArgumentParser()