gemini-code-assist[bot] commented on code in PR #18696:
URL: https://github.com/apache/tvm/pull/18696#discussion_r2741829713
##########
docs/how_to/tutorials/customize_opt.py:
##########
@@ -103,7 +109,17 @@ def forward(self, x):
# Import cublas pattern
-import tvm.relax.backend.cuda.cublas as _cublas
+try:
+ import tvm.relax.backend.cuda.cublas as _cublas
+except ImportError as e:
+ if "tvm_ffi" in str(e):
+ print("Error: TVM needs to be built with CUDA support.")
+ print("Please build TVM from source with CUDA enabled.")
+ print("See: https://tvm.apache.org/docs/install/from_source.html")
+ import sys
Review Comment:

Error messages should be printed to standard error (`stderr`) instead of
standard output (`stdout`). This is a standard practice for separating
diagnostic output from normal program output. Also, it's better to move the
`import sys` statement to the top of the `except` block.
```suggestion
import sys
print("Error: TVM needs to be built with CUDA support.",
file=sys.stderr)
print("Please build TVM from source with CUDA enabled.",
file=sys.stderr)
print("See: https://tvm.apache.org/docs/install/from_source.html",
file=sys.stderr)
```
##########
docs/how_to/tutorials/customize_opt.py:
##########
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one
+# Licensed to the Apache Software Foundation (ASF) under one
Review Comment:

This line contains a Unicode Byte Order Mark (BOM) `\ufeff`, which is
unnecessary for UTF-8 encoded files and can cause issues with some tools. It
should be removed.
```suggestion
# Licensed to the Apache Software Foundation (ASF) under one
```
##########
docs/how_to/tutorials/customize_opt.py:
##########
@@ -223,3 +239,5 @@ def transform_module(self, mod: IRModule, _ctx:
tvm.transform.PassContext) -> IR
# of the computation graph. The flexibility of the optimization pipeline
enables us to quickly
# iterate the optimization and improve the performance of the model.
#
+
+
Review Comment:

There are multiple empty lines at the end of the file. It's a common
convention to have only a single newline at the end of a file. Please remove
the extra ones.
--
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]