gemini-code-assist[bot] commented on code in PR #671:
URL: https://github.com/apache/tvm-ffi/pull/671#discussion_r3591798503
##########
python/tvm_ffi/cython/device.pxi:
##########
@@ -115,13 +115,8 @@ cdef class Device:
}
_DEVICE_NAME_TO_TYPE = {
- "llvm": DLDeviceType.kDLCPU,
"cpu": DLDeviceType.kDLCPU,
- "c": DLDeviceType.kDLCPU,
- "test": DLDeviceType.kDLCPU,
"cuda": DLDeviceType.kDLCUDA,
- "nvptx": DLDeviceType.kDLCUDA,
- "cl": DLDeviceType.kDLOpenCL,
"opencl": DLDeviceType.kDLOpenCL,
"vulkan": DLDeviceType.kDLVulkan,
"metal": DLDeviceType.kDLMetal,
Review Comment:

There is an inconsistency between the Python `Device` constructor and the
C++ FFI parser (`include/tvm/ffi/device.h`). The C++ parser accepts `"mps"`
(mapping to `kDLMetal`) and `"wgpu"` (mapping to `kDLWebGPU`), which means
`A(tvm_ffi.Device).convert("mps")` succeeds, but direct construction via
`tvm_ffi.device("mps")` raises a `ValueError`.
To ensure consistency, we should add `"mps"` (and `"wgpu"` if possible,
though `"webgpu"` is outside this diff hunk) to `_DEVICE_NAME_TO_TYPE` in
Python.
```
_DEVICE_NAME_TO_TYPE = {
"cpu": DLDeviceType.kDLCPU,
"cuda": DLDeviceType.kDLCUDA,
"opencl": DLDeviceType.kDLOpenCL,
"vulkan": DLDeviceType.kDLVulkan,
"metal": DLDeviceType.kDLMetal,
"mps": DLDeviceType.kDLMetal,
```
--
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]