Skip to content

[WIP] C API: Burn ConsolidateBlocks #14751

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

raynelfss
Copy link
Contributor

@raynelfss raynelfss commented Jul 16, 2025

Summary

Add qk_transpiler_pass_standalone_consolidate_blocks to expose a version of the ConsolidateBlocks pass to C. The pass runs on an instance of CircuitData and an optional Target.

Pre-requisites:

Details and comments

Built on top of #14748 needs to be rebased after it merges.
Closes #14447

@raynelfss raynelfss added this to the 2.2.0 milestone Jul 16, 2025
@raynelfss raynelfss added Changelog: New Feature Include in the "Added" section of the changelog C API Related to the C API mod: transpiler Issues and PRs related to Transpiler labels Jul 16, 2025
@raynelfss raynelfss changed the title [WIP][C API] Burn ConsolidateBlocks [WIP] C API Burn ConsolidateBlocks Jul 16, 2025
@raynelfss raynelfss changed the title [WIP] C API Burn ConsolidateBlocks [WIP] C API: Burn ConsolidateBlocks Jul 16, 2025
@coveralls
Copy link

coveralls commented Jul 16, 2025

Pull Request Test Coverage Report for Build 16524455693

Details

  • 26 of 121 (21.49%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.08%) to 87.669%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/cext/src/transpiler/passes/consolidate_blocks.rs 24 26 92.31%
crates/transpiler/src/passes/consolidate_blocks.rs 2 95 2.11%
Files with Coverage Reduction New Missed Lines %
crates/circuit/src/symbol_expr.rs 1 73.98%
crates/qasm2/src/expr.rs 1 93.63%
crates/qasm2/src/lex.rs 4 91.49%
Totals Coverage Status
Change from base Build 16508029389: -0.08%
Covered Lines: 81460
Relevant Lines: 92918

💛 - Coveralls


/// Helper function that extracts the decomposer and basis gate directly from the [Target].
#[inline]
fn get_decomposer_and_basis_gate(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be integrated into the internal rust API. We will need a rust entrypoint that has the signature of the C API to call from the transpile() function. The C API should be doing appreciable logic like this it should just mirror the request to the rust api and handle basic type conversion from the limitations of the FFI boundary to something more rust native.

@raynelfss raynelfss force-pushed the burn-consolidate-blocks branch 3 times, most recently from 41f7c26 to 3fa83b9 Compare July 24, 2025 19:08
raynelfss and others added 6 commits July 25, 2025 10:18
Built on top of Qiskit#14748.
The following commit adds the ability for the `ConsolidateBlocks` pass to instantiate decomposers and choose a basis gate based on the provided `Target`. In  the case that a `Target` is not provided, it will default to a `TwoBasisDecomposer` with a `CX` gate.
- Add `qk_transpiler_pass_standalone_consolidate_blocks` to expose a version of the `ConsolidateBlocks` pass to C. The pass runs on an instance of `CircuitData` and an optional `Target`.
@raynelfss raynelfss force-pushed the burn-consolidate-blocks branch from f526557 to 2e079bc Compare July 25, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C API Related to the C API Changelog: New Feature Include in the "Added" section of the changelog mod: transpiler Issues and PRs related to Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ConsolidateBlocks to the C API
3 participants