Repository navigation
dagcircuit: transfer DAG-level variables in substitute_node_with_dag - #15542
Raynel Sanchez (raynelfss) merged 16 commits into
Conversation
β¦ixes Qiskit#15509)\n\n- Add input/captured/declared vars and stretches from replacement DAG\n- Add tests verifying input vars and captured/declared vars transfer\n- Add release note entry
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
substitute_node_with_dag
Previously, substitute_node_with_dag() would try to add all variables from the replacement DAG, including those already present in the target DAG. This violated the constraint that a DAG cannot have both input and captured variables simultaneously when the same variable object appears in both contexts. Now check if each variable is already present before adding it, matching the behavior of compose() with inline_captures=False.
Pull Request Test Coverage Report for Build 21313279594Details
π - Coveralls |
|
Alexander Ivrii (@alexanderivrii) can you also look through this and if this is okay add this to the 2.4.0 list for reviewers to review this pr. Thank you for all your help and feedback. |
|
Hello Arnav Kapoor (@arnavk23), please add this snippet to your PR description as it is now required by anyone contributing to Qiskit to disclose any usage of Generative AI in your code (even if you don't use it, you must declare it). |
Raynel Sanchez (raynelfss)
left a comment
There was a problem hiding this comment.
This should be about ready to merge. I just really have one more test suggestion.
β¦e check was failing because the node variable substitution was not being applied correctly in the dagcircuit code. This commit fixes that issue by ensuring that the node variable substitution is applied correctly when checking for node variables in the dagcircuit code.
Raynel Sanchez (raynelfss)
left a comment
There was a problem hiding this comment.
A couple more comments!
Qiskit#15542) * dagcircuit: transfer DAG-level variables in substitute_node_with_dag (fixes Qiskit#15509)\n\n- Add input/captured/declared vars and stretches from replacement DAG\n- Add tests verifying input vars and captured/declared vars transfer\n- Add release note entry * Apply Black formatting to test file * Update test_dagcircuit.py * Fix variable transfer to skip already-present variables Previously, substitute_node_with_dag() would try to add all variables from the replacement DAG, including those already present in the target DAG. This violated the constraint that a DAG cannot have both input and captured variables simultaneously when the same variable object appears in both contexts. Now check if each variable is already present before adding it, matching the behavior of compose() with inline_captures=False. * addressing review comments * fixing failing check for node variable substitution in dagcircuit. The check was failing because the node variable substitution was not being applied correctly in the dagcircuit code. This commit fixes that issue by ensuring that the node variable substitution is applied correctly when checking for node variables in the dagcircuit code. * adressing review comments * reno
Qiskit#15542) (Qiskit#16744) * dagcircuit: transfer DAG-level variables in substitute_node_with_dag (fixes Qiskit#15509)\n\n- Add input/captured/declared vars and stretches from replacement DAG\n- Add tests verifying input vars and captured/declared vars transfer\n- Add release note entry * Apply Black formatting to test file * Update test_dagcircuit.py * Fix variable transfer to skip already-present variables Previously, substitute_node_with_dag() would try to add all variables from the replacement DAG, including those already present in the target DAG. This violated the constraint that a DAG cannot have both input and captured variables simultaneously when the same variable object appears in both contexts. Now check if each variable is already present before adding it, matching the behavior of compose() with inline_captures=False. * addressing review comments * fixing failing check for node variable substitution in dagcircuit. The check was failing because the node variable substitution was not being applied correctly in the dagcircuit code. This commit fixes that issue by ensuring that the node variable substitution is applied correctly when checking for node variables in the dagcircuit code. * adressing review comments * reno (cherry picked from commit f671c03) Co-authored-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Qiskit#15542) * dagcircuit: transfer DAG-level variables in substitute_node_with_dag (fixes Qiskit#15509)\n\n- Add input/captured/declared vars and stretches from replacement DAG\n- Add tests verifying input vars and captured/declared vars transfer\n- Add release note entry * Apply Black formatting to test file * Update test_dagcircuit.py * Fix variable transfer to skip already-present variables Previously, substitute_node_with_dag() would try to add all variables from the replacement DAG, including those already present in the target DAG. This violated the constraint that a DAG cannot have both input and captured variables simultaneously when the same variable object appears in both contexts. Now check if each variable is already present before adding it, matching the behavior of compose() with inline_captures=False. * addressing review comments * fixing failing check for node variable substitution in dagcircuit. The check was failing because the node variable substitution was not being applied correctly in the dagcircuit code. This commit fixes that issue by ensuring that the node variable substitution is applied correctly when checking for node variables in the dagcircuit code. * adressing review comments * reno
Fixes missing variable/stretches when the replacement DAG carries declarations (e.g., for control-flow conditions/targets).
Adds tests for input-vars and captured/declared-vars transfer.
Includes a release note.
Closes #15509.
AI/LLM disclosure