gemini-code-assist[bot] commented on code in PR #18785:
URL: https://github.com/apache/tvm/pull/18785#discussion_r2812733859
##########
python/tvm/runtime/module.py:
##########
@@ -472,6 +473,8 @@ def enabled(target):
>>> tvm.runtime.enabled("gpu")
"""
+ if hasattr(target, "kind"):
+ target = str(target.kind)
return _ffi_api.RuntimeEnabled(target)
Review Comment:

The `enabled` function has been updated to handle `tvm.target.Target`
objects, but it doesn't handle dictionary-style target specifications. If a
dictionary like `{'kind': 'llvm'}` is passed, it will be passed to the FFI as a
string representation of the dictionary, which is not what
`_ffi_api.RuntimeEnabled` expects. It should extract the `kind` from the
dictionary. This could lead to incorrect behavior where a runtime is reported
as disabled when it is actually enabled.
```suggestion
if isinstance(target, dict):
target = target.get("kind", "")
elif hasattr(target, "kind"):
target = str(target.kind)
```
--
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]