Skip to content

🐛 Initialize the Qiskit C API once - #2223

Merged
simon1hofmann merged 1 commit into
mainfrom
codex/qiskit-thread-safe-api-initialization
Aug 24, 2026
Merged

🐛 Initialize the Qiskit C API once#2223
simon1hofmann merged 1 commit into
mainfrom
codex/qiskit-thread-safe-api-initialization

Conversation

@simon1hofmann

@simon1hofmann simon1hofmann commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Description

Initialize the vendored Qiskit C API once per versioned translation unit through thread-safe function-local static initialization. This publishes the capsule-backed function table safely when nanobind 3 free-threaded callers create translations concurrently.

Add a focused concurrent import/export regression. This is a prerequisite for #2176 and follows the split-mode/free-threaded binding adoption in #2209.

Testing

  • The release split-mode binding containing this initialization hunk built successfully.
  • The concurrent regression passed as part of all 218 Qiskit translation tests on the stacked branch.
  • Clang formatting, Ruff, and git diff checks passed for the isolated patch.

AI assistance: Codex assisted with implementation review, isolation, validation, and this description.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure shown above.
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

Publish the vendored translation-unit-local function tables through thread-safe static initialization for nanobind 3 free-threaded bindings. Add concurrent import and export coverage.

Assisted-by: GPT-5.6 Sol via Codex
Signed-off-by: Simon Hofmann <simon.t.hofmann@tum.de>
@simon1hofmann
simon1hofmann force-pushed the codex/qiskit-thread-safe-api-initialization branch from be38e9c to 75e6c56 Compare August 24, 2026 11:30

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍🏼
The PR is still missing tags and a completed checklist. Then this can go in directly 😌

@simon1hofmann simon1hofmann self-assigned this Aug 24, 2026
@simon1hofmann simon1hofmann added c++ Anything related to C++ code MLIR Anything related to MLIR labels Aug 24, 2026
@simon1hofmann simon1hofmann added this to the MLIR Support milestone Aug 24, 2026
@simon1hofmann simon1hofmann added the bug Something isn't working label Aug 24, 2026
@simon1hofmann
simon1hofmann merged commit b226b9f into main Aug 24, 2026
22 of 23 checks passed
@simon1hofmann
simon1hofmann deleted the codex/qiskit-thread-safe-api-initialization branch August 24, 2026 12:22
simon1hofmann added a commit that referenced this pull request Aug 24, 2026
Incorporate the merged one-time Qiskit C API initialization fix from #2223.

Assisted-by: GPT-5.6 Sol via Codex
Signed-off-by: Simon Hofmann <simon.t.hofmann@tum.de>
@denialhaag denialhaag added fix Fix for something that isn't working and removed bug Something isn't working labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code fix Fix for something that isn't working MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants