Right now, it's not possible to obtain a sampler from a STIM program. In order to make this work, we need to track mid-circuit measurement outcome probabilities and add those to the record when sampling in order to match STIM semantics.
Also, we should try to skip measurement gates at the end yet somehow track which qubits are sampled from there. Executing actual measurement gates at the end will cause branching and is not needed if we sample anyway. That is true especially when measuring all qubits at the end.
Right now, it's not possible to obtain a sampler from a STIM program. In order to make this work, we need to track mid-circuit measurement outcome probabilities and add those to the record when sampling in order to match STIM semantics.
Also, we should try to skip measurement gates at the end yet somehow track which qubits are sampled from there. Executing actual measurement gates at the end will cause branching and is not needed if we sample anyway. That is true especially when measuring all qubits at the end.