🔍 Audit MLIR pass, verifier, and rewrite contracts - #2287
Draft
simon1hofmann wants to merge 15 commits into
Draft
Conversation
Audit every MQT-owned pass, verifier, rewrite pattern, conversion target, and registration surface. Harden diagnostics, atomicity, resource bounds, metadata checks, and importer boundaries. Add focused regressions across conversions, QIR, mapping, JEFF, OpenQASM, decision diagrams, and Qiskit interoperability. Assisted-by: GPT-5.6 Sol via Codex
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
simon1hofmann
marked this pull request as draft
August 31, 2026 15:14
This was referenced Aug 31, 2026
…ontract # Conflicts: # mlir/lib/Compiler/Programs.cpp # mlir/lib/Dialect/QCO/IR/Modifiers/ModifierUtils.cpp # mlir/unittests/Conversion/QCToQCO/test_qc_to_qco.cpp
Preserve landed focused fixes while retaining the independent contract-audit guards and regressions. Assisted-by: GPT-5.6 via Codex
Preserve the dependency-safe behavior from #2301 while retaining terminal-reset handling from the contract audit. Assisted-by: GPT-5.6 via Codex
Record the focused pull request outcomes and revise the audit gate so passes may assume verifier-valid IR. Withdraw speculative and invalid-input findings across the original snapshot. Assisted-by: GPT-5.6 via Codex
12 tasks
Move the invalid-QCO finding from pending withdrawal to closed and refresh the focused audit counts. Assisted-by: GPT-5.6 via Codex
…ontract # Conflicts: # mlir/include/mlir/Conversion/CBitToMemRef/CBitToMemRef.td # mlir/lib/Conversion/CBitToMemRef/CBitToMemRef.cpp
Remove focused, merged, closed, malformed-IR, and speculative changes from the audit snapshot. Retain only uniquely owned boundary, verifier, resource, semantic, and output-atomicity findings, with valid regressions. Assisted-by: GPT-5.6 via Codex
…ontract # Conflicts: # mlir/unittests/Conversion/QCOToQC/test_qco_to_qc.cpp
Accept valid QC programs whose dynamic register indices cannot be proven distinct, and remove a registration-only assertion without an executable reproducer. Finalize the reconciled audit counts and validation record. Assisted-by: GPT-5.6 via Codex
Extract scalar floats from MLIR pass options before calling std::isfinite so the retained option validation compiles with MSVC. Assisted-by: GPT-5.6 via Codex
Retain the audit conversion validation and atomicity changes while integrating the focused constant-folding, benchmark-registration, and idempotent QIR metadata updates now on main. Assisted-by: GPT-5.6 via Codex
Preserve the audit mapping validation and failure-atomic rewrite while adopting the separated placement and routing implementation. Assisted-by: GPT-5.6 via Codex
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
Reconciles the complete MLIR contract audit from #2255 with the reviewer rule
that transformation passes may assume input accepted by the owning dialect and
whole-program validators.
The historical snapshot contained 118 files and 14,011 changed lines. Against
current
main(b74fbb280), this branch contains 77 files with 9,952insertions and 1,009 deletions: 41 files and 3,050 changed lines were removed.
This remains a draft audit snapshot and finding ledger, not a proposal to merge
the complete implementation. Accepted findings continue to land as focused pull
requests. The census, decisions, and validation record are in
.agent/plans/audit-mlir-contracts.md.Revised audit invariant
whole-program invariants, including QCO linearity and program metadata.
Pass tests may verify these invariants before and after a transformation.
validation, and resource limits reachable from valid IR remain valid audit
boundaries.
boundary.
Reconciliation
Removed generic pass-entry validation, invalid-IR defenses and regressions,
speculative traversal replacements, the shared arbitrary depth policy, rejected
findings, and code owned by focused pull requests.
The remaining snapshot contains unique compiler/import, conversion,
representability, verifier, numeric, mapping, DD resource, and QIR provenance
findings. The placement/routing split from #2316 is preserved, with the remaining
mapping findings applied only to explicit-topology routing.
Focused pull requests
Merged (12):
Open (5):
Closed without merge (4):
🐛 Reject nonlinear QTensor shrink chains safely #2303 — Reject nonlinear QTensor shrink chains safely🐛 Preserve MLIR runtime errors on macOS #2305 — Preserve MLIR runtime errors on macOS🐛 Make Pauli-twirling traversal stack-safe #2306 — Make Pauli-twirling traversal stack-safe🐛 Reject nonlinear Hadamard-lifting inputs safely #2309 — Reject nonlinear Hadamard-lifting inputs safelyValidation
main, all 3,111 MLIR unit tests pass.and QCO utilities 161/161.
uvx nox -s lintpasses.Clang-Format and zero Clang-Tidy findings.
git diff --checkpasses.remains documented; the rejected workaround from 🐛 Preserve MLIR runtime errors on macOS #2305 stays excluded.
Tracks #2255.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).AI assistance disclosure: Codex performed the audit, reconciled reviewer
feedback and current
main, extracted accepted findings into focused pullrequests, pruned duplicate implementations, and updated this description under
explicit human direction.