Skip to content

Intermittent Bell state measurement correlation failure in Selene/LLVM path #307

@ciaranra

Description

@ciaranra

Summary

The Selene/LLVM execution path intermittently produces uncorrelated Bell state measurements in a noiseless simulation. This was observed on Windows CI (Python 3.14) but may not be Windows-specific -- it could be a rare nondeterministic failure on any platform.

Details

test_hugr_interpreter_parity.py::TestSimpleCircuitParity::test_bell_state_correlation runs a noiseless Bell state circuit through both the direct HUGR interpreter and
the Selene/LLVM path:

@guppy
def bell_state() -> None:
    q0 = qubit()
    q1 = qubit()
    h(q0)
    scx(q0, q1)
    result("m0", measure(q0))
    result("m1", measure(q1))

With no noise and state_vector(), measurements must always be correlated (m0 == m1 in every shot). The direct HUGR path passes. The Selene/LLVM path had 1 uncorrelated shot out of 100.

The execution path is: guppy_func.compile() -> compile_hugr_to_qis() -> QIS LLVM IR -> sim(Qis.from_string(...)).quantum(state_vector()).seed(42).run(100)

CI evidence

Possible causes

  • Uninitialized memory in JIT-compiled QIS code (something that happens to be zeroed on most runs but not always)
    • Measurement result ordering issue in the QIS -> gate dispatch path
    • State vector corruption in the Selene compilation chain

The intermittent nature (1 shot in 100, not every run) and the fact that the direct HUGR path passes with the same seed/backend points to something in the compile_hugr_to_qis -> JIT execution chain rather than the simulator itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions