From 0f6037c19393d7678147194117aa783695a1549c Mon Sep 17 00:00:00 2001 From: Gavin Uberti Date: Wed, 14 Dec 2022 15:10:51 -0800 Subject: [PATCH] Extend TVM tutorials in Colab --- gallery/how_to/extend_tvm/bring_your_own_datatypes.py | 7 +++++++ gallery/how_to/extend_tvm/low_level_custom_pass.py | 7 +++++++ gallery/how_to/extend_tvm/use_pass_infra.py | 8 ++++++++ gallery/how_to/extend_tvm/use_pass_instrument.py | 8 +++++++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/gallery/how_to/extend_tvm/bring_your_own_datatypes.py b/gallery/how_to/extend_tvm/bring_your_own_datatypes.py index 479269a224a3f..b82039d67b312 100644 --- a/gallery/how_to/extend_tvm/bring_your_own_datatypes.py +++ b/gallery/how_to/extend_tvm/bring_your_own_datatypes.py @@ -23,6 +23,13 @@ Note that the Bring Your Own Datatypes framework currently only handles **software emulated versions of datatypes**. The framework does not support compiling for custom accelerator datatypes out-of-the-box. +To start, we must install TVM and MXNet (we will use a model from MXNet's model zoo): + +.. code-block:: bash + + %%shell + pip install apache-tvm mxnet + Datatype Libraries ------------------ diff --git a/gallery/how_to/extend_tvm/low_level_custom_pass.py b/gallery/how_to/extend_tvm/low_level_custom_pass.py index 0f99c72cee9cc..ae94cb70eb36f 100644 --- a/gallery/how_to/extend_tvm/low_level_custom_pass.py +++ b/gallery/how_to/extend_tvm/low_level_custom_pass.py @@ -39,6 +39,13 @@ - How a Schedule is lowered to either an IRModule class or a LLVM module. Otherwise, take a look at ``python/tvm/build_module.py`` to get some basics. +TVM must also be installed, either from source or with a package manager: + +.. code-block:: bash + + %%shell + pip install apache-tvm + """ # sphinx_gallery_start_ignore diff --git a/gallery/how_to/extend_tvm/use_pass_infra.py b/gallery/how_to/extend_tvm/use_pass_infra.py index a41a26fc0b1e2..aa7f5070e5788 100644 --- a/gallery/how_to/extend_tvm/use_pass_infra.py +++ b/gallery/how_to/extend_tvm/use_pass_infra.py @@ -38,6 +38,14 @@ This tutorial mainly demonstrates how developers can use the pass infra to perform a certain optimization and create an optimization pipeline for a Relay program. The same approach can be used for tir as well. + +To start, we'll install TVM: + +.. code-block:: bash + + %%shell + pip install apache-tvm + """ # sphinx_gallery_start_ignore diff --git a/gallery/how_to/extend_tvm/use_pass_instrument.py b/gallery/how_to/extend_tvm/use_pass_instrument.py index 3079e2f0e7639..62e390fd3f1f9 100644 --- a/gallery/how_to/extend_tvm/use_pass_instrument.py +++ b/gallery/how_to/extend_tvm/use_pass_instrument.py @@ -31,7 +31,13 @@ but an extension mechanism is available via the :py:func:`tvm.instrument.pass_instrument` decorator. This tutorial demonstrates how developers can use ``PassContext`` to instrument -passes. Please also refer to the :ref:`pass-infra`. +passes. Please also refer to the :ref:`pass-infra`. To start, we'll install TVM: + +.. code-block:: bash + + %%shell + pip install apache-tvm + """ # sphinx_gallery_start_ignore