Skip to content

fix: expose bitcode helpers and update QIR 2 fixtures#81

Merged
qartik merged 2 commits into
mainfrom
codex-resolve-78-79
May 4, 2026
Merged

fix: expose bitcode helpers and update QIR 2 fixtures#81
qartik merged 2 commits into
mainfrom
codex-resolve-78-79

Conversation

@qartik
Copy link
Copy Markdown
Member

@qartik qartik commented May 4, 2026

Summary

  • Expose create_memory_buffer_from_bytes, memory_buffer_to_owned_bytes, and parse_bitcode_module as supported Rust helpers for the public bitcode byte boundary.
  • Clarify that parse_bitcode_module is a copied-buffer parser path, not a raw/wrapped LLVM bitcode classifier or malformed-input diagnostic layer; downstream callers should keep pre-parse diagnostics before calling it.
  • Validate QIR version pairs so QIR 2.1 is accepted while unsupported pairs like QIR 1.1 still fail explicitly.
  • Update QIR 2 fixture metadata and snapshots from qir_minor_version = 0 to qir_minor_version = 1.

Fixes #78
Fixes #79

Testing

  • cargo test --lib bitcode
  • make lint
  • make test

Copilot AI review requested due to automatic review settings May 4, 2026 13:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the crate’s supported public bitcode boundary in Rust and aligns QIR 2 fixtures with QIR version 2.1 by (a) exposing reusable LLVM memory-buffer/bitcode helpers, (b) validating QIR major/minor pairs (accepting 2.1 while still rejecting unsupported pairs like 1.1), and (c) updating QIR 2 fixture metadata and snapshots to qir_minor_version = 1.

Changes:

  • Expose create_memory_buffer_from_bytes, memory_buffer_to_owned_bytes, and parse_bitcode_module as public Rust APIs for working with “public” bitcode bytes.
  • Update module-flag validation to accept QIR version pairs (1.0, 2.0, 2.1) and explicitly reject unsupported combinations (e.g., 1.1).
  • Bump QIR 2 fixture/module-flag minor versions from 0 to 1 across fixture sources and snapshots.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/lib.rs Exposes bitcode/memory-buffer helpers publicly; adds QIR version-pair validation and tests for 1.1 rejection / 2.1 acceptance.
tests/data/qir2_base.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/qir2_adaptive.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/dynamic_result_mixed_array_output.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/dynamic_result_array.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/dynamic_result_alloc.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/dynamic_qubit_array_ssa.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/dynamic_qubit_array_checked.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/dynamic_qubit_alloc.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/data/dynamic_qubit_alloc_checked.ll Updates module flags to QIR 2.1 (qir_minor_version = 1).
tests/snaps/qir2_base.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/qir2_adaptive.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/dynamic_result_mixed_array_output.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/dynamic_result_array.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/dynamic_result_alloc.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/dynamic_qubit_array_ssa.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/dynamic_qubit_array_checked.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/dynamic_qubit_alloc.ll.snap Updates snapshot module flags to QIR 2.1 minor version.
tests/snaps/dynamic_qubit_alloc_checked.ll.snap Updates snapshot module flags to QIR 2.1 minor version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@qartik qartik force-pushed the codex-resolve-78-79 branch from 302e09d to ad19e57 Compare May 4, 2026 13:39
@qartik qartik merged commit ef3f7c2 into main May 4, 2026
23 checks passed
@qartik qartik deleted the codex-resolve-78-79 branch May 4, 2026 14:06
@hugrbot hugrbot mentioned this pull request May 4, 2026
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.

Use version 2.1 in QIR 2.1 fixtures Expose bitcode buffer helpers for downstream Rust consumers

2 participants