Skip to content

Commit

Permalink
Compiled with Default Target(LLVM) and Built with USE_MRVL=ON (#17455)
Browse files Browse the repository at this point in the history
* [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 <muthusamynam@marvell.com>

* [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 <muthusamynam@marvell.com>

* [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 <muthusamynam@marvell.com>

* [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 <muthusamynam@marvell.com>

* [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 <muthusamynam@marvell.com>

* [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 <muthusamynam@marvell.com>

* [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 <muthusamynam@marvell.com>

* [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 <muthusamynam@marvell.com>

---------

Signed-off-by: M N Ganesan <muthusamynam@marvell.com>
Co-authored-by: M N Ganesan <muthusamynam@marvell.com>
  • Loading branch information
MNGanesan and M N Ganesan authored Oct 25, 2024
1 parent 889fc6b commit 988255e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/tvm/driver/tvmc/composite_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,49 @@
"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,
},
}
Expand Down
5 changes: 5 additions & 0 deletions python/tvm/driver/tvmc/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
13 changes: 13 additions & 0 deletions tests/python/driver/tvmc/test_target_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ def test_default_arg_for_mrvl_hybrid():
assert parsed.target_mrvl_num_tiles == 8


@tvm.testing.requires_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()
Expand Down

0 comments on commit 988255e

Please sign in to comment.