mlonmcu.flow.tvm.backend package
Submodules
mlonmcu.flow.tvm.backend.backend module
- class mlonmcu.flow.tvm.backend.backend.TVMBackend(target='c', executor=None, runtime='crt', fmt='mlf', system_lib=False, features=None, config=None)[source]
Bases:
Backend
- DEFAULTS = {'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends'}
- OPTIONAL = {'tvm.build_dir', 'tvm.configs_dir', 'tvm.pythonpath', 'tvm.use_tlcpack'}
- REQUIRED = {}
- property custom_unroll
- property desired_layout
- property desired_layout_map
- property desired_layout_ops
- property disable_vectorize
- property disabled_passes
- property dump
- property extra_target_details
- property extra_targets
- property generate_wrapper
- load_model(model, input_shapes=None, output_shapes=None, input_types=None, output_types=None)[source]
- name = None
- property needs_target
- property num_threads
- property opt_level
- property pass_config
- property print_outputs
- property refresh_model_info
- registry = {}
- property relay_debug
- property target_device
- property target_keys
- property target_mabi
- property target_march
- property target_mattr
- property target_mcpu
- property target_model
- property target_mtriple
- property target_num_cores
- property tophub_url
- property tvm_build_dir
- property tvm_configs_dir
- property tvm_pythonpath
- property tvmc_custom_script
- property tvmc_extra_args
- property use_tlcpack
- property use_tuning_results
mlonmcu.flow.tvm.backend.model_info module
- class mlonmcu.flow.tvm.backend.model_info.ModelInfo(in_tensors, out_tensors, fix_names=False)[source]
Bases:
object
- property has_ins
- property has_outs
- class mlonmcu.flow.tvm.backend.model_info.RelayModelInfo(mod_text, fix_names=False)[source]
Bases:
ModelInfo
- class mlonmcu.flow.tvm.backend.model_info.RelayTensorInfo(name, shape, dtype, fix_names=False)[source]
Bases:
TensorInfo
- class mlonmcu.flow.tvm.backend.model_info.TensorInfo(name, shape, dtype, fix_names=False)[source]
Bases:
object
- property size
- class mlonmcu.flow.tvm.backend.model_info.TfLiteModelInfo(model, fix_names=False)[source]
Bases:
ModelInfo
- class mlonmcu.flow.tvm.backend.model_info.TfLiteTensorInfo(t, fix_names=False)[source]
Bases:
TensorInfo
mlonmcu.flow.tvm.backend.python_utils module
mlonmcu.flow.tvm.backend.tuner module
mlonmcu.flow.tvm.backend.tvmaot module
- class mlonmcu.flow.tvm.backend.tvmaot.TVMAOTBackend(runtime='crt', fmt='mlf', system_lib=False, features=None, config=None)[source]
Bases:
TVMBackend
- DEFAULTS = {'alignment_bytes': 16, 'arena_size': None, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {'tir.usmp.enable': False}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'unpacked_api': False, 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'debug_arena', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends', 'unpacked_api', 'usmp'}
- property alignment_bytes
- property arena_size
- property debug_arena
- name = 'tvmaot'
- property unpacked_api
mlonmcu.flow.tvm.backend.tvmaotplus module
- class mlonmcu.flow.tvm.backend.tvmaotplus.TVMAOTPlusBackend(runtime='crt', fmt='mlf', system_lib=False, features=None, config=None)[source]
Bases:
TVMAOTBackend
- DEFAULTS = {'alignment_bytes': 16, 'arena_size': 0, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {'tir.usmp.algorithm': 'hill_climb', 'tir.usmp.enable': True}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'unpacked_api': True, 'use_tuning_results': False}
- name = 'tvmaotplus'
mlonmcu.flow.tvm.backend.tvmc_utils module
- mlonmcu.flow.tvm.backend.tvmc_utils.get_bench_tvmc_args(print_time=False, profile=False, end_to_end=False, repeat=1, number=1)[source]
- mlonmcu.flow.tvm.backend.tvmc_utils.get_data_tvmc_args(mode=None, ins_file=None, outs_file=None, print_top=10)[source]
- mlonmcu.flow.tvm.backend.tvmc_utils.get_target_tvmc_args(target='c', extra_targets=[], target_details={}, extra_target_details={})[source]
- mlonmcu.flow.tvm.backend.tvmc_utils.get_tuning_records_tvmc_args(use_tuning_results, tuning_records_file)[source]
mlonmcu.flow.tvm.backend.tvmcg module
mlonmcu.flow.tvm.backend.tvmllvm module
- class mlonmcu.flow.tvm.backend.tvmllvm.TVMLLVMBackend(runtime='crt', fmt='mlf', system_lib=True, features=None, config=None)[source]
Bases:
TVMBackend
- DEFAULTS = {'arena_size': 1048576, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'debug_arena', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends'}
- property arena_size
- property debug_arena
- name = 'tvmllvm'
mlonmcu.flow.tvm.backend.tvmrt module
- class mlonmcu.flow.tvm.backend.tvmrt.TVMRTBackend(runtime='crt', fmt='mlf', system_lib=True, features=None, config=None)[source]
Bases:
TVMBackend
- DEFAULTS = {'arena_size': 1048576, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'debug_arena', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends'}
- property arena_size
- property debug_arena
- name = 'tvmrt'
mlonmcu.flow.tvm.backend.wrapper module
TODO
- mlonmcu.flow.tvm.backend.wrapper.generate_tvmaot_wrapper(model_info, workspace_size, mod_name, api='c', debug_arena=False)[source]
- mlonmcu.flow.tvm.backend.wrapper.generate_tvmrt_wrapper(graph, params, model_info, workspace_size, debug_arena=False)[source]
Module contents
- class mlonmcu.flow.tvm.backend.TVMAOTBackend(runtime='crt', fmt='mlf', system_lib=False, features=None, config=None)[source]
Bases:
TVMBackend
- DEFAULTS = {'alignment_bytes': 16, 'arena_size': None, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {'tir.usmp.enable': False}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'unpacked_api': False, 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'debug_arena', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends', 'unpacked_api', 'usmp'}
- property alignment_bytes
- property arena_size
- property debug_arena
- name = 'tvmaot'
- property unpacked_api
- class mlonmcu.flow.tvm.backend.TVMAOTPlusBackend(runtime='crt', fmt='mlf', system_lib=False, features=None, config=None)[source]
Bases:
TVMAOTBackend
- DEFAULTS = {'alignment_bytes': 16, 'arena_size': 0, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {'tir.usmp.algorithm': 'hill_climb', 'tir.usmp.enable': True}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'unpacked_api': True, 'use_tuning_results': False}
- name = 'tvmaotplus'
- class mlonmcu.flow.tvm.backend.TVMBackend(target='c', executor=None, runtime='crt', fmt='mlf', system_lib=False, features=None, config=None)[source]
Bases:
Backend
- DEFAULTS = {'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends'}
- OPTIONAL = {'tvm.build_dir', 'tvm.configs_dir', 'tvm.pythonpath', 'tvm.use_tlcpack'}
- REQUIRED = {}
- property custom_unroll
- property desired_layout
- property desired_layout_map
- property desired_layout_ops
- property disable_vectorize
- property disabled_passes
- property dump
- property extra_target_details
- property extra_targets
- property generate_wrapper
- load_model(model, input_shapes=None, output_shapes=None, input_types=None, output_types=None)[source]
- name = None
- property needs_target
- property num_threads
- property opt_level
- property pass_config
- property print_outputs
- property refresh_model_info
- registry = {}
- property relay_debug
- property target_device
- property target_keys
- property target_mabi
- property target_march
- property target_mattr
- property target_mcpu
- property target_model
- property target_mtriple
- property target_num_cores
- property tophub_url
- property tvm_build_dir
- property tvm_configs_dir
- property tvm_pythonpath
- property tvmc_custom_script
- property tvmc_extra_args
- property use_tlcpack
- property use_tuning_results
- class mlonmcu.flow.tvm.backend.TVMCGBackend(runtime='crt', fmt='mlf', system_lib=True, features=None, config=None)[source]
Bases:
TVMRTBackend
- REQUIRED = {'utvmcg.exe'}
- name = 'tvmcg'
- class mlonmcu.flow.tvm.backend.TVMLLVMBackend(runtime='crt', fmt='mlf', system_lib=True, features=None, config=None)[source]
Bases:
TVMBackend
- DEFAULTS = {'arena_size': 1048576, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'debug_arena', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends'}
- property arena_size
- property debug_arena
- name = 'tvmllvm'
- class mlonmcu.flow.tvm.backend.TVMRTBackend(runtime='crt', fmt='mlf', system_lib=True, features=None, config=None)[source]
Bases:
TVMBackend
- DEFAULTS = {'arena_size': 1048576, 'autotuned_mode': None, 'autotuned_results_file': None, 'custom_unroll': False, 'debug_arena': False, 'desired_layout': None, 'desired_layout_map': None, 'desired_layout_ops': None, 'disable_vectorize': 'auto', 'disabled_passes': [], 'dump': [], 'extra_pass_config': {}, 'extra_target_details': None, 'extra_targets': None, 'generate_wrapper': 'auto', 'num_threads': 4, 'opt_level': 3, 'print_outputs': False, 'refresh_model_info': False, 'relay_debug': None, 'target_device': None, 'target_keys': None, 'target_mabi': None, 'target_march': None, 'target_mattr': None, 'target_mcpu': None, 'target_model': None, 'target_mtriple': None, 'target_num_cores': None, 'tophub_url': None, 'tvmc_custom_script': None, 'tvmc_extra_args': [], 'use_tuning_results': False}
- FEATURES = {'autotuned', 'cmsisnnbyoc', 'debug_arena', 'disable_legalize', 'fuse_ops', 'moiopt', 'muriscvnnbyoc', 'uma_backends'}
- property arena_size
- property debug_arena
- name = 'tvmrt'