Conversation
advance_next_2qb_slice read in_edges[0] for every vertex in the next cut that did not have more than one quantum in-edge. A ClExprOp has none, so this read past the end of an empty vector. Skip vertices that do not have exactly one quantum in-edge. Fixes Quantinuum#2180.
cleitonaugusto
marked this pull request as ready for review
September 30, 2026 22:45
cqc-alec
self-requested a review
October 1, 2026 07:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
MappingFrontier::advance_next_2qb_slicewalks the vertices of the next cut and,for any vertex that does not have more than one quantum in-edge, reads
in_edges[0]. AClExprOpis purely classical and has no quantum in-edges, sothat read goes past the end of an empty vector. It only crashes some of the time,
which matches the reports in the issue.
Building the original file with
-D_GLIBCXX_ASSERTIONSmakes it abort atstd::vector::operator[](__n=0)called fromMappingFrontier.cpp:265.The fix skips vertices that don't have exactly one quantum in-edge. A classical
vertex has no qubit boundary to move, and this function is only used for the
lookahead when LexiRoute scores swaps (the boundary is restored afterwards), so
skipping it doesn't change what gets routed.
Tests:
test_LexiRoute.cppand a pytket test inmapping_test.pywith the circuit from the issue. The pytket test segfaults without the fix.
ClExprOps and conditionals on a linearchitecture and checked that each qubit and bit sees the same operations in
the same order after undoing the swaps. No differences.
Bumped
TKET_VERSIONto 2.1.102.Related issues
Fixes #2180.
Checklist