Skip to content

Fix: Remove misleading py_limited_api=cp39 wheel tag for PyTorch extension#1

Merged
aw920h merged 1 commit into
mainfrom
fix-abi3-wheel-tag
May 2, 2026
Merged

Fix: Remove misleading py_limited_api=cp39 wheel tag for PyTorch extension#1
aw920h merged 1 commit into
mainfrom
fix-abi3-wheel-tag

Conversation

@aw920h
Copy link
Copy Markdown
Owner

@aw920h aw920h commented May 2, 2026

Description

This PR removes the options={"bdist_wheel": {"py_limited_api": "cp39"}} argument from hopper/setup.py.

Why is this necessary?

Currently, the build system forces the generated wheels to be tagged as cp39-abi3. While this implies the wheel is portable across Python 3.9+ environments, Flash Attention 3 is a PyTorch C++ extension.

PyTorch C++ extensions are strictly linked to the PyTorch C++ ABI (e.g., libtorch_python.so), which changes between PyTorch versions.

If a user compiles FA3 on Python 3.11 with PyTorch 2.11, the wheel is tagged cp39-abi3. If they then attempt to install this wheel on a Python 3.9 environment (which requires an older PyTorch version since 2.11 dropped 3.9 support), the installation succeeds, but importing the module results in a fatal crash:
ImportError: undefined symbol: aoti_torch_create_device_guard

The Fix

By removing the py_limited_api override, setuptools will correctly tag the wheel with the exact CPython version it was built against (e.g., cp311-cp311). This prevents users from sharing incompatible wheels across different Python/PyTorch environments and encountering silent ABI linker errors.

@aw920h aw920h merged commit 9343372 into main May 2, 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.

1 participant