-
Notifications
You must be signed in to change notification settings - Fork 56
Added instructions for QA to run realtime predecoder test #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wsttiger
wants to merge
1
commit into
NVIDIA:main
Choose a base branch
from
wsttiger:add_test_predecoder_qa_docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| # Running test_realtime_predecoder_w_pymatching (d13_r104) | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```bash | ||
| # Download the bundle | ||
| wget https://urm.nvidia.com/artifactory/sw-cuda-qx-generic-local/predecoder-assets-tmp/predecoder_d13_r104_bundle.tar.gz | ||
|
|
||
| # Extract the bundle | ||
| tar xzf predecoder_d13_r104_bundle.tar.gz -C /path/to/data | ||
|
|
||
| # Copy ONNX model into the build tree (or wherever ONNX_MODEL_DIR points) | ||
| cp /path/to/data/models/predecoder_memory_d13_T104_X.onnx \ | ||
| libs/qec/lib/realtime/ | ||
|
|
||
| # Build | ||
| cd build && ninja test_realtime_predecoder_w_pymatching | ||
|
|
||
| # Run (104 µs injection rate, 20 seconds, with real Stim data) | ||
| ./libs/qec/unittests/test_realtime_predecoder_w_pymatching \ | ||
| d13_r104 104 20 \ | ||
| --data-dir /path/to/data/test_data/d13_T104_X/ | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Command Line | ||
|
|
||
| ``` | ||
| ./test_realtime_predecoder_w_pymatching d13_r104 [rate_us] [duration_s] [--data-dir <path>] | ||
| ``` | ||
|
|
||
| | Argument | Default | Description | | ||
| |----------|---------|-------------| | ||
| | `rate_us` | `0` (open-loop) | Inter-arrival time in µs between syndrome submissions | | ||
| | `duration_s` | `5` | Test duration in seconds | | ||
| | `--data-dir` | (none) | Path to Stim-generated test data for correctness verification | | ||
|
|
||
| --- | ||
|
|
||
| ## Distribution Bundle | ||
|
|
||
| **File:** `predecoder_d13_r104_bundle.tar.gz` (5.1 MB) | ||
|
|
||
| Contents: | ||
|
|
||
| ``` | ||
| models/ | ||
| predecoder_memory_d13_T104_X.onnx 3.8 MB TensorRT predecoder model (d=13, T=104, X basis) | ||
|
|
||
| test_data/d13_T104_X/ | ||
| detectors.bin 67 MB 1000 Stim-generated syndrome samples (17472 detectors each) | ||
| observables.bin 4 KB Ground truth logical observables (1000 × 1) | ||
| H_csr.bin 792 KB Parity check matrix in CSR format (17472 × 94021, 185060 nnz) | ||
| O_csr.bin 2.9 KB Observable matrix in CSR format (1 × 94021, 735 nnz) | ||
| priors.bin 735 KB Edge error probabilities for PyMatching (94021 doubles) | ||
| metadata.txt 258 B Generation parameters (distance, rounds, noise model, etc.) | ||
| ``` | ||
|
|
||
| ### Test Data Generation Parameters | ||
|
|
||
| From `metadata.txt`: | ||
|
|
||
| | Parameter | Value | | ||
| |-----------|-------| | ||
| | Distance | 13 | | ||
| | Rounds | 104 | | ||
| | Basis | X | | ||
| | Code rotation | XV | | ||
| | Physical error rate | 0.003 | | ||
| | Noise model | 25-param | | ||
| | Samples | 1000 | | ||
| | Detectors per sample | 17472 | | ||
|
|
||
| ### Binary File Formats | ||
|
|
||
| **detectors.bin / observables.bin:** | ||
| ``` | ||
| [uint32 num_rows][uint32 num_cols][int32 data × (rows × cols)] | ||
| ``` | ||
|
|
||
| **H_csr.bin / O_csr.bin (sparse CSR):** | ||
| ``` | ||
| [uint32 nrows][uint32 ncols][uint32 nnz][int32 indptr × (nrows+1)][int32 indices × nnz] | ||
| ``` | ||
|
|
||
| **priors.bin:** | ||
| ``` | ||
| [uint32 nedges][float64 priors × nedges] | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Pipeline Configuration (d13_r104) | ||
|
|
||
| | Parameter | Value | | ||
| |-----------|-------| | ||
| | Ring buffer slots | 16 | | ||
| | Predecoder streams | 8 | | ||
| | PyMatching worker threads | 16 | | ||
| | Model input | 17,472 × uint8 detectors | | ||
| | Model output | 17,473 × uint8 (1 logical prediction + 17,472 residual detectors) | | ||
| | Slot size | 32,768 bytes | | ||
| | Queue depth per predecoder | 1 | | ||
|
|
||
| --- | ||
|
|
||
| ## What Happens at Runtime | ||
|
|
||
| 1. **First run**: TRT compiles the ONNX model into a cached `.engine` file (~15s). Subsequent runs load the engine directly (~4s). | ||
| 2. **With `--data-dir`**: Loads real Stim data, builds PyMatching decoders from the full parity check matrix `H` with edge priors. Reports LER against ground truth. | ||
| 3. **Without `--data-dir`**: Uses random Bernoulli(0.01) syndromes, falls back to per-slice PyMatching with `cudaq-qec` surface code `H_z`. No LER verification. | ||
|
|
||
| --- | ||
|
|
||
| ## Expected Results | ||
|
|
||
| ``` | ||
| Submitted: 192,309 | ||
| Completed: 192,309 | ||
| Throughput: 9,610 req/s | ||
| Backpressure stalls: ~6M | ||
|
|
||
| Latency (µs): | ||
| min = 193 | ||
| p50 = 352 | ||
| mean = 391 | ||
| p90 = 511 | ||
| p95 = 594 | ||
| p99 = 1,240 | ||
| max = 3,798 | ||
|
|
||
| PyMatching decode: 223 µs avg | ||
| Syndrome density reduction: 98.3% | ||
| Pipeline LER: 0.0020 | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## System Requirements | ||
|
|
||
| | Dependency | Notes | | ||
| |------------|-------| | ||
| | CUDA Toolkit 12.0+ | CUDA runtime, CUDA graphs | | ||
| | TensorRT 10.x+ | Neural network inference engine | | ||
| | cudaq-realtime library | Host dispatcher, ring buffer API (installed at `/home/.cudaq_realtime/`) | | ||
| | cudaq-qec + PyMatching plugin | QEC framework and MWPM decoder (installed at `/home/.cudaqx/`) | | ||
| | NVIDIA GPU (sm_70+) | Grace Blackwell (GB200) is the primary target | | ||
| | ARM aarch64 or x86_64 | ARM (Grace) is the primary platform | | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wsttiger can you please add the predecoder runtime to this printout?