Skip to content

Commit

Permalink
adding pickling support
Browse files Browse the repository at this point in the history
this actually requires dill since HLSConfig includes a lambda function
for comparing circuits obtained with different synthesis plugins,
but fortunately it's all already supported
  • Loading branch information
alexanderivrii committed Feb 12, 2025
1 parent 2a818c5 commit 03a646c
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion crates/accelerate/src/high_level_synthesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl QubitTracker {
}

/// Internal class that encapsulates immutable data required by the HighLevelSynthesis transpiler pass.
#[pyclass]
#[pyclass(module="qiskit._accelerate.high_level_synthesis")]
#[derive(Clone, Debug)]
pub struct HighLevelSynthesisData {
// The high-level-synthesis config that specifies the synthesis methods
Expand Down Expand Up @@ -280,6 +280,35 @@ impl HighLevelSynthesisData {
}
}

pub fn __getnewargs__(
&self,
py: Python,
) -> (
Py<PyAny>,
Py<PyAny>,
Vec<String>,
Py<PyAny>,
Option<Py<Target>>,
Option<Py<EquivalenceLibrary>>,
HashSet<String>,
bool,
usize,
bool,
) {
(
self.hls_config.clone_ref(py),
self.hls_plugin_manager.clone_ref(py),
self.hls_op_names.clone(),
self.coupling_map.clone_ref(py),
self.target.clone(),
self.equivalence_library.clone(),
self.device_insts.clone(),
self.use_qubit_indices,
self.min_qubits,
self.unroll_definitions,
)
}

pub fn get_hls_config(&self) -> &Py<PyAny> {
&self.hls_config
}
Expand Down

0 comments on commit 03a646c

Please sign in to comment.