..  Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

..    http://www.apache.org/licenses/LICENSE-2.0

..  Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.


Handle TVM Errors
=================

When running TVM, you may encounter an error message like:

.. code::

    ---------------------------------------------------------------
    An error occurred during the execution of TVM.
    For more information, please see: https://tvm.apache.org/docs/errors.html
    ---------------------------------------------------------------

Congratulations! You found this page. Below are some hints on how to interpret
these error messages and what you can do when they occur.

Where do these errors come from?
--------------------------------

This error is caused by an internal invariant being violated during TVM's
execution. On a technical level, the message is generated by the
``TVM_FFI_ICHECK`` macro, found in ``3rdparty/tvm-ffi/include/tvm/ffi/error.h``.
The ``TVM_FFI_ICHECK`` macro is used in many places in the TVM code to assert
some condition is true during execution; any time the assertion fails, TVM
will exit with the error message shown above.

For more details about how errors are handled and generated by TVM, please
see :ref:`error-handling-guide`.

What should I do when I encounter such an error?
------------------------------------------------

First of all, *don't panic*. Well, you can panic, but it won't help.

The best course of action is to search the
`Apache TVM Discuss Forum <https://discuss.tvm.apache.org/>`_
for the error you are encountering, to see if this has been a problem
that others have encountered, and what the solution might be.
If this error is the result of a bug that has been fixed in a more
recent version of TVM, you may need to update to a newer version.

If you do not find an existing Discuss Forum thread about your
issue, you are welcome to start a new thread on the forum with details
on the problem. *Please* include in your posting the following key
pieces of information:

* The version of TVM you are using (e.g., the git commit hash of your source tree).
* Which hardware and operating system version you are running TVM on.
* Which hardware device and OS you are targeting for your TVM compilation.
* Details on the model, inputs, or other information about the workload, which can
  be used to reproduce your problem.

Without these details it is very difficult for the TVM developers to do very
much to help you.
