Replies: 1 comment
-
|
Hi @hiq-lab 👋🏼 Moving this to the discussion tab as well, as it is not really an "issue" per-se and much better suited here. In principle, the idea of Rust bindings makes sense; both for implementing devices themselves, and for consuming them from Rust. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Motivation
QDMI currently provides a C API and a C tutorial for device implementations. As Rust adoption grows in the quantum computing ecosystem, official Rust bindings would lower the barrier for Rust-based quantum frameworks to integrate with QDMI.
We maintain Arvak, a Rust-native quantum compilation and orchestration platform. To use QDMI, we had to write our own FFI bindings — both for the client side (querying devices, submitting jobs) and the device side (implementing a QDMI device in Rust). These bindings are hand-written against the v1.2.1 headers and have been in production use.
What we'd contribute
A
qdmi-rscrate (orqdmi-sys+qdmisplit) providing:1. Low-level FFI (
qdmi-sys)Direct mapping of all QDMI C types and functions:
QDMI_STATUS→QdmiStatusenum withis_success())QDMI_Device,QDMI_Site,QDMI_Operation,QDMI_Job)QDMI_DEVICE_PROPERTY_T,QDMI_SITE_PROPERTY_T,QDMI_OPERATION_PROPERTY_T)QDMI_SESSION_PARAMETER_T,QDMI_DEVICE_SESSION_PARAMETER_T)QDMI_DEVICE_JOB_PARAMETER_T,QDMI_DEVICE_JOB_RESULT_T)qdmi_session_query_*,qdmi_device_query_*, etc.)2. Safe Rust wrappers (
qdmi)Ergonomic Rust API over the raw FFI:
QdmiSession,QdmiDevice,QdmiJobwith RAII (Drop-based cleanup)QdmiDeviceImpltrait instead of exporting C function pointers manuallyNULL→ allocate → query pattern is handled internally)Result<T, QdmiError>error handling instead of raw status code checking3. Device implementation via Rust traits
Instead of manually exporting prefixed C symbols, a device author would:
Current state of our bindings
Our FFI bindings cover QDMI v1.2.1 completely:
adapters/arvak-adapter-qdmi/src/ffi.rs— all session/device/job query functionscrates/arvak-qdmi/src/ffi.rs— device property keys, site/operation properties, prefix-aware dlsym loadingBoth are Apache-2.0 licensed and could serve as the starting point.
Benefits
bindgen, staying in sync with releasesHappy to discuss scope and submit a PR. We could start with just
qdmi-sys(raw FFI) and iterate on the safe wrapper API based on feedback.Beta Was this translation helpful? Give feedback.
All reactions