gemini-code-assist[bot] commented on code in PR #241:
URL: https://github.com/apache/tvm-ffi/pull/241#discussion_r2506072371
##########
python/tvm_ffi/_optional_torch_c_dlpack.py:
##########
@@ -102,9 +102,10 @@ def load_torch_c_dlpack_extension() -> Any:
return lib
except ImportError:
pass
- except Exception as e:
+ except Exception:
warnings.warn(
- f"Failed to load torch c dlpack extension, EnvTensorAllocator will
not be enabled:\n {e}"
+ "Failed to JIT torch c dlpack extension, EnvTensorAllocator will
not be enabled.\n"
+ "You may try AOT-module via `pip install torch-c-dlpack-ext`"
)
Review Comment:

Changing `except Exception as e:` to `except Exception:` is generally
discouraged as it swallows the exception details, making debugging failures in
the JIT compilation process much harder. It would be beneficial to restore
capturing the exception and include its message in the warning.
```suggestion
except Exception as e:
warnings.warn(
"Failed to JIT torch c dlpack extension, EnvTensorAllocator will
not be enabled.\n"
f"Reason: {e}\n"
"You may try AOT-module via `pip install torch-c-dlpack-ext`"
)
```
##########
addons/torch_c_dlpack_ext/README.md:
##########
@@ -16,10 +16,13 @@
<!--- under the License. -->
# Torch C DLPack Extension
-This folder contains the source for the `torch-c-dlpack-ext` package, which
provides an Ahead-Of-Time (AOT) compiled module to support faster DLPack
conversion.
-This module will likely become unnecessary once PyTorch releases include
DLPack v1.2 support.
-By default, `tvm-ffi` will JIT-compile a version of this functionality during
loading.
-Installing this wheel allows users to avoid this JIT compilation overhead.
+This folder contains the source for the `torch-c-dlpack-ext` package, which
provides an
+Ahead-Of-Time (AOT) compiled module to support faster DLPack conversion in
DLPack v1.2.
+By default, `tvm-ffi` will JIT-compile a version of this functionality during
loading,
+and use a safe-fallback if JIT-compilation fails.
+Installing this wheel allows users to avoid this JIT compilation overhead and
+also avoid the cases where user environment do not have necessarily compiler
toolchain
+to run JIT-compile.
Review Comment:

There's a minor grammatical issue in this sentence. For better clarity, I
suggest rephrasing it.
```suggestion
also avoid the cases where the user environment does not necessarily have a
compiler toolchain
to run JIT-compilation.
```
--
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]