Skip to content

Add Clifford simulation across VS Code runs, tests, and debugging - #3634

Draft
Michael Goulding (MichaelGoulding) wants to merge 7 commits into
microsoft:mainfrom
MichaelGoulding:vscode-clifford-target
Draft

Add Clifford simulation across VS Code runs, tests, and debugging#3634
Michael Goulding (MichaelGoulding) wants to merge 7 commits into
microsoft:mainfrom
MichaelGoulding:vscode-clifford-target

Conversation

@MichaelGoulding

@MichaelGoulding Michael Goulding (MichaelGoulding) commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

  • add a VS Code setting to select sparse state-vector or Clifford stabilizer simulation
  • use the selected simulator for Run program, Run file and show histogram, Test Explorer, and debugging
  • preserve sparse simulation as the default and keep existing callers source-compatible
  • support the existing Pauli-noise and qubit-loss settings with Clifford simulation
  • warn and continue when Q# calls DumpMachine under Clifford simulation

User experience

Select Q# › Simulation: Type in VS Code Settings, or add:

{
  "Q#.simulation.type": "clifford",
  "Q#.simulation.clifford.maxQubits": 1000
}

Q#.simulation.type offers:

  • sparse — default; supports arbitrary quantum programs
  • clifford — efficient stabilizer simulation for Clifford-only programs

Q#.simulation.clifford.maxQubits accepts integers from 1 through 10,000 and defaults to 1,000. The public qsharp-lang run and debug APIs apply the same validation.

Behavior and limitations

  • unsupported non-Clifford gates and rotations report simulator diagnostics
  • Q#.simulation.pauliNoise and Q#.simulation.qubitLoss are supported for Clifford histogram execution
  • scalar qubit loss uses the same per-operation ordering and lost-qubit behavior as the sparse simulator; cumulative noise configurations continue to use the stabilizer simulator's native loss policies
  • dynamic in-program ConfigureQubitLoss remains unsupported in Clifford simulation
  • Q# DumpMachine emits a warning and execution continues because Clifford simulation cannot provide amplitudes without potentially exponential work
  • the debugger supports stepping, locals, breakpoints, and circuit tracing, but omits the amplitude-based Quantum State scope under Clifford simulation
  • programmatic debugger state capture continues to report that Clifford state visualization is unsupported

Testing

  • Rust evaluator/compiler suites: 618 qsc_eval tests passed; 464 qsc tests passed with 1 ignored
  • focused Clifford loss tests cover backend behavior, interpreter execution, legacy lost-qubit gate semantics, and direct/WebWorker npm execution
  • package-level Clippy passed for qsc_eval and qsc; WASM and Python packages passed cargo check
  • VS Code language-service suite: 19/19 browser and 19/19 desktop
  • WASM, npm, and VS Code extension build
  • Prettier, Rust formatting, and diff checks

The Python package compiles locally, but its native test binary cannot launch in this environment because the GPU runtime DLL is unavailable; CI will exercise the package tests.

Michael Goulding and others added 2 commits August 24, 2026 14:38
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@MichaelGoulding Michael Goulding (MichaelGoulding) changed the title Add VS Code Clifford simulator target Add Clifford simulation across VS Code runs, tests, and debugging Aug 25, 2026
Comment thread source/compiler/qsc_eval/src/backend.rs Fixed
Michael Goulding and others added 4 commits August 24, 2026 22:20
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Centralize backend construction and legacy noise sampling, reuse simulator-aware execution APIs, and expose quantum-state support as a debugger capability. Remove the standalone Clifford-only interpreter test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants