-
Notifications
You must be signed in to change notification settings - Fork 22.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.12.1 incompatible with c++ built for 1.12.0 and vice versa #88301
Comments
In general, there are no guarantee for binary compatibility between even the patch versions (as adding a new virtual function to base class will offset But the change as you are describing it a bit unexpected |
Hmm, is this OS specific, as I see
|
The interface between python and the compiled c++ extension module is ultimately an interpreted interface, if I'm not mistaken.
The use of
Yes this does appear to be specific to Linux. I just tried on Windows with the same result as you found on MacOS. But for Linux your test command gives |
Possibly related #80489? |
Sorry this is incorrect, I get |
I though about that, but c++ ABI changes should not result in different namespaces |
@charliebudd not sure what original post you are referring to, but can you please post somewhere what issue are you seeing. In 1.12 builds we've migrated to a newer compiler, which resulted in binary incompatibility between CUDA and CPU wheels, which I've fixed by explicitly specifying c++abi version. (one can check the ABI version using |
Sorry the conditions appear harder to replicate than I thought, I'll try and put together a reproducible example. |
Okay, I've made a gist demonstrating the issue... Just create a virtual environment and run the I struggled to recreate the issue, as it seems to depend on exactly what wheel you install. As my build system needs to use torch versions with specific backends, I'm installing torch versions in the following way... If you simply |
🐛 Describe the bug
I have a c++/cuda extension which I compile and distribute via PyPI. My build matrix covers all "recent" PyTorch major and minor versions (aswell as python and CUDA versions, if anybody is interest I host my build system as a git workflow here). So far this has been enough to ensure my code runs and I have not had to take patch version into account. However, I have recently had an issue (described below) with 1.12.1. My understanding is that only critical bug fixes should be released in patches. If this is not the case, then distributing built c++ PyTorch extensions would be even harder than it currently is.
The error I get is when passing a jit model down to c++. Before 1.12.1, the _c attribute on a jit script model returned a
torch.jit.ScriptModule
which will cast to atorch::jit::Module
when passed to a c++ function. However, in 1.12.1, the _c attribute returns atorch.ScriptModule
which no longer casts in the same way, causing an exception to be thrown.Minimal code example below. To recreate, compile the c++ for torch 1.12.0 and run the python script with torch 1.12.1 and/or vice versa. When the version matches, the code will run fine, else there is an error.
See forum discussion on this issue here.
Versions
torch 1.12.0 and 1.12.1
cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel @jbschlosser
The text was updated successfully, but these errors were encountered: