Skip to content

Conversation

mtreinish
Copy link
Member

@mtreinish mtreinish commented Oct 17, 2025

Summary

This commit adds a new function to the C API,
qk_transpile_stage_init(), which is used to run just the init stage
of the preset pass manager. The intended use case for this is to enable
using stages from the preset pass manager with custom transpiler passes
to build custom compilation workflows from C.

Details and comments

This PR is based on top of #15200 and #15205 and will need to be rebased after both of those merge. In the meantime you can see the contents of just this PR by looking at the HEAD commit on this PR branch here: 94b290b

@mtreinish mtreinish added this to the 2.3.0 milestone Oct 17, 2025
@mtreinish mtreinish requested a review from a team as a code owner October 17, 2025 21:05
@mtreinish mtreinish added on hold Can not fix yet Changelog: New Feature Include in the "Added" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Oct 17, 2025
@mtreinish mtreinish added the C API Related to the C API label Oct 17, 2025
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

@mtreinish mtreinish moved this from Ready to Blocked in Qiskit 2.3 Oct 17, 2025
@coveralls
Copy link

coveralls commented Oct 17, 2025

Pull Request Test Coverage Report for Build 18746065048

Details

  • 243 of 278 (87.41%) changed or added relevant lines in 2 files are covered.
  • 22 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.02%) to 88.195%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/transpiler/src/transpiler.rs 208 223 93.27%
crates/cext/src/transpiler/transpile_function.rs 35 55 63.64%
Files with Coverage Reduction New Missed Lines %
crates/circuit/src/parameter/parameter_expression.rs 1 81.99%
crates/qasm2/src/expr.rs 1 93.82%
crates/transpiler/src/transpiler.rs 2 93.42%
crates/qasm2/src/lex.rs 4 91.52%
crates/qasm2/src/parse.rs 6 96.62%
crates/circuit/src/parameter/symbol_expr.rs 8 72.86%
Totals Coverage Status
Change from base Build 18725764531: -0.02%
Covered Lines: 93572
Relevant Lines: 106097

💛 - Coveralls

For the rust function that implements the `qk_transpile()` C API it was
originally written as a single function where the full "staged pass
manager" was just a rust function and the pass manager logic was just
the logic inside that function. This worked fine and provided a full
pipeline as a single entrypoint which was the desire for qk_transpile.
However, with the plans to expose DAGCircuit to rust (see Qiskit#15187) to
facilitate creating custom transpiler passes from C. To enable users to
pair custom passes with the default workflow it will be useful to
expose the preset stages to C as well.

This commit is the first step towards that, as it splits the stages
from the `qk_transpile()` into standalone rust functions. Each stage
gets it's own function which can be called independently. These new
functions have public visibility because the goal is that these will
be exposed to C. Following on from this PR separate PRs will be
opened for each stage that expose these new functions to the C API
and enable using them in custom transpilation workflows.
This commit adds a new function to the C API,
`qk_transpile_stage_init()`, which is used to run just the init stage
of the preset pass manager. The intended use case for this is to enable
using stages from the preset pass manager with custom transpiler passes
to build custom compilation workflows from C.
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 on hold Can not fix yet

Projects

Status: Blocked

Development

Successfully merging this pull request may close these issues.

3 participants