59 Commits

Author SHA1 Message Date
Tianqi Chen ebc9348bd7 [REFACTOR][PYTHON] Slim tvm.libinfo to info-only helpers (#19719)
This PR slims `tvm.libinfo` into a thin *info* layer that delegates path
discovery to the `tvm_ffi.libinfo` primitives and never loads libraries.
Loading responsibilities move to `tvm.base`, and the various ad-hoc
path-finding helpers are phased out in favor of the tvm-ffi resolvers.

## Changes

- **libinfo**: add `find_libtvm_runtime()` (resolves `libtvm_runtime`
via
  `_find_library_by_basename` + `_resolve_and_validate`) and
`find_tvm_include_path()` (TVM's own `include/`). `find_include_path()`
now
returns `[find_tvm_include_path(), *tvm_ffi.libinfo.include_paths()]`,
folding
in the FFI + dlpack + python-helper include dirs. Remove
`find_lib_path`,
  `get_dll_directories`, `use_runtime_lib`, `split_env_var`, and
  `load_backend_libs`.
- **base**: receive `load_backend_libs` and the backend DSO list; the
runtime-only switch becomes a strict `TVM_USE_RUNTIME_LIB == "1"` check.
- **rpc**: `with_minrpc` uses `find_libtvm_runtime()` (the `runtime`
kwarg is
retained as an inert back-compat parameter); the rpc server
`load_library`
resolves the literal library name against the current working directory.
- **wasm**: move the `web/dist` asset search into `emcc.find_wasm_lib`,
used by
  `emcc.create_tvmjs_wasm` and the tvmjs asset lookup.
- **hexagon**: fix a latent bug where `_get_hexagon_rpc_lib_dir` called
a
non-existent `tvm_ffi.libinfo.find_lib_path`; it now relies solely on
the
  `HEXAGON_RPC_LIB_DIR` environment variable.
2026-06-10 13:41:37 -04:00
Tianqi Chen ffea531107 [REFACTOR][PYTHON] Lift compiler/CLI/process modules from tvm.contrib to tvm.support (#19624)
## Summary

Lifts 10 host-toolchain / CLI / process / utility modules from
`python/tvm/contrib/` to a new `python/tvm/support/` package, and
deletes two dead contrib shims.

`tvm.support` is the home for Python helpers that integrate TVM with
external CLIs and host-side tools — compilers, archivers, subprocess
pools, and build-info queries. These are load-bearing internal pieces
that TVM's compile/link/run paths depend on. `tvm.contrib` is reserved
for optional vendor SDK integrations and experimental features. The
distinction is documented in the `tvm.support` package docstring.

Moved (one commit each):

- `tvm.contrib.cc` → `tvm.support.cc`
- `tvm.contrib.nvcc` → `tvm.support.nvcc`
- `tvm.contrib.rocm` → `tvm.support.rocm`
- `tvm.contrib.ndk` → `tvm.support.ndk`
- `tvm.contrib.xcode` → `tvm.support.xcode`
- `tvm.contrib.clang` → `tvm.support.clang`
- `tvm.contrib.emcc` → `tvm.support.emcc`
- `tvm.contrib.popen_pool` → `tvm.support.popen_pool`
- `tvm.contrib.utils` → `tvm.support.utils`
- `tvm.contrib.tar` → `tvm.support.tar`

Deleted:
- `tvm.contrib.spirv` — single `optimize()` wrapping `spirv-opt`; zero
importers.
- `tvm.contrib.rpc` — self-deprecation shim with "removed in 0.5"
banner; honoring it.

Package conversion:
- `python/tvm/support.py` → `python/tvm/support/__init__.py` with
inclusion-rule docstring.
- `libinfo()` extracted into `python/tvm/support/libinfo.py`.
- `FrontendTestModule` dropped (audit confirmed zero callers outside its
own definition).

## Compatibility

Hard break — no `tvm.contrib.<mod>` re-export shims. All callers updated
in this PR.

C++-side FFI registry keys (`tvm.contrib.nvcc.*`, etc.) are unchanged —
only the Python module path moves. Renaming the FFI keys is a separate
follow-up.
2026-05-27 15:31:12 -04:00
Akaash Parthasarathy 81889decfa [Fix] Replace str(target.kind) with target.kind.name for Target objects (#18959)
Replace `str(target.kind)` with `target.kind.name` for `Target` objects
since `target.kind` is a `TargetKind` object while `target.kind.name`
yields a string describing the target
2026-04-02 14:17:02 -04:00
Tianqi Chen 9a8320acbd [LINT][PYTHON] Modernize annotations with ruff UP rules (#18830)
This PR enables ruff pyupgrade (UP) rules with py310 target, auto-fixing
~5600 annotation modernizations (PEP 585 generics, PEP 604 unions,
deprecated typing imports).

Also removes from __future__ import annotations from ir/module.py and
rmsnorm.py, bumps requires-python to >=3.10, and removes absolute_import
aliases from topi/contrib files.
2026-02-27 21:29:47 -05:00
Tianqi Chen 33dcea1686 [REFACTOR][LINT] Modernize ruff config (#18810)
This PR removes the extra lint violations from the codebase so lint
aligns with the latest style
2026-02-23 07:29:21 -05:00
Tianqi Chen aa2e609136 [LINT] Modernize lint to use pre-commit hooks (#18807)
This PR migrates existing lint to use pre-commit hooks
2026-02-22 11:03:21 -05:00
Tianqi Chen 2030db36e4 [REFACTOR][TARGET] Phase out legacy target string in favor of json (#18785)
This PR phases out legacy target string format in favor of the json
style format that is more well formed. It also simplfies our overall
code in handling multiple formats.
2026-02-16 16:21:35 -05:00
Tianqi Chen 543e64dbb1 [FFI][REFACTOR] Cleanup tvm_ffi python API and types (#18277)
This PR cleans up the python API to make things more consistent
with existing python array api and torch.

Device update
- device_id => index, to be consistent with torch
- device_type => dlpack_device_type() returns int
- added type property same as torch.device

API updates:

- Move the convenient method like cpu() out into tvm runtime to keep device minimal
- tvm_ffi._init_api => tvm_ffi.init_ffi_api
- tvm_ffi.register_func => tvm_ffi.register_global_func
2025-09-07 10:38:50 -04:00
Tianqi Chen a7a0168be5 [FFI][REFACTOR] Establish tvm_ffi python module (#18226)
* [FFI][REFACTOR] Establish tvm_ffi as a standalone python module

This PR establishes tvm_ffi as a standalone python module.
The ffi is structured as a minimal pip module that can be
directly install by path or url.

examples/get_started provided a minimal example.
This is a major change as we are decoupling tvm_ffi as a
separate package, users need to install tvm_ffi separately.

Thanks to its minimal dependency, tvm_ffi can be easily installed
even just from the source by pip install ./ffi

This change would enable future improvement for library plugins
to have lightweight dependencies by just working on top of
the tvm_ffi, while the main compiler toolchain and runtime
can be layered on top.

* [FFI] Improve traceback setups

This PR improves traceback related setups
2025-08-24 15:46:20 -07:00
Tianqi Chen 6bc94d0050 [FFI][REFACTOR] Establish ffi.Module in python (#18214)
This PR refactors and establishes ffi.Module under the python tvm ffi api.
Also moves export_library method to executable so it aligns more with
compiled artifact.
2025-08-18 22:37:25 +08:00
Tianqi Chen b8eb80b968 [FFI] Formalize ffi.Module (#18213)
This PR formalizes original runtime::Module into ffi
as ffi.Module and cleans the APIs around it.

The goal is to stablize the Module API as extra API that can benefit the overall
ffi interactions. We also refactors the c++ code that depends on the Module.
2025-08-17 23:33:05 +08:00
Tianqi Chen dbbcf904b0 [FFI][REFATOR] Cleanup entry function to redirect (#18205)
This PR updates the entry function mechanism to create a stub that redirects to the real function.
This new behavior helps to simplify the runtime logic supporting entry function.
Also updates the name to `__tvm_ffi_main__`
2025-08-12 17:25:14 -04:00
Tianqi Chen 4289efa0d5 [REFACTOR][PYTHON] Phase out tvm._ffi and Limited API support (#18020)
This PR phases out tvm._ffi redirections in favor of new FFI
new functions are now called via tvm.ffi.

We also enabled limited API support for python 3.12+
so the compiled binary can be forward compatible to future
python versions.
2025-05-28 16:52:36 -04:00
Tianqi Chen 95d1268982 [REFACTOR] Introduce and modernize FFI system (#17920)
This PR modernizes the FFI foundation of the project and introduce
a new minimal and lightweight module [tvm ffi](https://github.com/apache/tvm/tree/refactor-s3/ffi)
based on our lessons in the past few years. It implements a modern
version of the [Unified Packed and Object RFC](https://github.com/apache/tvm-rfcs/blob/main/rfcs/0097-unify-packed-and-object.md)
that unifies the packed function call and object systems.

Summary of the change:
- A dedicated clean Any/AnyView that can store strong and weak
references of items
- Function(previously PackedFunc) system built on top of the Any/AnyView
- A minimal C API that backs the overall calls. We are stabilizing the
API with a goal to bring clean, stable FFI conventions for both compiled
and registered code
- A rewrite of core python binding and generated code based on the module
- Update existing code and test cases to the new module
- Latest dlpack support
 
The new module brings many benefits thanks to the cleaner design,
to name a few:
- Any can support both POD types(int) and object types.
- Containers (e.g. Array) can now also contain Any value, e.g. now
`Array<int>` is supported, no need for boxed types
- Error handling now upgrades to object-based, allowing cleaner
traceback across languages
- Map now preserves insertion orders
- Path toward isolated stabilize minimum core ABI/API foundation module
- Type traits based design that cleanly defines how values interact
with Any system
- Automatic conversion of different types based on traits if needed 

Because FFI upgrade is at heart of the project, the change touches every
component of the system. Importantly, this is an upgrade of the ABI so the
change is not backward compatible.  The code compiled under the old
FFI won't work under the new one. We did provide example ABI translation
(e.g. LegacyTVMArgValueToFFIAny) functions for compatibility. 
The PR tries to leave files in their old places while creating redirections.
The goal is to have the first milestone landed and infrastructure in place,
so we can do further refactors to complete features and cleanup legacy code
as trackable PRs. As of now, python binding and compiled code are under the
new convention while RPC and some  other bindings still relies on legacy ABI
translation. We will work on upgrades in the coming PRs, including areas such
as reflection, phasing out legacy redirections etc.
2025-05-06 19:18:33 -04:00
Tianqi Chen c962198100 [REFACTOR] Phase out StackVM (#17784)
This PR phases out the stackvm implementation.
StackVM historically was used for some host codegen.
As we move towards more comprehensive host codegen support,
we can leverage LLVM and C for that purpose, so it can be helpful
to phase it out to simplify maintainace.
2025-03-26 13:15:27 -04:00
Wuwei Lin 5648a8e114 [Runtime] Add property Module.is_device_module (#17407) 2024-09-24 21:09:32 -07:00
Junru Shao 071e94f653 Merge remote-tracking branch 'main' into 'unity' 2023-09-11 17:52:02 +00:00
tqchen 90c64c6dce [MERGE] Merge main into unity 2023-09-06
NOTE: use the original webgpu impl to make sure webgpu is stable.
2023-09-06 10:45:29 -04:00
Krzysztof Parzyszek 35164b379f [Module] Implement custom imported modules serialization (#15666)
* [Module] Implement custom imported modules serialization

When a module with imported modules is exported into a shared library,
the imported modules are serialized and embedded inside of that library.
This is done by generating a raw binary from the imported modules, which
is then assigned to a symbol `__tvm_dev_mblob` in the final shared
library.

The way it happens for targets that are not "llvm", is by creating a C
source file, and defining a statically-initialized array `__tvm_dev_mblob`
in it. The static initializer is the byte-by-byte hexadecimal represen-
tation of the serialized modules. While working with Hexagon, this has
presented us with two issues:
1. For most models, the embedded data is very large, taking significant
amout of time to compile the auto-generated C source.
2. There are some models for which the C source size has exceeded clang's
limits on the size of the input file, making it impossible to export the
corresponding module.

This PR allows users to provide a custom serialization routine to
`Module.export_library`. We then apply it in Hexagon to build the ELF
object file with `__tvm_dev_mblob` by using the objcopy tool from the
Hexagon toolchain. This bypasses the C compilation altogether, avoiding
both of the issues.

Using the same custom mechanism, similar method can be implemented for
many other targets which have utilities to manipulate object files
directly.

* Allow toolchain version 8.5.x as well: objcopy has necessary options

It seems like older toolchains may work as well, but the oldest supported
SDK is 4.5.0.3, which contains toolchain version 8.5.08.
2023-09-06 08:51:46 -04:00
Krzysztof Parzyszek f9e6018cfe [Runtime] Make export_library parameters after file_name keyword-only (#15658)
This makes the code a bit more readable at a little cost.
2023-09-01 23:45:46 -07:00
Sunghyun Park 8f60213cb5 [Runtime] Serialization/Deserialization of runtime module (#15244) 2023-08-28 10:10:33 -04:00
Junru Shao d8f1ac4e87 Merge remote-tracking branch 'apache-upstream/main' into unity 2023-07-18 14:57:34 -07:00
Bohan Hou c0946e19cd [Runtime] Flush L2 cache in time eval (#15305)
This PR introduces an optional cache flush functionality to
`time_evaluator`. It is implemented by allocating two large empty
NDArrays on the device so that the L2 cache are flushed. This gives us
more accurate evaluation on the performance of a runtime function.
2023-07-18 13:27:07 -04:00
tqchen 153f70aa60 [MERGE] Merge main into unity 2023-06-01
Updated the runtime to latest
cutlass conflict resolutions
2023-06-01 19:46:25 -04:00
Krzysztof Parzyszek 4f041c96e7 [Runtime,RPC] Use f-strings for string formatting, NFC (#14967)
* [Runtime,RPC] Use f-strings for string formatting, NFC

Replace uses of % and .format() with f-strings.

Reformat modified files.

* Fix linter
2023-05-27 16:14:15 +09:00
tqchen d159f73d2a [MERGE] Merge main into unity 2023-05-14
Merge remote-tracking branch 'upstream/main' into unity
2023-05-15 09:50:33 -04:00
Tianqi Chen 05001bed64 [LLVM][RUNTIME] Enable multi systemlib with device code (#14843)
This PR enables combination of multiple system lib
into the same static library with a system_lib_prefix attribute.
This can open doors for multiple models to be compiled separately
then packaged into the same app via static library.

It resolves a previous issue that prevents multiple system
lib to be linked together when they come with extra binary component
such as CUDA due to symbol conflict.
2023-05-13 11:33:01 -07:00
Ivan Sidorenko 7f44914317 [Unity][Hexagon] Enable Relax VM for Hexagon (#14415)
this PR enables support of hexagon for relaxvm
2023-04-01 15:31:45 -04:00
Tianqi Chen 9f9cf2967c [Unity][WEB] Improve webgpu codegen options to skip readonly (#14213)
Readonly detection can cause the kernel arg order
to be different from other shaders, add options to
optionally skip it.

Also makes export auto use emcc for wasm target.
2023-04-01 15:31:43 -04:00
Sunghyun Park 7b34a6e0c6 [Runtime] Introduce runtime module property (#14406)
Currently, we only classify whether the runtime module is DSO-exportable.

This PR further classifies each runtime module into the properties as follows:
- `kBinarySerializable`: we can serialize the module to the stream of bytes. CUDA/OpenCL/JSON runtime are representative examples.
- `kRunnable`: we can run the module directly. LLVM/CUDA/JSON runtime, executors (e.g, virtual machine) runtimes are runnable. Non-runnable modules, such as CSourceModule, requires a few extra steps (e.g,. compilation, link) to make it runnable.
- `kBinaryExportable`: when the module is kBinarySerializable and kRunnable, we consider this module as binary exportable. A binary exportable module can be integrated into final runtime artifact by being serialized as data into the artifact, then deserialzied at runtime. This class of modules must implement `SaveToBinary`, and have a matching deserializer registered as `runtime.module.loadbinary_<type_key>`.
- `kDSOExportable`: we can export the module as DSO. A DSO exportable module (e.g., a CSourceModuleNode of type_key 'c') can be incorporated into the final runtime artifact (ie shared library) by compilation and/or linking using the external compiler (llvm, nvcc, etc). DSO exportable modules must implement `SaveToFile`.

Please note that `kDSOExportable` is a mutual exclusive property with `kBinaryExportable`.
2023-03-30 09:20:23 -04:00
Hongyi Jin 61a4f21412 [RUNTIME] Correctly handling export_module when exporting modules of different type (#13489) 2022-11-27 09:59:26 -05:00
Egor Churaev c3c7c4ccc3 [Profiler] Fix graph_executor_debug hang (#12382)
For some operations such as `__nop` or `__copy` the measured inference
time is equal to 0. In this case we are in infinite loop and we won't
exit from it. Added new parameter `limit_zero_time_iterations ` which specify the
maximum number of repeats then the inference time is equal to 0. When
we exceed this value then we will exit from a loop.
2022-08-12 09:26:38 -07:00
Alexey Voronov 6c8a353099 Add cooldown interval logic for the profiling functional (#11465)
* Add cooldown interval logic for the profiling functional.

* Remove string serialize hack from RunIndividual functions

* Update src/runtime/graph_executor/debug/graph_executor_debug.cc

Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>
2022-06-28 09:10:09 -07:00
Krzysztof Parzyszek 7b0f791e12 [LLVM] Retrieve entire target string from LLVMModule (#11802)
The blob-embedding code creates a new LLVM module for which is needs more
information than just the target triple. The `_get_target_triple` function
in LLVMModule returned the triple with additional options appended to the
string. Instead of piggy-backing those extra options on top of the triple,
replace `_get_target_triple` with `_get_target_string`, which will return
the entire target string.
2022-06-22 06:21:05 +09:00
Mark Shields db5f4fe65c [Runtime] Add 'static_library' runtime::Module (#11442)
(See https://discuss.tvm.apache.org/t/byoc-supporting-cutlass-byoc-with-collage/12796/6 for
context, which in turn is part of Collage (https://github.com/apache/tvm-rfcs/blob/main/rfcs/0062-collage.md).

This adds a new 'DSO exportable' runtime module representing the contents of a .o file. It
allows external codegen toolchains to yield a result which:
 - Like CSource modules, can be conveyed directly to the final export_library compilation
   step for linking into the final .so and saved to a know location without risk the
   underlying code artifact will be lost.
 - Like DSOLibrary modules, are self contained so that no additional compile-time arguments
   need be conveyed from the CSource module to the final export_library command line

Since this is the third flavor of 'DSO exportable' module, add a Module::IsDSOExportable.

Since adding the above, can't resist also adding a Module::ImplementsFunction virtual and
calling it from TEComplier to check if an external codegen function actually provided the
implementation it promised.

Note:
 - I've left the existing implementation of runtime.load_module alone which
   relinks .o files to .so files.
 - Though also contained in the .o metadata, I require static libraries to always
   carry their list of exported function names.

This is all pretty stop gap pending a good rework of TVM to supoprt the notion of artifacts
and, perhaps, build rules.
2022-05-26 12:26:05 -04:00
Tristan Konolige a6e620937b [RUNTIME] Api to get number of runtime threads (#10896)
* [RUNTIME] Api to get number of runtime threads

Add `tvm::runtime::threading::NumThreads` and `tvm.runtime.num_threads`
as a way to get the number of threads in use by the TVM runtime.

* check if equal to hardware threads or hardware threads/2
2022-04-05 11:24:37 +09:00
Masahiro Masuda 1b9b05e61d [CUTLASS] Profile only the largest-possible alignment by default (#10036)
* introduce profile_all_alignments option

* add profile_all_alignment option to API

* wip

* fixed dynamic case

* black

* update gen_gemm too

* minor improvement

* fix

* all tests work

* add doc

* fixed for sm = 75 case

* fix typo

* remove unused import

* profile_all -> find_first_valid

* fix
2022-01-26 15:42:54 +09:00
Krzysztof Parzyszek 751f83b565 Auto-discover C/C++ compiler instead of hardcoding g++ (#10007)
Some platforms (e.g. FreeBSD) use clang as the default OS compiler,
and there is no g++.
2022-01-21 13:25:08 -08:00
Philipp van Kempen cc5382ed41 Add runtime.ModuleGetFormat method enabling export of BYOC generated sources which require a .cpp/.cc file extension (#9243)
* Allow export of C++ kernels using correct file extension

* [WIP] Set module_key=c for CSourceCrtMetadataModuleNode to temporarily fix failing tests

I realized that the module format `cc` is currently already used by the `CSourceCrtMetadataModuleNode` declared in `src/target/source/source_module.cc`.
This needs to be discussed first to decide if either the module_key should be changed or the test cases expecting the systemlib kernel (e.g. `default_lib0.c`) to have a `.c` extension.

* Update Makefiles used by tests/python/relay/aot/ to support C++ file extensions

AOT: Add c++ support to aot_test.mk
AOT: Add c++ support to corstone300.mk

* Add missing definition of GetFormat to cmsisnn and ethosn codegens (WIP)

* Resolve PR comments

* lint python/tvm/runtime/module.py

* fix EthosUModuleNode for CI

* Fix: detect empty module.format

* Add error message to assertion

* Lint python/tvm/runtime/module.py
2022-01-20 06:48:07 +09:00
Tristan Konolige f1ca91d4e4 [GRAPH EXECUTOR,VM] Add benchmarking function to graph executor and vm (#8807)
* [GRAPH EXECUTOR,VM] Add benchmarking function to graph executor and vm

This new benchmarking function is just a convenience function for
calling time_evaluator on the underlying module. Hopefully this should
make it easier for users to get good benchmarks of their code.

* formatting

* import order

* more test, more comments, more precision

* fix tests

* add seconds descriptions to doc
2021-08-25 20:25:29 -05:00
Lunderberg a74d0fef35 [Codegen] Use "target.build.$TARGET_KIND" for all codegen functions. (#8071)
* [Codegen] Use "target.build.$TARGET_KIND" for all codegen functions.

- Removed special case for "micro_dev" target.  Instead, register
  BuildCHost as both "target.build.c" and "target.build.micro_dev".

- Renamed "target.build.build.aocl_sw_emu" to
  "target.build.aocl_sw_emu".  Appears to be a typo introduced in
  #841725cc585

* [micro_dev] Removed references to non-existent micro_dev

device_api.micro_dev was removed in
745e542e4d, but several references still
remained.

Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
2021-06-04 10:34:25 -07:00
XuanAnyvision 365484e054 allow module exits without del (#8063) 2021-05-18 08:58:56 -04:00
Y 82fecbfa66 [CodeGenC] Fix bugs when calling extern functions (#7911) 2021-04-26 08:28:35 -04:00
Jared Roesch fd18751e68 Add support for using the VM across the RPC boundary. (#7746)
* Get basic verison of VM RPC working

* Test case passes

* Clean up PR

* Lint

* Format

* Address Andrew R and TK feedback

* Add comment for Andrew

* Address Zhi's comment

* Format

* Fix broken test
2021-03-30 02:01:40 -07:00
Matt Welsh (OctoML) c39a6e25d5 Clean up uTVM demo runtime, add ONNX model test and tutorial (#7557)
* Some docstring fixes.

* Couple of small fixes:

- Use `west attach` instead of `west debug` in commandline to prevent
  debugger from resetting device.

- Fix warning on use of led_pin in zephyr-runtime/src/main.c.

* Adding Zephyr demo runtime.

* Cleanup of uTVM tests and demo runtime.

* Working on QEMU support.

Need to add board-specific prj.conf files.

* Adding board-specific prj.conf files.

* Some cleanup.

* Lots of hacking to get ONNX model to run on QEMU and nRF5340.

Added test_onnx unit test.

Still need to clean up tutorial.

* Adding data for unit tests.

* Cleanup demo_runtime code.

* Fix up tutorial.

* Couple of small fixes:

- Use `west attach` instead of `west debug` in commandline to prevent
  debugger from resetting device.

- Fix warning on use of led_pin in zephyr-runtime/src/main.c.

* Adding Zephyr demo runtime.

* Cleanup of uTVM tests and demo runtime.

* Working on QEMU support.

Need to add board-specific prj.conf files.

* Adding board-specific prj.conf files.

* Some cleanup.

* Lots of hacking to get ONNX model to run on QEMU and nRF5340.

Added test_onnx unit test.

Still need to clean up tutorial.

* Lots of hacking to get ONNX model to run on QEMU and nRF5340.

Added test_onnx unit test.

Still need to clean up tutorial.

* Adding data for unit tests.

* Cleanup demo_runtime code.

* Fix up tutorial.

* Fix tutorial.

* Fix tutorial and runtime.

* Fix merge conflicts.

* Fix merge conflict.

* Remove redundant files.

* Revert dep.

* Fixup

* Add new files to check_file_type.py.

* Adding missing ONNX file.

* Fixup docs.

* Fix linting rule.

* small fixes

* Add missing file to check_file_type.py.

* clang-format this file.

* Fix formatting.

* Black formatting.

* Lint comments.

* Fix path for test.

* Bump CI.

* Update from_onnx.

* fix path

* Fixing

* Revert dmlc-core to 21cc7de0dc9fd6acb796e1be6181fa8e6b6c8f41

* Fix path again.

* Fix tutorial to not use actual Zephyr.

* Revert submodule version change

* Fix bad merge.

* Trying to fix this mess.

* Fix formatting.

* context -> device

* Removing tutorial since I can't get it to pass CI.

Co-authored-by: Mehrdad Hessar <mehrdad.hessar@gmail.com>
Co-authored-by: Andrew Reusch <areusch@octoml.ai>
2021-03-28 21:06:15 -07:00
Haichen Shen fbfeee4ccb [Refactor] Rename TVMContext to Device (#7721) 2021-03-26 07:56:57 -04:00
Leyuan Wang b8b63cd1a4 add nvcc support (#7668) 2021-03-16 18:29:59 -04:00
Andrew Reusch ee052dd642 Introduce Model Library Format export format (#7533)
* Introduce Model Library Format export format.

 * This function produces a stable on-disk representation of TVM's
   compiler output.
 * It's intended just for use with the C runtime for microTVM right
   now. It could be expanded for other use cases.
 * This PR implements the Model Library Format RFC, which ultimately
   is intended to support the Project Generator API (RFC
   forthcoming).
 * There may be some changes to the format without revving the version
   number until downstream consumers are known. The Project Generator
   API is the first such known downstream consumer.
 * There are no plans currently to support generating old Model
   Library Format from TVM. The version number is intended as a
   compatibility check between the generator and downstream consumers.
2021-03-10 10:22:20 -05:00
manupa-arm 9713d675c6 Created CSourceMetaData module for model metadata (#7002)
* Created CSourceMetaData module for model metadata

* Currently, there is a MetaData module to capture constants
  conditionaly if the runtime modules implement const init
  PackedFuncs. However, this one relies on a load process
  in which the metadata is created on volatile memory that
  may be not usable in uTVM environments.
* There is a need for model level metadata that is valid
  across all runtime modules such as the func registry
  when creating a system-lib.
* This commit implements a CSoureMetaData module to hold
  func registry that collects function names from the
  runtime module and generates a c source file to be
  linked with final artifact.
* Modified and added export_library for utvm

Change-Id: Ie2e8e2aea1a66520f03fe8af7cc5bdf27339ea10

* Created CSourceMetaData module for model metadata

* fixed llvm_module to return null pfs for
  get_symbol and get_const_vars

Change-Id: I84810e0695d4d6fb314af2469117f965eed71b51

* Created CSourceMetaData module for model metadata

*fixed bundle_deploy tests

Change-Id: I0d1332a4abbb6830531784c59264021bbbd7148a

* Created CSourceMetaData module for model metadata

*fixed export_library not to insert "options" when targeting tar
*fixed unit tests

Change-Id: Ia1686889498b71af66f1a0311a059154ad3c2c3e

* Created CSourceMetaData module for model metadata

* enable wasm to support csource metadata module
* disabled non DSOExportables from using csource metadata module

Change-Id: Ie09beaad35cbc2ef738d1d24d91e249b5e099569

* Created CSourceMetaData module for model metadata

* changed const pfs to be called only on external modules
  or DSOExportable modules

Change-Id: I6ad28f166c0fc27a2548c851bf9287ec805550d1

* Created CSourceMetaData module for model metadata

* CSourceMetadata module wrapper is only created for c/llvm targets

Change-Id: I13cb4140c17e2e1f91d495b15a1ff7eeab9fb14d

* Created CSourceMetaData module for model metadata

*target should be defined to use csourcemetdata module

Change-Id: Id8e55b23d0007a79c550334de2c0fec63d40171f

* Created CSourceMetaData module for model metadata

* reinstate llvm func registry

Change-Id: I53e0754b6fb533637f08b25e98064d8c04092de4

* Created CSourceMetaData module for model metadata

* addressed comments and fixed bugs

Change-Id: I26401685dc803aeaf7642c865df88d683419e859

* Created CSourceMetaData module for model metadata

* addressed a missed comment

Change-Id: I65e65c30bc780a946f3f1b8372c40a49a5c20582

* Created CSourceMetaData module for model metadata

* te build interface should only include c-source metadata if
  targetting "c"

Change-Id: Ie23cb8c6231c1f2de6d2827084774e3510288098

* Created CSourceMetaData module for model metadata

* c_source modules should be created only if they are
  non-DSO exportable

Change-Id: I53f2f8e9caa41f133446f8881b9dc541ebeee8cc

* Created CSourceMetaData module for model metadata

* documetation misalignment in source_module.cc

Change-Id: I83e2c29b1f2980ca65a694304720dc58a5cb7879

* Created CSourceMetaData module for model metadata

* typo : same object file written as a dependency in the Makefile

Change-Id: I8becc4196d286cfb6372768687b3c836799dcb78

* Created CSourceMetaData module for model metadata

* removed unused param from a brief

Change-Id: Ie4db2aca3b7ea147bd8c65ef5d1cc2146f530e76

* Created CSourceMetaData module for model metadata

* made export library use c as the format for c source modules

Change-Id: Ie2fd6204414f0fa43988a8082d18af7a3225e237

* Created CSourceMetaData module for model metadata

*addressed a nit

Change-Id: I6084b8c06ddfaaece295439dbab589e6e202b664
2020-12-21 14:07:33 -08:00
Tianqi Chen c8064b3ca6 [REFACTOR] Remainings of util => utils (#6778) 2020-10-29 13:46:31 -04:00