Skip to content

Commit 26d3244

Browse files
authored
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]>
1 parent 5692600 commit 26d3244

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

python/tvm/driver/tvmc/target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def _generate_codegen_args(parser, codegen_name):
7272
target_group.add_argument(
7373
f"--target-{codegen_name}-{target_option}",
7474
type=python_type,
75-
help=f"target {codegen_name} {target_option}{python_type}",
75+
help=field.description,
7676
)
7777

7878

tests/python/driver/tvmc/test_target_options.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,29 @@ def test_mapping_target_args():
6060
assert reconstruct_target_args(parsed) == {"llvm": {"mcpu": "cortex-m3"}}
6161

6262

63+
@tvm.testing.requires_vitis_ai
64+
def test_composite_target_cmd_line_help():
65+
parser = argparse.ArgumentParser()
66+
generate_target_args(parser)
67+
assert parser._option_string_actions["--target-vitis-ai-dpu"].help == "Vitis AI DPU identifier"
68+
assert (
69+
parser._option_string_actions["--target-vitis-ai-build_dir"].help
70+
== "Build directory to be used (optional, debug)"
71+
)
72+
assert (
73+
parser._option_string_actions["--target-vitis-ai-work_dir"].help
74+
== "Work directory to be used (optional, debug)"
75+
)
76+
assert (
77+
parser._option_string_actions["--target-vitis-ai-export_runtime_module"].help
78+
== "Export the Vitis AI runtime module to this file"
79+
)
80+
assert (
81+
parser._option_string_actions["--target-vitis-ai-load_runtime_module"].help
82+
== "Load the Vitis AI runtime module to this file"
83+
)
84+
85+
6386
@tvm.testing.requires_cmsisnn
6487
def test_include_known_codegen():
6588
parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)