Skip to content

Conversation

@tqchen
Copy link
Member

@tqchen tqchen commented Mar 6, 2025

In the past we maintained both ctypes fallback and cython path for our FFI. One reason was cython was not that widely available then. The situation has changed, so this PR removes the ctypes fallback so we can focus on building cython based core for FFI.

Notably, the cython core still leverages ctypes, especially for some of the features that do not need fast path, and primarily uses cython to speedup core FFI features with fast path.

With cython, we can get most FFI costs down to level of roughtly 1e-6 sec, which aligns with most of the costs like overhead of a numpy operation.

tqchen added 3 commits March 6, 2025 17:02
In the past we maintained both ctypes fallback and cython path for our FFI.
One reason was cython was not that widely available then.
The situation has changed, so this PR removes the ctypes fallback
so we can focus on building cython based core for FFI.

Notably, the cython core still leverages ctypes, especially for
some of the features that do not need fast path, and primarily
uses cython to speedup core FFI features with fast path.

With cython, we can get most FFI costs down to level
of roughtly 1e-6 sec, which aligns with most of the costs like
overhead of a numpy operation.
@tqchen
Copy link
Member Author

tqchen commented Mar 7, 2025

@tvm-bot rerun

@yongwww yongwww merged commit 59d4077 into apache:main Mar 8, 2025
15 checks passed
ShiboXing pushed a commit to ShiboXing/tvm that referenced this pull request Aug 10, 2025
* [FFI] Phase out ctypes fallback in favor of cython

In the past we maintained both ctypes fallback and cython path for our FFI.
One reason was cython was not that widely available then.
The situation has changed, so this PR removes the ctypes fallback
so we can focus on building cython based core for FFI.

Notably, the cython core still leverages ctypes, especially for
some of the features that do not need fast path, and primarily
uses cython to speedup core FFI features with fast path.

With cython, we can get most FFI costs down to level
of roughtly 1e-6 sec, which aligns with most of the costs like
overhead of a numpy operation.

* fix lint

* Fix the dso loading issue
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