This is an automated email from the ASF dual-hosted git repository.
leandron 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 988255e6fa Compiled with Default Target(LLVM) and Built with
USE_MRVL=ON (#17455)
988255e6fa is described below
commit 988255e6fa77b0516c0f842c8a94011b802b4c74
Author: MNGanesan <[email protected]>
AuthorDate: Fri Oct 25 14:22:57 2024 +0530
Compiled with Default Target(LLVM) and Built with USE_MRVL=ON (#17455)
* [Frontend][ArgParse] Compile with default(LLVM) target and build with
BYOC(#17454)
It is a unique use-case to check the default target(LLVM), though TVM is
built with BYOC(MRVL-ON)
The config of Codegen(BYOC) contains default values for
configuration/options, it is extracted
during _generate_codegen_args. In command line processing,
validate_target_args checks if there
are add-on options and it expects that particular target to be given
explicitly in command line.
Here, it is test for default (LLVM) path only, hence validate_target_args
need to ignore the codegen's
configuration for default target.
Signed-off-by: M N Ganesan <[email protected]>
* [Frontend][ArgParse] Compile with default(LLVM) target and build with
BYOC(#17454)
It is a unique use-case to check the default target(LLVM), though TVM is
built with BYOC(MRVL-ON)
The config of Codegen(BYOC) contains default values for
configuration/options, it is extracted
during _generate_codegen_args. In command line processing,
validate_target_args checks if there
are add-on options and it expects that particular target to be given
explicitly in command line.
Here, it is test for default (LLVM) path only, hence validate_target_args
need to ignore the codegen's
configuration for default target.
Signed-off-by: M N Ganesan <[email protected]>
* [Frontend][ArgParse] Compile with default(LLVM) target and build with
BYOC(#17454)
It is a unique use-case to check the default target(LLVM), though TVM is
built with BYOC(MRVL-ON)
The config of Codegen(BYOC) contains default values for
configuration/optons, it is extracted
during _generate_codegen_args. In command line processing,
validate_target_args checks if there are
add-on options and it expects that particular target to be given explicitly
in command line.
Here, it is test for default (LLVM) path only, hence validate_target_args
need to ignore the
codegen's configuration
Signed-off-by: M N Ganesan <[email protected]>
* [Frontend][ArgParse] Compile with default(LLVM) target and build with
BYOC(#17454)
It is a unique use-case to check the default target(LLVM), though TVM
is built with BYOC(MRVL-ON)
The config of Codegen(BYOC) contains default values for
configuration/optons, it is extracted
during _generate_codegen_args. In command line processing,
validate_target_args checks if there are
add-on options and it expects that particular target to be given
explicitly in command line.
Here, it is test for default (LLVM) path only, hence
validate_target_args need to ignore the
codegen's configuration
Signed-off-by: M N Ganesan <[email protected]>
* [Frontend][ArgParse] Compile with default(LLVM) target and build with
BYOC(#17454)
It is a unique use-case to check the default target(LLVM), though
TVM is built with BYOC(MRVL-ON)
The config of Codegen(BYOC) contains default values for
configuration/optons, it is extracted
during _generate_codegen_args. In command line processing,
validate_target_args checks if there are
add-on options and it expects that particular target to be given
explicitly in command line.
Here, it is test for default (LLVM) path only, hence
validate_target_args need to ignore the
codegen's configuration
Signed-off-by: M N Ganesan <[email protected]>
* [Frontend][ArgParse] Compile with default target(LLVM) when built
USE_MRVL=ON(#17454)
This is a use-case of invoking TVMC with default target though it is built
with MRVL_ON.
In command line processing, validate_target_args checks if there are add-on
options
derived from the default arguments of codegen/BYOC and it expects that
particular codegen
to be given explicitly in command line. However, certain codegen's can have
default target alone,
in that case codegen optios are not extracted there by relaxing the
validation
Signed-off-by: M N Ganesan <[email protected]>
* [Frontend][ArgParse] Compile with default target(LLVM) when built
USE_MRVL=ON(#17454)
This is a use-case of invoking TVMC with default target though it is built
with MRVL_ON.
In command line processing, validate_target_args checks if there are add-on
options
derived from the default arguments of codegen/BYOC and it expects that
particular codegen
to be given explicitly in command line. However, certain codegen's can have
default target alone,
in that case codegen optios are not extracted there by relaxing the
validation
Signed-off-by: M N Ganesan <[email protected]>
* [Frontend][ArgParse] Compile with default target(LLVM) when built
USE_MRVL=ON(#17454)
This is a use-case of invoking TVMC with default target though it is
built with MRVL_ON.
In command line processing, validate_target_args checks if there are
add-on options
derived from the default arguments of codegen/BYOC and it expects that
particular codegen
to be given explicitly in command line. However, certain codegen's can
have default target alone,
in that case codegen optios are not extracted there by relaxing the
validation
Signed-off-by: M N Ganesan <[email protected]>
---------
Signed-off-by: M N Ganesan <[email protected]>
Co-authored-by: M N Ganesan <[email protected]>
---
python/tvm/driver/tvmc/composite_target.py | 8 ++++++++
python/tvm/driver/tvmc/target.py | 5 +++++
tests/python/driver/tvmc/test_target_options.py | 13 +++++++++++++
3 files changed, 26 insertions(+)
diff --git a/python/tvm/driver/tvmc/composite_target.py
b/python/tvm/driver/tvmc/composite_target.py
index 6c51dd1689..e912ab564b 100644
--- a/python/tvm/driver/tvmc/composite_target.py
+++ b/python/tvm/driver/tvmc/composite_target.py
@@ -52,41 +52,49 @@ REGISTERED_CODEGEN = {
"compute-library": {
"config_key": None,
"pass_default": False,
+ "default_target": None,
"pass_pipeline": partition_for_arm_compute_lib,
},
"cmsis-nn": {
"config_key": "relay.ext.cmsisnn.options",
"pass_default": False,
+ "default_target": None,
"pass_pipeline": partition_for_cmsisnn,
},
"ethos-n": {
"config_key": "relay.ext.ethos-n.options",
"pass_default": False,
+ "default_target": None,
"pass_pipeline": partition_for_ethosn,
},
"ethos-u": {
"config_key": "relay.ext.ethos-u.options",
"pass_default": False,
+ "default_target": None,
"pass_pipeline": partition_for_ethosu,
},
"bnns": {
"config_key": None,
"pass_default": False,
+ "default_target": None,
"pass_pipeline": partition_for_bnns,
},
"vitis-ai": {
"config_key": "relay.ext.vitis_ai.options",
"pass_default": False,
+ "default_target": None,
"pass_pipeline": partition_for_vitis_ai,
},
"clml": {
"config_key": None,
"pass_default": False,
+ "default_target": None,
"pass_pipeline": partition_for_clml,
},
"mrvl": {
"config_key": "relay.ext.mrvl.options",
"pass_default": True,
+ "default_target": "llvm",
"pass_pipeline": partition_for_mrvl,
},
}
diff --git a/python/tvm/driver/tvmc/target.py b/python/tvm/driver/tvmc/target.py
index b5eee04823..4cfaf130e4 100644
--- a/python/tvm/driver/tvmc/target.py
+++ b/python/tvm/driver/tvmc/target.py
@@ -122,6 +122,11 @@ def _reconstruct_codegen_args(args, codegen_name):
codegen = get_codegen_by_target(codegen_name)
pass_configs = PassContext.list_configs()
codegen_options = {}
+ default_tgt = codegen["default_target"]
+
+ # Do not fetch codegen options, if the default target alone is choosen by
user
+ if codegen_name not in args.target and default_tgt is not None and
default_tgt in args.target:
+ return codegen_options
if codegen["config_key"] is not None and codegen["config_key"] in
pass_configs:
attrs = make_node(pass_configs[codegen["config_key"]]["type"])
diff --git a/tests/python/driver/tvmc/test_target_options.py
b/tests/python/driver/tvmc/test_target_options.py
index d98a8d588e..64218f02a0 100644
--- a/tests/python/driver/tvmc/test_target_options.py
+++ b/tests/python/driver/tvmc/test_target_options.py
@@ -86,6 +86,19 @@ def test_default_arg_for_mrvl_hybrid():
assert parsed.target_mrvl_num_tiles == 8
[email protected]_mrvl
+# Test for default(LLVM) target, when built with USE_MRVL=ON
+def test_mrvl_build_with_llvm_only_target():
+ parser = argparse.ArgumentParser()
+ generate_target_args(parser)
+ parsed, _ = parser.parse_known_args(
+ [
+ "--target=llvm",
+ ]
+ )
+ assert parsed.target == "llvm"
+
+
@tvm.testing.requires_cmsisnn
def test_mapping_target_args():
parser = argparse.ArgumentParser()