Skip to content

[DOCS] Document Python FFI conversion protocols#622

Merged
junrushao merged 1 commit into
apache:mainfrom
tqchen:tvm-ffi-document-python-ffi-conversion-magic-methods
Jun 16, 2026
Merged

[DOCS] Document Python FFI conversion protocols#622
junrushao merged 1 commit into
apache:mainfrom
tqchen:tvm-ffi-document-python-ffi-conversion-magic-methods

Conversation

@tqchen

@tqchen tqchen commented Jun 16, 2026

Copy link
Copy Markdown
Member

This documents the Python argument conversion protocols recognized when calling TVM-FFI functions.

Summary:

  • Add a Python guide subsection for argument conversion protocols.
  • Document the supported __tvm_ffi_* hooks and __cuda_stream__ in a protocol table.
  • Point DLPack-compatible objects to the DLPack protocol documentation.
  • Add a cross-reference from the Function and Module concept page.

Validation:

  • pre-commit run --files docs/guides/python_lang_guide.md docs/concepts/func_module.rst
  • uv run --group docs sphinx-build -M html docs docs/_build

@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 adds comprehensive documentation for Python argument conversion protocols in TVM FFI, explaining how Python values are converted to the FFI Any calling convention and detailing various special protocol hooks (such as __tvm_ffi_object__, __tvm_ffi_value__, and __cuda_stream__). A review comment points out a misleading description in the documentation table for the __cuda_stream__(self) protocol, suggesting it should be corrected to clarify that it returns an integer stream pointer rather than a protocol object.

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 docs/guides/python_lang_guide.md Outdated
@tqchen tqchen force-pushed the tvm-ffi-document-python-ffi-conversion-magic-methods branch from 3248f49 to ed345f2 Compare June 16, 2026 13:18
@junrushao junrushao merged commit 807b17a into apache:main Jun 16, 2026
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.

2 participants