Skip to content

Feat/gpu acceleration#18

Merged
splch merged 3 commits intomainfrom
feat/gpu-acceleration
Mar 14, 2026
Merged

Feat/gpu acceleration#18
splch merged 3 commits intomainfrom
feat/gpu-acceleration

Conversation

@splch
Copy link
Copy Markdown
Owner

@splch splch commented Mar 14, 2026

No description provided.

splch added 3 commits March 13, 2026 14:51
Define sim.Simulator interface (Run, Evolve, StateVector, Close) and
wire it into backend/local via WithSimulator option so GPU backends are
drop-in replacements for the CPU statevector simulator.

- sim/sim.go: new Simulator interface
- statevector.Sim, densitymatrix.Sim: add Close() no-op
- backend/local: SimFactory type, WithSimulator option, factory-based Submit
- sim/gpu/cuda: cuStateVec backend (separate module, build-tag gated)
  - CGo wrappers for applyMatrix, sampler, Pauli expectations
  - Stub file compiles cleanly without CUDA installed
  - Tests ported from statevector + CPU-vs-GPU cross-validation
  - Crossover benchmarks (12-28 qubits)
- sim/gpu/metal: Apple Metal skeleton (Phase 2)
  - Stub device.go, 1Q/2Q compute shaders, test skeleton
- Makefile: test-gpu-cuda, bench-gpu-cuda targets
Implements the full Metal compute shader backend for statevector
simulation on macOS. Uses float32 precision via Apple's unified
memory (MTLResourceStorageModeShared) with embedded MSL shaders
for 1Q and 2Q gate application. Gates with 3+ qubits are
automatically decomposed into 1Q/2Q primitives.

Achieves up to ~12x speedup over CPU at 20-22 qubits on M2 Max.
…d shaders

Implement host-side CPU fallback for the CUDA reset gate instead of
returning an unsupported error. Add missing IsDynamic() check in CUDA
run() for parity with the Metal backend. Remove standalone .metal shader
files that used double2 types inconsistent with the float2 shaders
actually embedded in metal_bridge.m.
@splch splch merged commit 79b520d into main Mar 14, 2026
6 checks passed
@splch splch deleted the feat/gpu-acceleration branch March 14, 2026 20:18
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.

1 participant