Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion docs/how_to/tutorials/customize_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@
from tvm import IRModule, relax
from tvm.relax.frontend import nn

# Note: This tutorial requires TVM CUDA support.
# If you encounter import errors:
# 1. First try: pip install tvm-ffi (from 3rdparty/tvm-ffi)
# 2. If that fails: Build TVM from source with CUDA enabled
# Build instructions: https://tvm.apache.org/docs/install/from_source.html

try:
import tvm.relax.backend.cuda.cublas as _cublas
except ImportError as e:
import sys

print("Error: TVM CUDA support required for this tutorial.", file=sys.stderr)
print("Solutions:", file=sys.stderr)
print(" 1. Install tvm-ffi: pip install tvm-ffi", file=sys.stderr)
print(
" 2. Build TVM with CUDA: https://tvm.apache.org/docs/install/from_source.html",
file=sys.stderr,
)
sys.exit(1)
# If import succeeds, continue with tutorial
# If you encounter 'No module named ''tvm_ffi''' error,
# you need to build TVM from source with CUDA enabled.
# Build instructions: https://tvm.apache.org/docs/install/from_source.html


######################################################################
# Composable IRModule Optimization
# --------------------------------
Expand Down Expand Up @@ -222,4 +247,3 @@ def transform_module(self, mod: IRModule, _ctx: tvm.transform.PassContext) -> IR
# We can easily compose the optimization passes and customize the optimization for different parts
# of the computation graph. The flexibility of the optimization pipeline enables us to quickly
# iterate the optimization and improve the performance of the model.
#