Skip to content

Conversation

zydxt
Copy link

@zydxt zydxt commented Jun 3, 2025

This PR fixes ABI compatibility issues that caused undefined symbol errors when loading ktransformers.

Previously, KTransformersOps was compiled without explicitly setting the C++ ABI flag. This meant it might use a different ABI than installed PyTorch, leading to runtime errors like
KTransformersOps.cpython-311-x86_64-linux-gnu.so: undefined symbol: _ZN3c106detail23torchInternalAssertFailEPKcS2_jS2_RKSs.

This change ensures that KTransformersOps is now compiled with the correct C++ ABI flag (-D_GLIBCXX_USE_CXX11_ABI=0 or 1) that matches PyTorch installation.

The core change involves updating setup.py to correctly apply the ABI flag to nvcc and mcc compilation steps, aligning with PyTorch's requirements.

The function get_compile_abi_args has been renamed to get_cmake_abi_args. While the original name might suggest it's only for CMake arguments, this function is now used to generate ABI-specific compiler flags for both CMake-based extensions and direct CUDAExtension/MUSAExtension compilations.

@Atream
Copy link
Contributor

Atream commented Jun 15, 2025

Thank you for your contribution!
But I think PyTorch Extension will automatically add the ABI parameter during compilation.
I will check it.

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