Skip to content

fix(device): require canonical Python device names#671

Merged
tqchen merged 3 commits into
apache:mainfrom
tqchen:tvm-ffi-remove-adhoc-device-kind-mapping
Jul 16, 2026
Merged

fix(device): require canonical Python device names#671
tqchen merged 3 commits into
apache:mainfrom
tqchen:tvm-ffi-remove-adhoc-device-kind-mapping

Conversation

@tqchen

@tqchen tqchen commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • remove the Python-only llvm, c, test, nvptx, and cl device aliases
  • retain canonical device names and their existing error behavior
  • cover direct construction and typed FFI conversion rejection

Testing

  • pytest -o addopts= tests/python/test_device.py tests/python/test_function.py tests/python/test_type_converter.py
  • scoped pre-commit hooks, including Ruff, Cython lint, and ty

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes non-canonical device aliases (such as "llvm", "c", "test", "nvptx", and "cl") from the Cython device mapping and adds corresponding tests to ensure they are rejected. The reviewer noted an inconsistency where the C++ FFI parser accepts "mps" and "wgpu" but the Python constructor does not, and suggested adding "mps" to the mapping to maintain consistency.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread python/tvm_ffi/cython/device.pxi
@tqchen
tqchen merged commit 5fbad39 into apache:main Jul 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants