Draft
Conversation
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.
Summary
This spike is a thought experiment for what handling QIR natively would look like. The real complexity is in supporting bitcode and trying to deal with bit level encodings, abbreviations, and semantics.
The features demonstrated here aren't an all-or-nothing. We could adopt any subset of functionallity if desired.
I thnk the qir_smith is an interesting addtion that could be usefull for Q#/OpenQASM as a pattern for additional fuzzing capabilities. It generates deterministically random modules based on a seeded input and configuration. While we can fuzz that input, we cal also inject faults to ensure we don't panic on malformed input. The idea is based on wasm-smith.
add qsc_llvm infrastructure
This branch added a new
qsc_llvmcrate that models, parses, writes, validates, and fuzzes LLVM/QIR modules, then wired that shared infrastructure into QIR code generation and the Python-facing simulation stack. It also moved adaptive-profile parsing and execution support out of Python and into Rust so the QIR path runs through the same native components used elsewhere in the toolchain.Changes
qsc_llvm foundation
Added the new
qsc_llvmcrate as a shared LLVM/QIR layer for modeling modules, building IR, parsing text and bitcode, emitting text and bitcode, inspecting QIR metadata, and validating both general LLVM IR and profile-specific QIR rules.Code generation
Refactored QIR code generation to build modules through the new shared LLVM/QIR layer instead of maintaining separate v1 and v2 implementations.
commonmoduleqsc_llvmwriter APIsFuzzing and replay
Added a dedicated fuzzing and deterministic replay workflow for QIR generation, parsing, validation, and round-trip checking.
qirlibFuzzer target and the deterministicqir_matrixreplay binaryqir_smithgenerator with checked-generation and round-trip pathsPython and simulation integration
Moved adaptive-profile QIR parsing and simulation preparation out of Python and into Rust, then updated the Python layer to call the native implementation.