Skip to content

fix: use ZZ as IonQ Forte native 2Q gate instead of MS#37

Merged
splch merged 3 commits intomainfrom
fix/ionq-forte-zz-native-gate
Apr 10, 2026
Merged

fix: use ZZ as IonQ Forte native 2Q gate instead of MS#37
splch merged 3 commits intomainfrom
fix/ionq-forte-zz-native-gate

Conversation

@splch
Copy link
Copy Markdown
Owner

@splch splch commented Apr 10, 2026

Summary

  • IonQ Forte Enterprise 1 rejects the ms gate with "Gate types [ms] are not supported by this backend". Its native 2Q entangling gate is zz, confirmed by the compilation output (gate_basis: "ZZ") and successful hardware execution with custom pulse shapes.
  • Adds gate.ZZ(theta) constructor, builder shorthand, ZZ-basis decomposition rules, and updates IonQForte target from [GPI, GPI2, MS] to [GPI, GPI2, ZZ]. Aria retains MS.
  • Fixes pre-existing op-ordering bugs in decompose1qToIonQ(H) and rzToIonQ where ops were in math-notation order instead of circuit-execution order (never caught because the MS CNOT path uses a hardcoded sequence).

Test plan

  • TestMarshalZZGate verifies ZZ serializes to "zz" with angle in turns
  • TestDecomposeByRule_CNOT_ToZZBasis verifies CNOT decomposition to GPI/GPI2/ZZ matches CNOT unitary up to global phase
  • TestDecomposeByRule_CZ_ToZZBasis and _SWAP_ToZZBasis verify CZ and SWAP decompositions
  • TestUnitarity now includes ZZ(pi/4)
  • TestHasBasisGate_IonQ updated for ZZ in Forte, MS in negative set
  • Full test suite passes (go test ./... - 0 failures)
  • Validated on hardware: submitted native ZZ circuit with custom pulse shapes to qpu.forte-enterprise-1, job completed successfully

Forte Enterprise 1 rejects the MS gate at submission time with
"Gate types [ms] are not supported by this backend". Its native
entangling gate is ZZ, confirmed by the compilation output field
gate_basis: "ZZ" and successful hardware execution.

- Add gate.ZZ(theta) constructor (same matrix as RZZ, named "ZZ")
- Add builder.ZZ() shorthand
- Change IonQForte target basis from [GPI, GPI2, MS] to [GPI, GPI2, ZZ]
- Add ZZ decomposition rules (GPI/GPI2/ZZ basis) for Forte transpilation
- Fix op ordering bugs in decompose1qToIonQ(H) and rzToIonQ that had
  math-notation order instead of circuit-execution order
- Add serializer, decomposition, and unitarity tests for ZZ
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 10, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 49.47368% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.42%. Comparing base (8d79612) to head (27a3bed).

Files with missing lines Patch % Lines
transpile/decompose/rules.go 41.25% 45 Missing and 2 partials ⚠️
circuit/builder/builder.go 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (49.47%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
- Coverage   71.46%   71.42%   -0.04%     
==========================================
  Files         166      166              
  Lines       17602    17695      +93     
==========================================
+ Hits        12579    12639      +60     
- Misses       4058     4088      +30     
- Partials      965      968       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

splch added 2 commits April 11, 2026 08:48
The CX, CZ, and RZZ decomposition paths all handle ControlledGate via
DecomposeMultiControlled, but neither the MS nor ZZ IonQ paths did.
Without this, multi-controlled gates (MCX, MCZ, MCP, Controlled(...))
return nil on IonQ targets instead of decomposing.
@splch splch merged commit bb6b187 into main Apr 10, 2026
6 checks passed
@splch splch deleted the fix/ionq-forte-zz-native-gate branch April 10, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants