-
Notifications
You must be signed in to change notification settings - Fork 40
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
Pass the Py_LIMITED_API macro to Extensions #1385
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @rauletorresc, I think this should do it! 💯
Just had one comment, then I'll be happy to approve.
The last thing I'm concerned about is the third-party modules we (atleast attempt) to ship in our wheels:
For OQC the situation is rather confusing, the Python module is built separately from the device backend
catalyst/frontend/catalyst/third_party/oqc/src/CMakeLists.txt Lines 55 to 59 in 0719a87
but we only ship the device backend (without the module): Lines 196 to 197 in 0719a87
Furthermore, the only thing linking the module to the device backend is the compiler macro
To recap, the OQC plugin is still being built with Pybind11, which is not stable abi compatible, but the relevant module isn't even shipped in the wheels or configured for distribution 🤔 |
The OQD modules shouldn't cause issues with building the wheels with the stable ABI since they don't use the Python C API at all (for now, at least). For OQC, I think you're right that this is not correct. I just tried building the wheels locally and running a simple test and it fails: import pennylane as qml
from catalyst.third_party.oqc import OQCDevice
import os
os.environ["OQC_EMAIL"] = "email"
os.environ["OQC_PASSWORD"] = "password"
os.environ["OQC_URL"] = "oqc_url"
device = OQCDevice(backend="lucy", shots=1000, wires=1)
@qml.qjit
@qml.qnode(device)
def counts_1qbit(x: float):
qml.RX(x, wires=0)
return qml.counts()
counts_1qbit(1.0)
I think the reason we missed this is because I don't think the OQC issue is blocking this PR, but we should address it in a future PR. |
Furthermore, we skip the OQC frontend tests entirely if the catalyst/frontend/test/test_oqc/conftest.py Lines 22 to 27 in 0719a87
catalyst/frontend/test/test_oqc/conftest.py Lines 44 to 49 in 0719a87
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to approve, but we should look into the OQC issue I mentioned above.
So I think it's relevant to this PR in the sense that to properly ship OQC with the stable abi we need to convert it to nanobind, but you're right we can do this in a separate PR 👍 |
|
Context: Extensions also need to be informed about the usage of the limited API.
Description of the Change: Pass the
Py_LIMITED_API
macro to ExtensionsBenefits: Extensions will conform with the limited API.