✨ Support wide Qiskit register comparisons - #2348
Merged
Merged
Conversation
simon1hofmann
force-pushed
the
codex/wide-cbit-qiskit-comparisons
branch
from
September 3, 2026 13:51
bbfc021 to
ae1e71f
Compare
simon1hofmann
force-pushed
the
codex/wide-cbit-qiskit-comparisons
branch
from
September 3, 2026 14:36
ae1e71f to
94a6725
Compare
12 tasks
Preserve unsigned literals with APInt and allow direct complete-register comparisons beyond 64 bits. Keep computed and signed wide expressions rejected, and exchange Python integers through hexadecimal. Assisted-by: GPT-5.6 Sol via Codex Signed-off-by: Simon Hofmann <simon.t.hofmann@tum.de>
simon1hofmann
force-pushed
the
codex/wide-cbit-qiskit-comparisons
branch
from
September 4, 2026 07:48
94a6725 to
74251f2
Compare
Let validation enforce direct wide comparisons and reuse generic emission without a separate predicate reversal table. Normalize tuple conditions through the same expression path, preserving Boolean values and folding out-of-range equalities to false. Cover all six predicates in both operand orders, jeff conversion, tuple conditions, and invalid wide register mappings. Keep export unchanged. Assisted-by: Codex Signed-off-by: Lukas Burgholzer <burgholzer@me.com>
burgholzer
approved these changes
Sep 4, 2026
burgholzer
left a comment
Member
There was a problem hiding this comment.
Thanks! Took this for a spin and it is much leaner now. Tests still pass, so I am pretty confident this is ready to go in 🚀
If you agree, feel free to merge!
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.
🤖 AI text below 🤖
Description
Support exact Qiskit interchange for unsigned comparisons between one complete
named classical register wider than 64 bits and one same-width integer literal.
Both operand orders and all unsigned equality and ordering predicates are
supported.
The implementation keeps the current MLIR representation:
cbit.readmaterializes the register value and
arith.cmpicompares it with an integerconstant. Export recognizes this direct shape, and import emits the same
operations. Only this direct register-and-literal form bypasses the generic
64-bit limit. Computed or packed unsigned expressions and signed comparisons
wider than 64 bits remain unsupported.
Normalized unsigned literals use
llvm::APInt. The Python boundary transfersintegers as unsigned hexadecimal text, preserving large positive values without
depending on Python's decimal string-conversion limit.
The branch is based directly on current
mainand contains one focused commit.The Qiskit support documentation describes the direct-wide boundary.
Validation
mqt-core-mlir-bindingsagainst LLVM/MLIR 23.1.test/python/test_mlir_qiskit_translation.py.decimal digit limit.
rejected.
uvx nox -s lintandgit diff --check.uvx nox -s cpp-lint -- origin/maincould not start locally because thishost does not provide the required clang-tidy 22; hosted CI remains
authoritative for that check.
Codex assisted with the implementation, tests, branch update, review, and this
description.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).