Skip to content

Commit 6111999

Browse files
committed
update the repowiki
1 parent c46a138 commit 6111999

File tree

10 files changed

+2200
-30
lines changed

10 files changed

+2200
-30
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Defcal Performance Analysis
2+
3+
<cite>
4+
**Referenced Files in This Document**
5+
- [defcal_performance_analysis.py](file://examples/defcal_performance_analysis.py)
6+
- [performance_layerwise_optimization.py](file://examples/performance_layerwise_optimization.py)
7+
- [utils.py](file://src/tyxonq/utils.py)
8+
- [api.py](file://src/tyxonq/compiler/api.py)
9+
- [engine.py](file://src/tyxonq/devices/simulators/statevector/engine.py)
10+
</cite>
11+
12+
## Table of Contents
13+
1. [Introduction](#introduction)
14+
2. [Defcal Performance Analysis](#defcal-performance-analysis)
15+
3. [Layerwise Optimization for Deep Circuits](#layerwise-optimization-for-deep-circuits)
16+
4. [Performance Benchmarking Tools](#performance-benchmarking-tools)
17+
5. [Compiler and Execution Performance](#compiler-and-execution-performance)
18+
6. [Conclusion](#conclusion)
19+
20+
## Introduction
21+
This document provides a comprehensive performance analysis of the Defcal system in TyxonQ, focusing on compilation efficiency, execution scalability, and optimization techniques for quantum circuit simulation. The analysis is based on benchmarking examples and core framework components that demonstrate the performance characteristics of hardware-aware quantum compilation.
22+
23+
## Defcal Performance Analysis
24+
25+
The `defcal_performance_analysis.py` example provides a quantitative evaluation of the DefcalLibrary system, which enables hardware-aware quantum circuit compilation through calibrated pulse definitions. This analysis demonstrates the performance benefits and trade-offs of using calibrated pulses versus default gate implementations.
26+
27+
The benchmarking covers four key scenarios:
28+
- **Compilation Time**: Measures overhead introduced by defcal lookup and pulse mapping
29+
- **Measurement Statistics**: Compares sampling outcomes with realistic noise models
30+
- **Ideal Simulation**: Evaluates state fidelity in perfect conditions
31+
- **Scalability**: Tests performance across increasing circuit depths
32+
33+
Results show that DefcalLibrary adds minimal compilation overhead while significantly improving quantum state fidelity through hardware-specific calibrations. The system scales efficiently with circuit size, maintaining linear performance characteristics.
34+
35+
**Section sources**
36+
- [defcal_performance_analysis.py](file://examples/defcal_performance_analysis.py)
37+
38+
## Layerwise Optimization for Deep Circuits
39+
40+
For deep quantum circuits with noise, the `performance_layerwise_optimization.py` example demonstrates a critical optimization technique: breaking the computation graph into layers to reduce JIT compilation time. This approach is particularly effective for circuits with many noise channels and deep parameterized layers.
41+
42+
The optimization works by forcing intermediate state computation at each layer, which breaks the monolithic computation graph into smaller, manageable pieces. This technique provides significant performance improvements:
43+
44+
```mermaid
45+
graph TD
46+
A[Standard Approach] --> B[Single Computation Graph]
47+
B --> C[Long JIT Compilation]
48+
C --> D[Deep Circuit: Minutes to Hours]
49+
E[Optimized Approach] --> F[Layerwise State Computation]
50+
F --> G[Broken Computation Graph]
51+
G --> H[Fast JIT Compilation]
52+
H --> I[10-30x Speedup]
53+
```
54+
55+
**Diagram sources**
56+
- [performance_layerwise_optimization.py](file://examples/performance_layerwise_optimization.py)
57+
58+
**Section sources**
59+
- [performance_layerwise_optimization.py](file://examples/performance_layerwise_optimization.py)
60+
61+
## Performance Benchmarking Tools
62+
63+
The framework provides several tools for performance measurement and analysis. The `utils.py` module contains a `benchmark` function that measures both staging (compilation) time and running time of jittable functions. This tool is essential for evaluating the performance characteristics of quantum circuits and compilation pipelines.
64+
65+
The benchmarking methodology includes:
66+
- First-run measurement (includes JIT compilation)
67+
- Subsequent runs (compiled execution only)
68+
- Statistical analysis of runtime consistency
69+
- Comparison of compilation and execution times
70+
71+
This approach allows for comprehensive performance evaluation that distinguishes between compilation overhead and execution efficiency, which is crucial for optimizing quantum algorithms.
72+
73+
**Section sources**
74+
- [utils.py](file://src/tyxonq/utils.py)
75+
76+
## Compiler and Execution Performance
77+
78+
The compiler architecture, as defined in `api.py`, implements a unified compilation entry point that supports multiple compilation engines and output formats. The system intelligently routes compilation based on circuit characteristics, automatically enabling pulse compilation when pulse operations are detected.
79+
80+
Key performance features include:
81+
- Automatic output format selection based on device target
82+
- Intelligent compilation engine routing
83+
- Caching of compiled source code to avoid redundant compilation
84+
- Support for hardware-aware compilation with device constraints
85+
86+
The statevector simulator engine implements efficient quantum state evolution with support for noise modeling and measurement sampling. It uses unified kernels with pluggable numerics backends, allowing for flexible performance characteristics based on the selected backend (numpy, pytorch, cupynumeric).
87+
88+
```mermaid
89+
graph TD
90+
A[Circuit] --> B[Compiler]
91+
B --> C{Pulse Operations?}
92+
C --> |Yes| D[Pulse Compiler]
93+
C --> |No| E[Native Compiler]
94+
D --> F[Pulse Schedule]
95+
E --> G[Optimized Circuit]
96+
F --> H[Execution]
97+
G --> H
98+
H --> I[Results]
99+
```
100+
101+
**Diagram sources**
102+
- [api.py](file://src/tyxonq/compiler/api.py)
103+
- [engine.py](file://src/tyxonq/devices/simulators/statevector/engine.py)
104+
105+
**Section sources**
106+
- [api.py](file://src/tyxonq/compiler/api.py)
107+
- [engine.py](file://src/tyxonq/devices/simulators/statevector/engine.py)
108+
109+
## Conclusion
110+
The performance analysis demonstrates that TyxonQ's Defcal system provides efficient hardware-aware compilation with minimal overhead. The framework offers sophisticated optimization techniques for deep circuits, particularly through layerwise state computation that dramatically reduces JIT compilation time. The modular compiler architecture and pluggable execution engines enable flexible performance characteristics across different use cases, from rapid prototyping to high-fidelity hardware simulation.
111+
112+
Key recommendations from the analysis include:
113+
- Use DefcalLibrary when available for improved fidelity
114+
- Apply layerwise optimization for deep circuits with noise
115+
- Leverage the benchmarking tools for performance evaluation
116+
- Consider the trade-offs between compilation time and execution efficiency based on circuit depth and complexity
117+
118+
The system demonstrates linear scalability with circuit size and provides robust tools for performance optimization in quantum algorithm development.

0 commit comments

Comments
 (0)