yongwww commented on code in PR #18697:
URL: https://github.com/apache/tvm/pull/18697#discussion_r2790850936


##########
docs/how_to/tutorials/customize_opt.py:
##########
@@ -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)

Review Comment:
   the package is `apache-tvm-ffi`



##########
docs/how_to/tutorials/customize_opt.py:
##########
@@ -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)

Review Comment:
   we can consider something like:
   
   ```
   try:
       import tvm.relax.backend.cuda.cublas as _cublas
   except ImportError as e:
       raise ImportError(
           "This tutorial requires TVM built with CUDA support.\n"
           "If you hit missing 'tvm_ffi', try: pip install apache-tvm-ffi\n"
           "Otherwise build TVM with CUDA enabled:\n"
           "  https://tvm.apache.org/docs/install/from_source.html\n";
           f"Original error: {e}"
       ) from e
   ```



##########
docs/how_to/tutorials/customize_opt.py:
##########
@@ -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)

Review Comment:
   let's remove the sys.exit and raise the exception here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to