GeneCS: Synthesizing Resource-Efficient Code Surgery for Arbitrary Quantum Stabilizer Codes
Efficiently realizing logical operations on general stabilizer codes remains a long-standing challenge in fault-tolerant quantum computing. While code surgery provides a general framework with provable guarantees through joint logical measurements, existing constructions are largely theoretical and incur substantial ancilla overhead in practice. We present GeneCS, a resource-efficient synthesizer of code surgery protocols for arbitrary stabilizer codes, designed for the backend of fault-tolerant quantum compilers. Our approach leverages structure-aware optimizations to eliminate redundancy in graph construction, dynamically balance expansion and congestion, and incorporate code degree constraints. Experimental results show that GeneCS reduces ancillary qubits and checks by over 85% on average for both single-code and cross-code logical operations, while the optimized constructions exhibit logical-error-rate behavior comparable to the baseline under BP-OSD (belief propagation with ordered-statistics decoding). On surface-code stress tests with more than $10^4$ physical qubits, one independent synthesis run takes about one second on average. These results enable practical logical operations and efficient cross-code communication for modern QLDPC (quantum low-density parity-check) codes and heterogeneous code systems.