Skip to content

Conversation

@raynelfss
Copy link
Contributor

@raynelfss raynelfss commented Dec 17, 2025

Summary

Fixes #15438
Due to our decision of provisionally exposing parameters in QkTargetOp as double[] we mistakenly filtered out any non-fixed parameters instead of showing a placeholder value. This PR provisionally exposes any non-fixed parameter instance as NaN until we work out a much cleaner way of exposing the parameters to C. This PR now exposes QkParam directly by having the params attribute be an array of QkParam.

Details and comments

  • Add release note.

@raynelfss raynelfss added stable backport potential The bug might be minimal and/or import enough to be port to stable C API Related to the C API labels Dec 17, 2025
@coveralls
Copy link

coveralls commented Dec 17, 2025

Pull Request Test Coverage Report for Build 20375166055

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 3 of 7 (42.86%) changed or added relevant lines in 1 file are covered.
  • 37 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.003%) to 88.3%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/cext/src/transpiler/target.rs 3 7 42.86%
Files with Coverage Reduction New Missed Lines %
crates/cext/src/transpiler/target.rs 1 86.59%
crates/qasm2/src/lex.rs 5 91.77%
crates/circuit/src/parameter/symbol_expr.rs 9 72.94%
qiskit/providers/basic_provider/basic_simulator.py 10 96.77%
crates/qasm2/src/parse.rs 12 96.62%
Totals Coverage Status
Change from base Build 20304825545: 0.003%
Covered Lines: 96705
Relevant Lines: 109519

💛 - Coveralls

@raynelfss raynelfss added this to the 2.3.0 milestone Dec 17, 2025
Copy link
Collaborator

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

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

From a bugfix POV I don't think we need to backport this (since we can't create a C Target object that would have params of unknown length). But from an interface POV this PR changes an all-free params from a NULL pointer to an array of f64::NAN and it would be good to not change this interface between 2.3 and 2.4, which makes it backportable IMO.

Comment on lines 1347 to 1348
/// it will be represented as with the `NaN` value. If there are no parameters
/// then this value will be represented with a `NULL` pointer.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This last part isn't true anymore, is it? If all parameters are free then we'd still have an array with all f64::NAN entries, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I could've worded it better. But what I meant was if the operation doesn't accept any parameters.

We pivoted the approach, after internal discussion, to use `QkParam` instead.
- Since the `QkTarget` instance owns the params. We should be able to retrieve the operation's parameters without cloning by turning references into pointers.
@raynelfss raynelfss marked this pull request as ready for review December 19, 2025 15:58
@raynelfss raynelfss requested a review from a team as a code owner December 19, 2025 15:58
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

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 stable backport potential The bug might be minimal and/or import enough to be port to stable

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

Fix tracking of parameters in instances of QkTargetOp

4 participants