TVM Errors

TVM may raise errors from Python code, from C++ code reached through the FFI, or from generated runtime modules. Error messages usually include a Python stack trace, and may also include a C++ stack trace when the error crosses the TVM FFI boundary.

Some errors report invalid user input, unsupported operators, missing runtime features, or unavailable hardware. Others report a failed internal check, usually raised by TVM_FFI_ICHECK or TVM_FFI_THROW in C++ code. Internal check failures often indicate that TVM reached a state that the implementation did not expect.

What to Check First

  • Make sure the TVM Python package and native libraries come from the same build. A common symptom of a mismatched environment is importing Python files from one checkout while loading libtvm from another.

  • Check that the required runtime is enabled in config.cmake. For example, CUDA tests and CUDA compilation require a TVM build with CUDA support enabled.

  • Check that the target hardware is available to the process. GPU tests may be skipped or fail if the device is not visible inside the current container or environment.

  • If the error occurs while importing or converting a model, reduce the input to the smallest model, operator, or shape that reproduces the issue.

Reporting an Issue

Search the Apache TVM Discuss Forum and the TVM issue tracker for the exact error message first. If you do not find an existing report, include the following details when starting a new discussion or filing an issue:

  • The TVM version or git commit hash.

  • The Python version, operating system, and hardware.

  • The target and runtime being used, such as LLVM, CUDA, Vulkan, or RPC.

  • The relevant build configuration from config.cmake.

  • A minimal script, model, input shape, or IR module that reproduces the failure.

  • The full error message, including both Python and C++ stack traces when present.

Developer Notes

For guidance on raising typed errors from TVM code, see Error Handling Guide. That guide covers when to use specific error types, how C++ error prefixes map to Python exceptions, and how TVM_FFI_ICHECK interacts with TVM’s error handling.