Skip to content

Pre-schedule during Circuit Transpilation#132

Open
masa10-f wants to merge 15 commits intomasterfrom
pre-schedule-for-circuit
Open

Pre-schedule during Circuit Transpilation#132
masa10-f wants to merge 15 commits intomasterfrom
pre-schedule-for-circuit

Conversation

@masa10-f
Copy link
Collaborator

Before submitting, please check the following:

  • Make sure you have tests for the new code and that test passes (run pytest)
  • If applicable, add a line to the [unreleased] part of CHANGELOG.md, following keep-a-changelog.
  • Format added code by ruff
  • Type checking by mypy and pyright
  • Make sure the checks (github actions) pass.
  • Check that the docs compile without errors (run make html in ./docs/ - you may need to install dependency for sphinx docs, see docs/requirements.txt.)

Then, please fill in below:

Context (if applicable):

For compiling a circuit, the scheduler can be a bottleneck of the process. I found that we can do the optimal schedule (minimizing space/time) during the circuit transpilation.

Description of the change:

I have implemented a new circuit transpiler that gives not only graph and gflow, but also a schedule based on the given strategy.

Also, I have optimized the GraphState class to maximize the compilation speed.

@masa10-f masa10-f self-assigned this Nov 17, 2025
@masa10-f masa10-f added the enhancement New feature or request label Nov 17, 2025
masa10-f and others added 2 commits January 3, 2026 21:01
Update test fixtures and test functions to provide parity_check_group
when testing _pauli_axis_cache and _collect_dependent_chain, which are
only initialized when parity_check_group is provided (FTQC optimization).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 90.81633% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.75%. Comparing base (79bfd1d) to head (5b3bb29).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #132      +/-   ##
==========================================
+ Coverage   83.57%   83.75%   +0.18%     
==========================================
  Files          21       21              
  Lines        2313     2383      +70     
  Branches      416      424       +8     
==========================================
+ Hits         1933     1996      +63     
- Misses        288      293       +5     
- Partials       92       94       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

masa10-f and others added 3 commits January 4, 2026 11:45
- Merge scheduling logic into circuit2graph, now returns (GraphState, gflow, Scheduler)
- Remove circuit2graph_with_preschedule (unreleased)
- Add 9 new tests for scheduling functionality
- Update existing tests and examples for new return type

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@masa10-f
Copy link
Collaborator Author

masa10-f commented Jan 8, 2026

memo: I have to implement a minimize space pre-schedule

@masa10-f masa10-f marked this pull request as ready for review January 31, 2026 17:45
@masa10-f
Copy link
Collaborator Author

I should update the changelog

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b3bb29050

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +86 to +89
self._pauli_axis_cache = (
{node: determine_pauli_axis(meas_basis) for node, meas_basis in graphstate.meas_bases.items()}
if parity_check_group
else {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Populate Pauli-axis cache even without parity groups

Because _pauli_axis_cache is now only built when parity_check_group is non-empty, any call to PauliFrame.logical_observables_group() (used by stim_compile when logical_observables is provided) will hit self._pauli_axis_cache[node] and raise a KeyError if parity_check_group was omitted. This makes stim_compile(..., logical_observables=...) crash in the common case where callers don’t provide parity check groups, even though the API doesn’t require them.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant