Add v2 FP16 and mixed-INT8 deployment bundle
Browse filesAdd verified deployment artifacts, standalone runtime/rebuild helpers, and paired accuracy/latency evidence under v2/quantized/. Root model card change: one link only; existing model files preserved.
- .gitattributes +8 -0
- README.md +2 -0
- v2/quantized/.gitattributes +3 -0
- v2/quantized/README.md +135 -0
- v2/quantized/SHA256SUMS +29 -0
- v2/quantized/benchmarks/X.errors.npz +0 -0
- v2/quantized/benchmarks/Z.errors.npz +0 -0
- v2/quantized/benchmarks/accuracy.json +190 -0
- v2/quantized/benchmarks/engine_builds.json +115 -0
- v2/quantized/benchmarks/latency.json +0 -0
- v2/quantized/benchmarks/protocol.json +19 -0
- v2/quantized/benchmarks/validation.json +119 -0
- v2/quantized/config.json +46 -0
- v2/quantized/engines/a100-trt10.9/fp16/X.engine +3 -0
- v2/quantized/engines/a100-trt10.9/fp16/Z.engine +3 -0
- v2/quantized/engines/a100-trt10.9/mixed-int8/X.engine +3 -0
- v2/quantized/engines/a100-trt10.9/mixed-int8/Z.engine +3 -0
- v2/quantized/examples/decode.py +41 -0
- v2/quantized/fp16/build_source_fp32/X.onnx +3 -0
- v2/quantized/fp16/build_source_fp32/Z.onnx +3 -0
- v2/quantized/fp16/model.safetensors +3 -0
- v2/quantized/manifest.json +132 -0
- v2/quantized/matching/X.dem +0 -0
- v2/quantized/matching/Z.dem +0 -0
- v2/quantized/mixed-int8/X.qdq.onnx +3 -0
- v2/quantized/mixed-int8/X.quantize.json +27 -0
- v2/quantized/mixed-int8/Z.qdq.onnx +3 -0
- v2/quantized/mixed-int8/Z.quantize.json +27 -0
- v2/quantized/requirements.txt +8 -0
- v2/quantized/runtime/__init__.py +3 -0
- v2/quantized/runtime/build_engine.py +83 -0
- v2/quantized/runtime/decoder.py +117 -0
.gitattributes
CHANGED
|
@@ -11,3 +11,11 @@ v2/assets/fig4_ood.png filter=lfs diff=lfs merge=lfs -text
|
|
| 11 |
v2/assets/fig5_willow.png filter=lfs diff=lfs merge=lfs -text
|
| 12 |
v2/data/paper_data.json filter=lfs diff=lfs merge=lfs -text
|
| 13 |
v2/assets/figS6_input_density.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
v2/assets/fig5_willow.png filter=lfs diff=lfs merge=lfs -text
|
| 12 |
v2/data/paper_data.json filter=lfs diff=lfs merge=lfs -text
|
| 13 |
v2/assets/figS6_input_density.png filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
v2/quantized/engines/a100-trt10.9/fp16/X.engine filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
v2/quantized/engines/a100-trt10.9/fp16/Z.engine filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
v2/quantized/engines/a100-trt10.9/mixed-int8/X.engine filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
v2/quantized/engines/a100-trt10.9/mixed-int8/Z.engine filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
v2/quantized/fp16/build_source_fp32/X.onnx filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
v2/quantized/fp16/build_source_fp32/Z.onnx filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
v2/quantized/mixed-int8/X.qdq.onnx filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
v2/quantized/mixed-int8/Z.qdq.onnx filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -20,6 +20,8 @@ QAdapt is a noise-adaptive neural pre-decoding framework for surface-code quantu
|
|
| 20 |
|
| 21 |
This release provides the **HTNet A101 final EWC checkpoint**, eight comparison checkpoints, inference code, noise configurations, and the numerical data behind the v2 manuscript figures. It is a PyTorch research model bundle; load it with the supplied inference code rather than Transformers `AutoModel`.
|
| 22 |
|
|
|
|
|
|
|
| 23 |

|
| 24 |
|
| 25 |
## Versions and paper
|
|
|
|
| 20 |
|
| 21 |
This release provides the **HTNet A101 final EWC checkpoint**, eight comparison checkpoints, inference code, noise configurations, and the numerical data behind the v2 manuscript figures. It is a PyTorch research model bundle; load it with the supplied inference code rather than Transformers `AutoModel`.
|
| 22 |
|
| 23 |
+
[FP16 and mixed-INT8 deployment: files, accuracy and latency comparisons](v2/quantized/README.md)
|
| 24 |
+
|
| 25 |

|
| 26 |
|
| 27 |
## Versions and paper
|
v2/quantized/.gitattributes
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.engine filter=lfs diff=lfs merge=lfs -text
|
v2/quantized/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# QAdapt v2 — FP16 and Mixed-INT8 Deployment
|
| 2 |
+
|
| 3 |
+
This directory provides **FP16** and **mixed INT8/FP16** deployment variants of the final QAdapt v2 HTNet A101 Online EWC checkpoint. They derive from the same C4 source checkpoint as [`../model.safetensors`](../model.safetensors). The manifest records the parent revision and artifact hashes.
|
| 4 |
+
|
| 5 |
+
## Available variants and files
|
| 6 |
+
|
| 7 |
+
| Variant | Description | Main files |
|
| 8 |
+
|---|---|---|
|
| 9 |
+
| FP16 | FP16 neural weights and TensorRT neural computation | [`fp16/model.safetensors`](fp16/model.safetensors), [`engines/a100-trt10.9/fp16/`](engines/a100-trt10.9/fp16) |
|
| 10 |
+
| Mixed INT8/FP16 | Nine neural convolutions use INT8; other computation retains floating-point precision | [`mixed-int8/`](mixed-int8), [`engines/a100-trt10.9/mixed-int8/`](engines/a100-trt10.9/mixed-int8) |
|
| 11 |
+
|
| 12 |
+
The mixed-INT8 variant is not an integer-only model. SafeTensors contains neural-network weights; ONNX and TensorRT engines contain the complete predecoder pipeline. The FP16 engine is rebuilt from the **FP32 ONNX source** in `fp16/build_source_fp32/`, with FP16 enabled during engine construction.
|
| 13 |
+
|
| 14 |
+
## Accuracy comparison
|
| 15 |
+
|
| 16 |
+
Evaluation uses T0 noise, distance 9, nine rounds, **65,536 paired shots per logical basis**, and evaluation seed 20261112. LER below is **whole-sequence logical failure probability**, not the equivalent per-round LER in the manuscript results.
|
| 17 |
+
|
| 18 |
+
| TensorRT variant | X LER (%) | Z LER (%) | Noninferiority |
|
| 19 |
+
|---|---:|---:|---|
|
| 20 |
+
| Original FP32 | 3.4607 | 3.5751 | Reference |
|
| 21 |
+
| FP16 | 3.4546 | 3.5751 | Pass |
|
| 22 |
+
| Mixed INT8/FP16 | 3.5156 | 3.5843 | Pass |
|
| 23 |
+
|
| 24 |
+
Noninferiority uses a **5% relative LER margin**, a one-sided paired test and Holm correction. Passing does not mean bit-identical output. FP16 and mixed-INT8 masks were reused from the fixed confirmation experiment after checking checkpoint, dataset, engine, runtime and hardware fingerprints; FP32 engine accuracy was measured on the same shots. Full statistics and paired masks are supplied in [`benchmarks/`](benchmarks).
|
| 25 |
+
|
| 26 |
+
These engine results are separate from the portable FP16-weight check: loading FP16 weights in another backend does not reproduce the TensorRT engine's arithmetic.
|
| 27 |
+
|
| 28 |
+
## Inference-time comparison
|
| 29 |
+
|
| 30 |
+
Conditions: **NVIDIA A100-SXM4-80GB**, **TensorRT 10.9.0.34**, **batch=1**, CUDA graphs for every engine, CPU core 4. Each variant uses **1,000 timed requests per basis**, after 100 benchmark warmup requests. The same varying requests are interleaved in randomized variant order.
|
| 31 |
+
|
| 32 |
+
| TensorRT variant | X P99 (ms) | Z P99 (ms) |
|
| 33 |
+
|---|---:|---:|
|
| 34 |
+
| Original FP32 | 2.316 | 2.273 |
|
| 35 |
+
| FP32, channel alignment | 1.833 | 1.793 |
|
| 36 |
+
| FP32, alignment and pointwise lowering | 1.845 | 1.800 |
|
| 37 |
+
| FP16 | 1.779 | 1.731 |
|
| 38 |
+
| Mixed INT8/FP16 | 1.801 | 1.783 |
|
| 39 |
+
|
| 40 |
+
Timing includes **host staging, H2D transfer, the complete predecoder, D2H transfer, PyMatching, and the final logical XOR**. It excludes sample generation, initialization, and QPU/network/queue latency. The helper below performs equivalent decoding; the table is from the recorded benchmark protocol, not CLI startup timing.
|
| 41 |
+
|
| 42 |
+
FP16 has the lowest measured P99 here. Optimized FP32 controls show that graph transformations account for much of the improvement over the original FP32 engine. The two optimized FP32 rows are timing controls without an additional full-shot accuracy claim. Raw P50/P95/P99 values are supplied in [`benchmarks/latency.json`](benchmarks/latency.json).
|
| 43 |
+
|
| 44 |
+
## Input and output
|
| 45 |
+
|
| 46 |
+
The bundled engines accept **`uint8[1,720]` detector bits**, in Stim order, for d9/r9 and orientation XV. They return **`uint8[1,721]`**:
|
| 47 |
+
|
| 48 |
+
- Column 0 is the predecoder logical-frame bit.
|
| 49 |
+
- Columns 1–720 are residual detector bits.
|
| 50 |
+
- Decode residuals using the matching-basis DEM, then XOR the matching prediction with column 0.
|
| 51 |
+
|
| 52 |
+
`QuantizedDecoder.decode` performs complete decoding and returns final logical bits. `predecode` returns the intermediate records. The helper accepts `uint8[N,720]` arrays and executes the batch-one engine serially. Direct SafeTensors loading instead returns the neural model's correction logits and requires the original preprocessing/postprocessing workflow.
|
| 53 |
+
|
| 54 |
+
## Quick start
|
| 55 |
+
|
| 56 |
+
Use Python 3.11 or later and a compatible NVIDIA CUDA GPU. The recorded environment used Python 3.12, PyTorch `2.5.1+cu121`, CUDA 12.1 and TensorRT `10.9.0.34`.
|
| 57 |
+
|
| 58 |
+
Download this deployment directory:
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
python -m pip install huggingface_hub
|
| 62 |
+
hf download Qhub-AI/QAdapt --include 'v2/quantized/**' --local-dir QAdapt
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Install the appropriate CUDA PyTorch wheel first, then the remaining dependencies. For the recorded CUDA 12.1 PyTorch build:
|
| 66 |
+
|
| 67 |
+
```bash
|
| 68 |
+
python -m pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cu121
|
| 69 |
+
python -m pip install -r QAdapt/v2/quantized/requirements.txt
|
| 70 |
+
cd QAdapt/v2/quantized
|
| 71 |
+
sha256sum -c SHA256SUMS
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Run an all-zero detector smoke input (a functional check, not an accuracy benchmark):
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
python examples/decode.py --basis X --precision fp16
|
| 78 |
+
python examples/decode.py --basis Z --precision mixed-int8
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
Decode NumPy `uint8[N,720]` records whose geometry and detector ordering match the supplied T0 protocol and DEM:
|
| 82 |
+
|
| 83 |
+
```bash
|
| 84 |
+
python examples/decode.py --basis X --precision mixed-int8 \
|
| 85 |
+
--detectors detectors_X.npy --output logical_predictions.npy
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
From Python, with this directory on `sys.path`:
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
import numpy as np
|
| 92 |
+
from runtime.decoder import QuantizedDecoder
|
| 93 |
+
|
| 94 |
+
decoder = QuantizedDecoder(basis="X", precision="fp16")
|
| 95 |
+
detectors = np.load("detectors_X.npy", allow_pickle=False)
|
| 96 |
+
logical_predictions = decoder.decode(detectors)
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
The runtime has no import dependency on the Ising-Decoding research checkout. It verifies bundled engine/DEM hashes. Use a separate decoder instance per concurrent thread.
|
| 100 |
+
|
| 101 |
+
## Rebuild on the target GPU
|
| 102 |
+
|
| 103 |
+
Install TensorRT's `trtexec` executable and build to a **new output path**:
|
| 104 |
+
|
| 105 |
+
```bash
|
| 106 |
+
python runtime/build_engine.py --basis X --precision fp16 \
|
| 107 |
+
--output /tmp/qadapt_X_fp16.engine --trtexec /opt/tensorrt/bin/trtexec
|
| 108 |
+
python runtime/build_engine.py --basis X --precision mixed-int8 \
|
| 109 |
+
--output /tmp/qadapt_X_int8.engine --trtexec /opt/tensorrt/bin/trtexec
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
The builder preserves the recorded precision policy, writes a log and layer report, and checks convolution/GEMM precision evidence. It refuses to overwrite existing build artifacts. Successful compilation is not target-device accuracy or speed acceptance.
|
| 113 |
+
|
| 114 |
+
Run an explicitly rebuilt engine:
|
| 115 |
+
|
| 116 |
+
```bash
|
| 117 |
+
python examples/decode.py --basis X --precision mixed-int8 \
|
| 118 |
+
--engine /tmp/qadapt_X_int8.engine --detectors detectors_X.npy
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
Explicit local engines are not authenticated by the bundled engine hash; their build reports record their source and engine checksums. Revalidate accuracy and latency on the target GPU/runtime. The bundled A100 engines and their measurements are not a portability guarantee.
|
| 122 |
+
|
| 123 |
+
## Quantization and reproducibility
|
| 124 |
+
|
| 125 |
+
Mixed INT8 uses static symmetric post-training quantization, per-channel weight scales, per-tensor activation scales, and entropy calibration on **1,024 T0 shots per basis**, seed **12345**. Selected convolution outputs retain floating-point precision. Q/DQ ONNX carries the activation scales; per-basis `quantize.json` files record the recipe and selected nodes.
|
| 126 |
+
|
| 127 |
+
Graph transformations include grouped-convolution channel padding from 28 to 32, followed by output trimming, and equivalent pointwise Conv2D lowering where used. [`benchmarks/engine_builds.json`](benchmarks/engine_builds.json) records actual compiled precision counts and original build-source hashes.
|
| 128 |
+
|
| 129 |
+
[`manifest.json`](manifest.json) links artifacts to the parent revision/checkpoint. [`SHA256SUMS`](SHA256SUMS) supports download verification. [`benchmarks/validation.json`](benchmarks/validation.json) distinguishes full evaluation evidence from release-runtime smoke/parity checks. The runtime does not update weights during inference.
|
| 130 |
+
|
| 131 |
+
## Scope, source and license
|
| 132 |
+
|
| 133 |
+
Quantized accuracy and latency are validated here only on **T0 d9/r9 X/Z** and the recorded A100 environment. The manuscript's broader OOD and Willow findings do not establish validation of these quantized variants. Local measurements and tests are not certified scientific acceptance.
|
| 134 |
+
|
| 135 |
+
See the repository [LICENSE](../../LICENSE), [NOTICE](../../NOTICE) and [root model card](../../README.md) for licensing, attribution, the paper and citation. Existing v1/v2 model files retain their original paths.
|
v2/quantized/SHA256SUMS
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ee769644015a04eb69f69f238cb74334d76f65e0834797e1ecb6f43f326648ca .gitattributes
|
| 2 |
+
1583f44d24a0bc39b957b1470dc4a85120233b747b86a457af1e894bbd3c9717 README.md
|
| 3 |
+
90b226dec7daf2c6242f3e8fca3826688864f6712f1065c1825ac8b5d3a18a58 benchmarks/X.errors.npz
|
| 4 |
+
0c94a6d260788ecaf9ccaf7cb10e711367c3eb5005f0a4188a829394e6901f6b benchmarks/Z.errors.npz
|
| 5 |
+
64863aed088eaf751f0d6ff5aebf6a87b8dad88f8ce7de1211f23826873462e1 benchmarks/accuracy.json
|
| 6 |
+
71daf775da6484bf22e987478151fa9b94edb8969826159294f232a37875f495 benchmarks/engine_builds.json
|
| 7 |
+
6e84546d9f05c6dd50850736b5c72f551f54889e7e0a312a7f9e228b70da43a0 benchmarks/latency.json
|
| 8 |
+
97c3c6ca95b211025a67ebb96b0418903a85833bc738e2c17bfeb699ce519732 benchmarks/protocol.json
|
| 9 |
+
10ec3318da23fcecb3bdf154326af221b053181c2e0b74cab24288d62d082ddd benchmarks/validation.json
|
| 10 |
+
88ce99f49a5ee7645222238e41cfc977d95e103b9bc69bee07766960aa4c74b6 config.json
|
| 11 |
+
fe758012107f9519584efb85018e9d437210c0d404056d4576ef70f84dd5a245 engines/a100-trt10.9/fp16/X.engine
|
| 12 |
+
709a8c36af09823700d7d52b2ae3ba954de094e295f8fe3016705871f6c475d7 engines/a100-trt10.9/fp16/Z.engine
|
| 13 |
+
cfc83008bb538fa78064ef89d159d39495c8cb62e385c422b0e3f41196a67a24 engines/a100-trt10.9/mixed-int8/X.engine
|
| 14 |
+
5854e9779c7eb2eb4c65da3bf8b665276547e6c06019ed8ebb447f884b4b99a7 engines/a100-trt10.9/mixed-int8/Z.engine
|
| 15 |
+
094fa32add924f733c18ea94aa748d3d9aab57c4f188be1ea3fbda1b865f7b1c examples/decode.py
|
| 16 |
+
b9cc3d27461d6e94ba35d6ca17b73162aa9c04be9c6e1c13ced9ef7e6180e0ce fp16/build_source_fp32/X.onnx
|
| 17 |
+
6054ca420d9e4fe92e53ae2b4f1d7e0eb949baaeeebf791d2ffe55ab7c6c0f24 fp16/build_source_fp32/Z.onnx
|
| 18 |
+
2b1537a0fb7e4811b6438ed586cafad499cfbdfd5f44c6794cc6bb171a2d8258 fp16/model.safetensors
|
| 19 |
+
453dc8492b6aba6d4360bfda6ddf44ff1e1895f819c69245dc4ffa2e9ecc4f58 manifest.json
|
| 20 |
+
63d0e7d5a5336c5db675847138b1dfaf89498fb956b3e2d29b050800706996f1 matching/X.dem
|
| 21 |
+
a4135f0034b9de265fa5bdf7d796071d03793b2b2d3a6a62cac39042afa99682 matching/Z.dem
|
| 22 |
+
33d40396b16d63fd893e37b332e75790af140bc44f6d7a427aa64ca76e90d9f7 mixed-int8/X.qdq.onnx
|
| 23 |
+
5a6c742cbc98c11ebc8b4b80f66b2165d6e4ce2ca708bffc3354232857473a61 mixed-int8/X.quantize.json
|
| 24 |
+
4f1e12cce74e0dfc9f61832d9e831beec0aeaca5da07bb11268bf243700b1957 mixed-int8/Z.qdq.onnx
|
| 25 |
+
e262ce809abd478922bcee49e565d5fbf02628be7bfa7114fd40dc6624b0d05f mixed-int8/Z.quantize.json
|
| 26 |
+
083a29e34852eeb23a958108343545ffff145d4aab397f950e82dca0d2e1c508 requirements.txt
|
| 27 |
+
4a9bbbb57e88aa53a0832704cba88573e8e8dbfda4901974c9580a2a30a08aad runtime/__init__.py
|
| 28 |
+
43f805d77523df14523dc992b259d2a5aa028ba15443d1525b616634846fbdaf runtime/build_engine.py
|
| 29 |
+
f25bcea0d1fcb4b74a84e99ba87332029f2f3a80c7a3cc18db82d196e5838a70 runtime/decoder.py
|
v2/quantized/benchmarks/X.errors.npz
ADDED
|
Binary file (13.8 kB). View file
|
|
|
v2/quantized/benchmarks/Z.errors.npz
ADDED
|
Binary file (14.2 kB). View file
|
|
|
v2/quantized/benchmarks/accuracy.json
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"basis_results": {
|
| 3 |
+
"X": {
|
| 4 |
+
"fp16_aligned": {
|
| 5 |
+
"ler": 0.0345458984375,
|
| 6 |
+
"statistics": {
|
| 7 |
+
"absolute_margin": 1.0,
|
| 8 |
+
"alpha": 0.05,
|
| 9 |
+
"baseline_ler": 0.03460693359375,
|
| 10 |
+
"baseline_logical_errors": 2268,
|
| 11 |
+
"baseline_only_errors": 18,
|
| 12 |
+
"both_errors": 2250,
|
| 13 |
+
"candidate_ler": 0.0345458984375,
|
| 14 |
+
"candidate_logical_errors": 2264,
|
| 15 |
+
"candidate_only_errors": 14,
|
| 16 |
+
"delta_ler": -6.103515625e-05,
|
| 17 |
+
"effective_margin": 0.0017303466796875,
|
| 18 |
+
"holm_adjusted_p_value": 0.0,
|
| 19 |
+
"holm_passed": true,
|
| 20 |
+
"neither_errors": 63254,
|
| 21 |
+
"noninferiority_p_value": 0.0,
|
| 22 |
+
"noninferiority_passed": true,
|
| 23 |
+
"one_sided_upper_bound": 8.094379767593956e-05,
|
| 24 |
+
"raw_p_value": 0.0,
|
| 25 |
+
"relative_margin": 0.05,
|
| 26 |
+
"samples": 65536,
|
| 27 |
+
"standard_error": 8.631707502696128e-05
|
| 28 |
+
},
|
| 29 |
+
"status": "PASS"
|
| 30 |
+
},
|
| 31 |
+
"fp32": {
|
| 32 |
+
"ler": 0.03460693359375,
|
| 33 |
+
"statistics": {
|
| 34 |
+
"absolute_margin": 1.0,
|
| 35 |
+
"alpha": 0.05,
|
| 36 |
+
"baseline_ler": 0.03460693359375,
|
| 37 |
+
"baseline_logical_errors": 2268,
|
| 38 |
+
"baseline_only_errors": 0,
|
| 39 |
+
"both_errors": 2268,
|
| 40 |
+
"candidate_ler": 0.03460693359375,
|
| 41 |
+
"candidate_logical_errors": 2268,
|
| 42 |
+
"candidate_only_errors": 0,
|
| 43 |
+
"delta_ler": 0.0,
|
| 44 |
+
"effective_margin": 0.0017303466796875,
|
| 45 |
+
"holm_adjusted_p_value": 0.0,
|
| 46 |
+
"holm_passed": true,
|
| 47 |
+
"neither_errors": 63268,
|
| 48 |
+
"noninferiority_p_value": 0.0,
|
| 49 |
+
"noninferiority_passed": true,
|
| 50 |
+
"one_sided_upper_bound": 0.0,
|
| 51 |
+
"raw_p_value": 0.0,
|
| 52 |
+
"relative_margin": 0.05,
|
| 53 |
+
"samples": 65536,
|
| 54 |
+
"standard_error": 0.0
|
| 55 |
+
},
|
| 56 |
+
"status": "PASS"
|
| 57 |
+
},
|
| 58 |
+
"fp32_aligned": {
|
| 59 |
+
"ler": null,
|
| 60 |
+
"status": "TIMING_CONTROL_ONLY"
|
| 61 |
+
},
|
| 62 |
+
"fp32_pointwise": {
|
| 63 |
+
"ler": null,
|
| 64 |
+
"status": "TIMING_CONTROL_ONLY"
|
| 65 |
+
},
|
| 66 |
+
"int8_dense9_entropy1024": {
|
| 67 |
+
"ler": 0.03515625,
|
| 68 |
+
"statistics": {
|
| 69 |
+
"absolute_margin": 1.0,
|
| 70 |
+
"alpha": 0.05,
|
| 71 |
+
"baseline_ler": 0.03460693359375,
|
| 72 |
+
"baseline_logical_errors": 2268,
|
| 73 |
+
"baseline_only_errors": 196,
|
| 74 |
+
"both_errors": 2072,
|
| 75 |
+
"candidate_ler": 0.03515625,
|
| 76 |
+
"candidate_logical_errors": 2304,
|
| 77 |
+
"candidate_only_errors": 232,
|
| 78 |
+
"delta_ler": 0.00054931640625,
|
| 79 |
+
"effective_margin": 0.0017303466796875,
|
| 80 |
+
"holm_adjusted_p_value": 9.152518011573685e-05,
|
| 81 |
+
"holm_passed": true,
|
| 82 |
+
"neither_errors": 63036,
|
| 83 |
+
"noninferiority_p_value": 9.152518011573685e-05,
|
| 84 |
+
"noninferiority_passed": true,
|
| 85 |
+
"one_sided_upper_bound": 0.001068549650607765,
|
| 86 |
+
"raw_p_value": 9.152518011573685e-05,
|
| 87 |
+
"relative_margin": 0.05,
|
| 88 |
+
"samples": 65536,
|
| 89 |
+
"standard_error": 0.0003156713982630164
|
| 90 |
+
},
|
| 91 |
+
"status": "PASS"
|
| 92 |
+
}
|
| 93 |
+
},
|
| 94 |
+
"Z": {
|
| 95 |
+
"fp16_aligned": {
|
| 96 |
+
"ler": 0.0357513427734375,
|
| 97 |
+
"statistics": {
|
| 98 |
+
"absolute_margin": 1.0,
|
| 99 |
+
"alpha": 0.05,
|
| 100 |
+
"baseline_ler": 0.0357513427734375,
|
| 101 |
+
"baseline_logical_errors": 2343,
|
| 102 |
+
"baseline_only_errors": 11,
|
| 103 |
+
"both_errors": 2332,
|
| 104 |
+
"candidate_ler": 0.0357513427734375,
|
| 105 |
+
"candidate_logical_errors": 2343,
|
| 106 |
+
"candidate_only_errors": 11,
|
| 107 |
+
"delta_ler": 0.0,
|
| 108 |
+
"effective_margin": 0.001787567138671875,
|
| 109 |
+
"holm_adjusted_p_value": 0.0,
|
| 110 |
+
"holm_passed": true,
|
| 111 |
+
"neither_errors": 63182,
|
| 112 |
+
"noninferiority_p_value": 0.0,
|
| 113 |
+
"noninferiority_passed": true,
|
| 114 |
+
"one_sided_upper_bound": 0.00011772317865401882,
|
| 115 |
+
"raw_p_value": 0.0,
|
| 116 |
+
"relative_margin": 0.05,
|
| 117 |
+
"samples": 65536,
|
| 118 |
+
"standard_error": 7.157061073708052e-05
|
| 119 |
+
},
|
| 120 |
+
"status": "PASS"
|
| 121 |
+
},
|
| 122 |
+
"fp32": {
|
| 123 |
+
"ler": 0.0357513427734375,
|
| 124 |
+
"statistics": {
|
| 125 |
+
"absolute_margin": 1.0,
|
| 126 |
+
"alpha": 0.05,
|
| 127 |
+
"baseline_ler": 0.0357513427734375,
|
| 128 |
+
"baseline_logical_errors": 2343,
|
| 129 |
+
"baseline_only_errors": 0,
|
| 130 |
+
"both_errors": 2343,
|
| 131 |
+
"candidate_ler": 0.0357513427734375,
|
| 132 |
+
"candidate_logical_errors": 2343,
|
| 133 |
+
"candidate_only_errors": 0,
|
| 134 |
+
"delta_ler": 0.0,
|
| 135 |
+
"effective_margin": 0.001787567138671875,
|
| 136 |
+
"holm_adjusted_p_value": 0.0,
|
| 137 |
+
"holm_passed": true,
|
| 138 |
+
"neither_errors": 63193,
|
| 139 |
+
"noninferiority_p_value": 0.0,
|
| 140 |
+
"noninferiority_passed": true,
|
| 141 |
+
"one_sided_upper_bound": 0.0,
|
| 142 |
+
"raw_p_value": 0.0,
|
| 143 |
+
"relative_margin": 0.05,
|
| 144 |
+
"samples": 65536,
|
| 145 |
+
"standard_error": 0.0
|
| 146 |
+
},
|
| 147 |
+
"status": "PASS"
|
| 148 |
+
},
|
| 149 |
+
"fp32_aligned": {
|
| 150 |
+
"ler": null,
|
| 151 |
+
"status": "TIMING_CONTROL_ONLY"
|
| 152 |
+
},
|
| 153 |
+
"fp32_pointwise": {
|
| 154 |
+
"ler": null,
|
| 155 |
+
"status": "TIMING_CONTROL_ONLY"
|
| 156 |
+
},
|
| 157 |
+
"int8_dense9_entropy1024": {
|
| 158 |
+
"ler": 0.0358428955078125,
|
| 159 |
+
"statistics": {
|
| 160 |
+
"absolute_margin": 1.0,
|
| 161 |
+
"alpha": 0.05,
|
| 162 |
+
"baseline_ler": 0.0357513427734375,
|
| 163 |
+
"baseline_logical_errors": 2343,
|
| 164 |
+
"baseline_only_errors": 265,
|
| 165 |
+
"both_errors": 2078,
|
| 166 |
+
"candidate_ler": 0.0358428955078125,
|
| 167 |
+
"candidate_logical_errors": 2349,
|
| 168 |
+
"candidate_only_errors": 271,
|
| 169 |
+
"delta_ler": 9.1552734375e-05,
|
| 170 |
+
"effective_margin": 0.001787567138671875,
|
| 171 |
+
"holm_adjusted_p_value": 1.5794261251089736e-06,
|
| 172 |
+
"holm_passed": true,
|
| 173 |
+
"neither_errors": 62922,
|
| 174 |
+
"noninferiority_p_value": 7.897130625544868e-07,
|
| 175 |
+
"noninferiority_passed": true,
|
| 176 |
+
"one_sided_upper_bound": 0.0006726285652850868,
|
| 177 |
+
"raw_p_value": 7.897130625544868e-07,
|
| 178 |
+
"relative_margin": 0.05,
|
| 179 |
+
"samples": 65536,
|
| 180 |
+
"standard_error": 0.0003532690212605954
|
| 181 |
+
},
|
| 182 |
+
"status": "PASS"
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
},
|
| 186 |
+
"metric": "whole-sequence logical failure probability p",
|
| 187 |
+
"multiple_testing": "Holm across measured FP32/FP16/mixed INT8 variants and both bases",
|
| 188 |
+
"seed": 20261112,
|
| 189 |
+
"shots_per_basis": 65536
|
| 190 |
+
}
|
v2/quantized/benchmarks/engine_builds.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"X": {
|
| 3 |
+
"fp16": {
|
| 4 |
+
"batch_profile": [
|
| 5 |
+
1,
|
| 6 |
+
1,
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
"compute_precision_counts": {
|
| 10 |
+
"fp16": 34
|
| 11 |
+
},
|
| 12 |
+
"engine_sha256": "fe758012107f9519584efb85018e9d437210c0d404056d4576ef70f84dd5a245",
|
| 13 |
+
"layer_precision_counts": {
|
| 14 |
+
"fp16": 325,
|
| 15 |
+
"uint8": 2
|
| 16 |
+
},
|
| 17 |
+
"original_builder_flags": [
|
| 18 |
+
"--maxShapes=dets:1x720",
|
| 19 |
+
"--profilingVerbosity=detailed",
|
| 20 |
+
"--exportLayerInfo=local_measurements/qadapt_quantization_20261112/X/fp16_aligned/layers.json.tmp",
|
| 21 |
+
"--skipInference",
|
| 22 |
+
"--fp16",
|
| 23 |
+
"--noTF32",
|
| 24 |
+
"--layerPrecisions=/model/*:fp16",
|
| 25 |
+
"--precisionConstraints=prefer"
|
| 26 |
+
],
|
| 27 |
+
"source_onnx_sha256": "b9cc3d27461d6e94ba35d6ca17b73162aa9c04be9c6e1c13ced9ef7e6180e0ce"
|
| 28 |
+
},
|
| 29 |
+
"mixed-int8": {
|
| 30 |
+
"batch_profile": [
|
| 31 |
+
1,
|
| 32 |
+
1,
|
| 33 |
+
1
|
| 34 |
+
],
|
| 35 |
+
"compute_precision_counts": {
|
| 36 |
+
"fp16": 25,
|
| 37 |
+
"int8": 9
|
| 38 |
+
},
|
| 39 |
+
"engine_sha256": "cfc83008bb538fa78064ef89d159d39495c8cb62e385c422b0e3f41196a67a24",
|
| 40 |
+
"layer_precision_counts": {
|
| 41 |
+
"fp16": 345,
|
| 42 |
+
"fp32": 9,
|
| 43 |
+
"int8": 48,
|
| 44 |
+
"uint8": 2
|
| 45 |
+
},
|
| 46 |
+
"original_builder_flags": [
|
| 47 |
+
"--maxShapes=dets:1x720",
|
| 48 |
+
"--profilingVerbosity=detailed",
|
| 49 |
+
"--exportLayerInfo=local_measurements/qadapt_quantization_20261112/X/int8_dense9_entropy1024/layers.json.tmp",
|
| 50 |
+
"--skipInference",
|
| 51 |
+
"--fp16",
|
| 52 |
+
"--noTF32",
|
| 53 |
+
"--layerPrecisions=/model/*:fp16",
|
| 54 |
+
"--precisionConstraints=prefer"
|
| 55 |
+
],
|
| 56 |
+
"source_onnx_sha256": "33d40396b16d63fd893e37b332e75790af140bc44f6d7a427aa64ca76e90d9f7"
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
"Z": {
|
| 60 |
+
"fp16": {
|
| 61 |
+
"batch_profile": [
|
| 62 |
+
1,
|
| 63 |
+
1,
|
| 64 |
+
1
|
| 65 |
+
],
|
| 66 |
+
"compute_precision_counts": {
|
| 67 |
+
"fp16": 34
|
| 68 |
+
},
|
| 69 |
+
"engine_sha256": "709a8c36af09823700d7d52b2ae3ba954de094e295f8fe3016705871f6c475d7",
|
| 70 |
+
"layer_precision_counts": {
|
| 71 |
+
"fp16": 325,
|
| 72 |
+
"uint8": 2
|
| 73 |
+
},
|
| 74 |
+
"original_builder_flags": [
|
| 75 |
+
"--maxShapes=dets:1x720",
|
| 76 |
+
"--profilingVerbosity=detailed",
|
| 77 |
+
"--exportLayerInfo=local_measurements/qadapt_quantization_20261112/Z/fp16_aligned/layers.json.tmp",
|
| 78 |
+
"--skipInference",
|
| 79 |
+
"--fp16",
|
| 80 |
+
"--noTF32",
|
| 81 |
+
"--layerPrecisions=/model/*:fp16",
|
| 82 |
+
"--precisionConstraints=prefer"
|
| 83 |
+
],
|
| 84 |
+
"source_onnx_sha256": "6054ca420d9e4fe92e53ae2b4f1d7e0eb949baaeeebf791d2ffe55ab7c6c0f24"
|
| 85 |
+
},
|
| 86 |
+
"mixed-int8": {
|
| 87 |
+
"batch_profile": [
|
| 88 |
+
1,
|
| 89 |
+
1,
|
| 90 |
+
1
|
| 91 |
+
],
|
| 92 |
+
"compute_precision_counts": {
|
| 93 |
+
"fp16": 25,
|
| 94 |
+
"int8": 9
|
| 95 |
+
},
|
| 96 |
+
"engine_sha256": "5854e9779c7eb2eb4c65da3bf8b665276547e6c06019ed8ebb447f884b4b99a7",
|
| 97 |
+
"layer_precision_counts": {
|
| 98 |
+
"fp16": 357,
|
| 99 |
+
"int8": 48,
|
| 100 |
+
"uint8": 2
|
| 101 |
+
},
|
| 102 |
+
"original_builder_flags": [
|
| 103 |
+
"--maxShapes=dets:1x720",
|
| 104 |
+
"--profilingVerbosity=detailed",
|
| 105 |
+
"--exportLayerInfo=local_measurements/qadapt_quantization_20261112/Z/int8_dense9_entropy1024/layers.json.tmp",
|
| 106 |
+
"--skipInference",
|
| 107 |
+
"--fp16",
|
| 108 |
+
"--noTF32",
|
| 109 |
+
"--layerPrecisions=/model/*:fp16",
|
| 110 |
+
"--precisionConstraints=prefer"
|
| 111 |
+
],
|
| 112 |
+
"source_onnx_sha256": "4f1e12cce74e0dfc9f61832d9e831beec0aeaca5da07bb11268bf243700b1957"
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
}
|
v2/quantized/benchmarks/latency.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
v2/quantized/benchmarks/protocol.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "TensorRT for all measured methods",
|
| 3 |
+
"batch_size": 1,
|
| 4 |
+
"cuda_graph": true,
|
| 5 |
+
"evaluation_seed": 20261112,
|
| 6 |
+
"hardware": "NVIDIA A100-SXM4-80GB",
|
| 7 |
+
"latency_requests_per_variant_per_basis": 1000,
|
| 8 |
+
"limitations": [
|
| 9 |
+
"mixed INT8 is the nine-convolution PTQ deployment, not the full integer PyTorch W8A8 model",
|
| 10 |
+
"full integer models require a separate deployment adaptation; no latency is invented for them",
|
| 11 |
+
"FP32 aligned/pointwise entries are timing-only controls",
|
| 12 |
+
"accuracy seed differs from the later all-PyTorch experiment; no paired cross-backend accuracy inference"
|
| 13 |
+
],
|
| 14 |
+
"multiple_testing": "Holm across measured FP32/FP16/mixed INT8 variants and both bases",
|
| 15 |
+
"protocol": "host staging + H2D + complete predecoder + D2H + PyMatching + logical XOR",
|
| 16 |
+
"shots_per_basis": 65536,
|
| 17 |
+
"status": "COMPLETE_FOR_AVAILABLE_ENGINES",
|
| 18 |
+
"tensorrt": "10.9.0.34"
|
| 19 |
+
}
|
v2/quantized/benchmarks/validation.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"status": "PASS",
|
| 3 |
+
"environment": "ising-decoding",
|
| 4 |
+
"interpreter": "/root/miniconda3/envs/ising-decoding/bin/python",
|
| 5 |
+
"prefix": "/root/miniconda3/envs/ising-decoding",
|
| 6 |
+
"torch": "2.5.1+cu121",
|
| 7 |
+
"hardware": "NVIDIA A100-SXM4-80GB",
|
| 8 |
+
"parent_weights_bit_exact_to_local_fp32": true,
|
| 9 |
+
"fp16_weights_exact_parent_half_cast": true,
|
| 10 |
+
"onnx_full_type_checks": 4,
|
| 11 |
+
"runtime_parity_cases": [
|
| 12 |
+
{
|
| 13 |
+
"basis": "X",
|
| 14 |
+
"precision": "fp16",
|
| 15 |
+
"cuda_graph": true,
|
| 16 |
+
"shots": 64,
|
| 17 |
+
"predecoder_bit_exact": true,
|
| 18 |
+
"logical_prediction_exact": true
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"basis": "X",
|
| 22 |
+
"precision": "fp16",
|
| 23 |
+
"cuda_graph": false,
|
| 24 |
+
"shots": 64,
|
| 25 |
+
"predecoder_bit_exact": true,
|
| 26 |
+
"logical_prediction_exact": true
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"basis": "X",
|
| 30 |
+
"precision": "mixed-int8",
|
| 31 |
+
"cuda_graph": true,
|
| 32 |
+
"shots": 64,
|
| 33 |
+
"predecoder_bit_exact": true,
|
| 34 |
+
"logical_prediction_exact": true
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"basis": "X",
|
| 38 |
+
"precision": "mixed-int8",
|
| 39 |
+
"cuda_graph": false,
|
| 40 |
+
"shots": 64,
|
| 41 |
+
"predecoder_bit_exact": true,
|
| 42 |
+
"logical_prediction_exact": true
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"basis": "Z",
|
| 46 |
+
"precision": "fp16",
|
| 47 |
+
"cuda_graph": true,
|
| 48 |
+
"shots": 64,
|
| 49 |
+
"predecoder_bit_exact": true,
|
| 50 |
+
"logical_prediction_exact": true
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"basis": "Z",
|
| 54 |
+
"precision": "fp16",
|
| 55 |
+
"cuda_graph": false,
|
| 56 |
+
"shots": 64,
|
| 57 |
+
"predecoder_bit_exact": true,
|
| 58 |
+
"logical_prediction_exact": true
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"basis": "Z",
|
| 62 |
+
"precision": "mixed-int8",
|
| 63 |
+
"cuda_graph": true,
|
| 64 |
+
"shots": 64,
|
| 65 |
+
"predecoder_bit_exact": true,
|
| 66 |
+
"logical_prediction_exact": true
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"basis": "Z",
|
| 70 |
+
"precision": "mixed-int8",
|
| 71 |
+
"cuda_graph": false,
|
| 72 |
+
"shots": 64,
|
| 73 |
+
"predecoder_bit_exact": true,
|
| 74 |
+
"logical_prediction_exact": true
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"standalone_cli_cases": [
|
| 78 |
+
{
|
| 79 |
+
"basis": "X",
|
| 80 |
+
"precision": "fp16",
|
| 81 |
+
"standalone_cli": "PASS"
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"basis": "X",
|
| 85 |
+
"precision": "mixed-int8",
|
| 86 |
+
"standalone_cli": "PASS"
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"basis": "Z",
|
| 90 |
+
"precision": "fp16",
|
| 91 |
+
"standalone_cli": "PASS"
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"basis": "Z",
|
| 95 |
+
"precision": "mixed-int8",
|
| 96 |
+
"standalone_cli": "PASS"
|
| 97 |
+
}
|
| 98 |
+
],
|
| 99 |
+
"invalid_inputs_rejected": true,
|
| 100 |
+
"checksum_corruption_rejected": true,
|
| 101 |
+
"root_readme": "one added hyperlink; original text and section headings preserved",
|
| 102 |
+
"full_accuracy_evidence": "Existing 65536 shots per basis for the exact engine hashes; source fingerprints verified",
|
| 103 |
+
"release_tests": "64 real T0 shots per basis, compared with original runner for both precisions with and without CUDA graphs; these are functional parity checks, not another scientific acceptance experiment",
|
| 104 |
+
"target_rebuild": {
|
| 105 |
+
"status": "PASS",
|
| 106 |
+
"basis": "X",
|
| 107 |
+
"precision_counts": {
|
| 108 |
+
"fp16": {
|
| 109 |
+
"fp16": 34
|
| 110 |
+
},
|
| 111 |
+
"mixed-int8": {
|
| 112 |
+
"fp16": 25,
|
| 113 |
+
"int8": 9
|
| 114 |
+
}
|
| 115 |
+
},
|
| 116 |
+
"rebuilt_engine_cli_smoke": "PASS for FP16 and mixed INT8",
|
| 117 |
+
"scope": "Build and one-shot execution checks only; bundled measured engines preserved; not another full LER acceptance run"
|
| 118 |
+
}
|
| 119 |
+
}
|
v2/quantized/config.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"HTnet"
|
| 4 |
+
],
|
| 5 |
+
"channels": 112,
|
| 6 |
+
"code_rotation": "O1",
|
| 7 |
+
"deployment_distance": 9,
|
| 8 |
+
"deployment_rotation": "XV",
|
| 9 |
+
"deployment_rounds": 9,
|
| 10 |
+
"detector_input_shape": [
|
| 11 |
+
1,
|
| 12 |
+
720
|
| 13 |
+
],
|
| 14 |
+
"engine_batch_size": 1,
|
| 15 |
+
"expand_channels": 168,
|
| 16 |
+
"fp16_weights_file": "fp16/model.safetensors",
|
| 17 |
+
"htnet_ablation": {
|
| 18 |
+
"axis_channel_gate": false,
|
| 19 |
+
"branch_mixer": true,
|
| 20 |
+
"input_skip_head": true
|
| 21 |
+
},
|
| 22 |
+
"joint_groups": 6,
|
| 23 |
+
"model_id": 111,
|
| 24 |
+
"norm_groups": 8,
|
| 25 |
+
"num_blocks": 3,
|
| 26 |
+
"parameters": 650332,
|
| 27 |
+
"parent_file": "../model.safetensors",
|
| 28 |
+
"parent_revision": "b6711e3e8c5506e5e0a60ceb581618a8283e048e",
|
| 29 |
+
"parent_source_checkpoint_sha256": "cda1865af5f12b7e0e58db9a5e0aae45c70b26ee8593d939f7ca534176e78131",
|
| 30 |
+
"parent_weights_sha256": "fb37f7031a141f6f918e9dd468fae32193674455980924e77e3c24eb866f51a5",
|
| 31 |
+
"predecoder_output_shape": [
|
| 32 |
+
1,
|
| 33 |
+
721
|
| 34 |
+
],
|
| 35 |
+
"release": "v2 quantized deployment",
|
| 36 |
+
"release_version": "v2",
|
| 37 |
+
"role": "H_EWC",
|
| 38 |
+
"se_reduction": 4,
|
| 39 |
+
"training_distance": 9,
|
| 40 |
+
"training_rounds": 9,
|
| 41 |
+
"upstream_commit": "33acb152e403bc189f2effdb07f1a87b34c745f1",
|
| 42 |
+
"variants": [
|
| 43 |
+
"fp16",
|
| 44 |
+
"mixed-int8"
|
| 45 |
+
]
|
| 46 |
+
}
|
v2/quantized/engines/a100-trt10.9/fp16/X.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fe758012107f9519584efb85018e9d437210c0d404056d4576ef70f84dd5a245
|
| 3 |
+
size 3124804
|
v2/quantized/engines/a100-trt10.9/fp16/Z.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:709a8c36af09823700d7d52b2ae3ba954de094e295f8fe3016705871f6c475d7
|
| 3 |
+
size 3082004
|
v2/quantized/engines/a100-trt10.9/mixed-int8/X.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cfc83008bb538fa78064ef89d159d39495c8cb62e385c422b0e3f41196a67a24
|
| 3 |
+
size 5964332
|
v2/quantized/engines/a100-trt10.9/mixed-int8/Z.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5854e9779c7eb2eb4c65da3bf8b665276547e6c06019ed8ebb447f884b4b99a7
|
| 3 |
+
size 3567412
|
v2/quantized/examples/decode.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 3 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 4 |
+
"""Decode uint8 detector records with the standalone quantized runtime."""
|
| 5 |
+
import argparse
|
| 6 |
+
import json
|
| 7 |
+
import sys
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
|
| 12 |
+
BUNDLE = Path(__file__).resolve().parents[1]
|
| 13 |
+
sys.path.insert(0, str(BUNDLE / 'runtime'))
|
| 14 |
+
from decoder import QuantizedDecoder
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def main():
|
| 18 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 19 |
+
parser.add_argument('--bundle', type=Path, default=BUNDLE)
|
| 20 |
+
parser.add_argument('--basis', choices=('X', 'Z'), required=True)
|
| 21 |
+
parser.add_argument('--precision', choices=('fp16', 'mixed-int8'), required=True)
|
| 22 |
+
parser.add_argument('--detectors', type=Path, help='NumPy .npy containing uint8[N,720] detector bits')
|
| 23 |
+
parser.add_argument('--output', type=Path, help='Save the final logical prediction array as .npy')
|
| 24 |
+
parser.add_argument('--engine', type=Path, help='Explicit locally rebuilt engine instead of the bundled A100 engine')
|
| 25 |
+
parser.add_argument('--device', default='cuda:0')
|
| 26 |
+
parser.add_argument('--no-cuda-graph', action='store_true')
|
| 27 |
+
args = parser.parse_args()
|
| 28 |
+
rows = np.load(args.detectors, allow_pickle=False) if args.detectors else np.zeros((1, 720), dtype=np.uint8)
|
| 29 |
+
decoder = QuantizedDecoder(args.bundle, basis=args.basis, precision=args.precision,
|
| 30 |
+
device=args.device, engine_path=args.engine, cuda_graph=not args.no_cuda_graph)
|
| 31 |
+
predictions = decoder.decode(rows)
|
| 32 |
+
if args.output:
|
| 33 |
+
np.save(args.output, predictions, allow_pickle=False)
|
| 34 |
+
print(json.dumps({'basis': args.basis, 'precision': args.precision, 'shots': len(predictions),
|
| 35 |
+
'input': str(args.detectors) if args.detectors else 'all-zero detector smoke input (not a benchmark)',
|
| 36 |
+
'logical_predictions_preview': predictions[:16].tolist(),
|
| 37 |
+
'output': str(args.output) if args.output else None}, indent=2))
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
if __name__ == '__main__':
|
| 41 |
+
main()
|
v2/quantized/fp16/build_source_fp32/X.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b9cc3d27461d6e94ba35d6ca17b73162aa9c04be9c6e1c13ced9ef7e6180e0ce
|
| 3 |
+
size 3294315
|
v2/quantized/fp16/build_source_fp32/Z.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6054ca420d9e4fe92e53ae2b4f1d7e0eb949baaeeebf791d2ffe55ab7c6c0f24
|
| 3 |
+
size 3294692
|
v2/quantized/fp16/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b1537a0fb7e4811b6438ed586cafad499cfbdfd5f44c6794cc6bb171a2d8258
|
| 3 |
+
size 1308512
|
v2/quantized/manifest.json
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"created_at": "2026-11-16T18:08:28.919426+08:00",
|
| 3 |
+
"engine_environment": {
|
| 4 |
+
"batch_size": 1,
|
| 5 |
+
"cuda": "12.1",
|
| 6 |
+
"gpu": "NVIDIA A100-SXM4-80GB",
|
| 7 |
+
"tensorrt": "10.9.0.34",
|
| 8 |
+
"torch": "2.5.1+cu121"
|
| 9 |
+
},
|
| 10 |
+
"files": {
|
| 11 |
+
".gitattributes": {
|
| 12 |
+
"bytes": 138,
|
| 13 |
+
"sha256": "ee769644015a04eb69f69f238cb74334d76f65e0834797e1ecb6f43f326648ca"
|
| 14 |
+
},
|
| 15 |
+
"README.md": {
|
| 16 |
+
"bytes": 8429,
|
| 17 |
+
"sha256": "1583f44d24a0bc39b957b1470dc4a85120233b747b86a457af1e894bbd3c9717"
|
| 18 |
+
},
|
| 19 |
+
"benchmarks/X.errors.npz": {
|
| 20 |
+
"bytes": 13840,
|
| 21 |
+
"sha256": "90b226dec7daf2c6242f3e8fca3826688864f6712f1065c1825ac8b5d3a18a58"
|
| 22 |
+
},
|
| 23 |
+
"benchmarks/Z.errors.npz": {
|
| 24 |
+
"bytes": 14162,
|
| 25 |
+
"sha256": "0c94a6d260788ecaf9ccaf7cb10e711367c3eb5005f0a4188a829394e6901f6b"
|
| 26 |
+
},
|
| 27 |
+
"benchmarks/accuracy.json": {
|
| 28 |
+
"bytes": 6349,
|
| 29 |
+
"sha256": "64863aed088eaf751f0d6ff5aebf6a87b8dad88f8ce7de1211f23826873462e1"
|
| 30 |
+
},
|
| 31 |
+
"benchmarks/engine_builds.json": {
|
| 32 |
+
"bytes": 3336,
|
| 33 |
+
"sha256": "71daf775da6484bf22e987478151fa9b94edb8969826159294f232a37875f495"
|
| 34 |
+
},
|
| 35 |
+
"benchmarks/latency.json": {
|
| 36 |
+
"bytes": 202144,
|
| 37 |
+
"sha256": "6e84546d9f05c6dd50850736b5c72f551f54889e7e0a312a7f9e228b70da43a0"
|
| 38 |
+
},
|
| 39 |
+
"benchmarks/protocol.json": {
|
| 40 |
+
"bytes": 893,
|
| 41 |
+
"sha256": "97c3c6ca95b211025a67ebb96b0418903a85833bc738e2c17bfeb699ce519732"
|
| 42 |
+
},
|
| 43 |
+
"benchmarks/validation.json": {
|
| 44 |
+
"bytes": 3175,
|
| 45 |
+
"sha256": "10ec3318da23fcecb3bdf154326af221b053181c2e0b74cab24288d62d082ddd"
|
| 46 |
+
},
|
| 47 |
+
"config.json": {
|
| 48 |
+
"bytes": 1164,
|
| 49 |
+
"sha256": "88ce99f49a5ee7645222238e41cfc977d95e103b9bc69bee07766960aa4c74b6"
|
| 50 |
+
},
|
| 51 |
+
"engines/a100-trt10.9/fp16/X.engine": {
|
| 52 |
+
"bytes": 3124804,
|
| 53 |
+
"sha256": "fe758012107f9519584efb85018e9d437210c0d404056d4576ef70f84dd5a245"
|
| 54 |
+
},
|
| 55 |
+
"engines/a100-trt10.9/fp16/Z.engine": {
|
| 56 |
+
"bytes": 3082004,
|
| 57 |
+
"sha256": "709a8c36af09823700d7d52b2ae3ba954de094e295f8fe3016705871f6c475d7"
|
| 58 |
+
},
|
| 59 |
+
"engines/a100-trt10.9/mixed-int8/X.engine": {
|
| 60 |
+
"bytes": 5964332,
|
| 61 |
+
"sha256": "cfc83008bb538fa78064ef89d159d39495c8cb62e385c422b0e3f41196a67a24"
|
| 62 |
+
},
|
| 63 |
+
"engines/a100-trt10.9/mixed-int8/Z.engine": {
|
| 64 |
+
"bytes": 3567412,
|
| 65 |
+
"sha256": "5854e9779c7eb2eb4c65da3bf8b665276547e6c06019ed8ebb447f884b4b99a7"
|
| 66 |
+
},
|
| 67 |
+
"examples/decode.py": {
|
| 68 |
+
"bytes": 2082,
|
| 69 |
+
"sha256": "094fa32add924f733c18ea94aa748d3d9aab57c4f188be1ea3fbda1b865f7b1c"
|
| 70 |
+
},
|
| 71 |
+
"fp16/build_source_fp32/X.onnx": {
|
| 72 |
+
"bytes": 3294315,
|
| 73 |
+
"sha256": "b9cc3d27461d6e94ba35d6ca17b73162aa9c04be9c6e1c13ced9ef7e6180e0ce"
|
| 74 |
+
},
|
| 75 |
+
"fp16/build_source_fp32/Z.onnx": {
|
| 76 |
+
"bytes": 3294692,
|
| 77 |
+
"sha256": "6054ca420d9e4fe92e53ae2b4f1d7e0eb949baaeeebf791d2ffe55ab7c6c0f24"
|
| 78 |
+
},
|
| 79 |
+
"fp16/model.safetensors": {
|
| 80 |
+
"bytes": 1308512,
|
| 81 |
+
"sha256": "2b1537a0fb7e4811b6438ed586cafad499cfbdfd5f44c6794cc6bb171a2d8258"
|
| 82 |
+
},
|
| 83 |
+
"matching/X.dem": {
|
| 84 |
+
"bytes": 243299,
|
| 85 |
+
"sha256": "63d0e7d5a5336c5db675847138b1dfaf89498fb956b3e2d29b050800706996f1"
|
| 86 |
+
},
|
| 87 |
+
"matching/Z.dem": {
|
| 88 |
+
"bytes": 243605,
|
| 89 |
+
"sha256": "a4135f0034b9de265fa5bdf7d796071d03793b2b2d3a6a62cac39042afa99682"
|
| 90 |
+
},
|
| 91 |
+
"mixed-int8/X.qdq.onnx": {
|
| 92 |
+
"bytes": 3041040,
|
| 93 |
+
"sha256": "33d40396b16d63fd893e37b332e75790af140bc44f6d7a427aa64ca76e90d9f7"
|
| 94 |
+
},
|
| 95 |
+
"mixed-int8/X.quantize.json": {
|
| 96 |
+
"bytes": 1109,
|
| 97 |
+
"sha256": "5a6c742cbc98c11ebc8b4b80f66b2165d6e4ce2ca708bffc3354232857473a61"
|
| 98 |
+
},
|
| 99 |
+
"mixed-int8/Z.qdq.onnx": {
|
| 100 |
+
"bytes": 3041579,
|
| 101 |
+
"sha256": "4f1e12cce74e0dfc9f61832d9e831beec0aeaca5da07bb11268bf243700b1957"
|
| 102 |
+
},
|
| 103 |
+
"mixed-int8/Z.quantize.json": {
|
| 104 |
+
"bytes": 1109,
|
| 105 |
+
"sha256": "e262ce809abd478922bcee49e565d5fbf02628be7bfa7114fd40dc6624b0d05f"
|
| 106 |
+
},
|
| 107 |
+
"requirements.txt": {
|
| 108 |
+
"bytes": 202,
|
| 109 |
+
"sha256": "083a29e34852eeb23a958108343545ffff145d4aab397f950e82dca0d2e1c508"
|
| 110 |
+
},
|
| 111 |
+
"runtime/__init__.py": {
|
| 112 |
+
"bytes": 191,
|
| 113 |
+
"sha256": "4a9bbbb57e88aa53a0832704cba88573e8e8dbfda4901974c9580a2a30a08aad"
|
| 114 |
+
},
|
| 115 |
+
"runtime/build_engine.py": {
|
| 116 |
+
"bytes": 4442,
|
| 117 |
+
"sha256": "43f805d77523df14523dc992b259d2a5aa028ba15443d1525b616634846fbdaf"
|
| 118 |
+
},
|
| 119 |
+
"runtime/decoder.py": {
|
| 120 |
+
"bytes": 6125,
|
| 121 |
+
"sha256": "f25bcea0d1fcb4b74a84e99ba87332029f2f3a80c7a3cc18db82d196e5838a70"
|
| 122 |
+
}
|
| 123 |
+
},
|
| 124 |
+
"format_version": 1,
|
| 125 |
+
"parent_model": "v2/model.safetensors",
|
| 126 |
+
"parent_revision": "b6711e3e8c5506e5e0a60ceb581618a8283e048e",
|
| 127 |
+
"parent_source_checkpoint_sha256": "cda1865af5f12b7e0e58db9a5e0aae45c70b26ee8593d939f7ca534176e78131",
|
| 128 |
+
"parent_tensor_verification": "all tensors bit exact to local FP32; FP16 exactly equals parent half cast",
|
| 129 |
+
"parent_weights_sha256": "fb37f7031a141f6f918e9dd468fae32193674455980924e77e3c24eb866f51a5",
|
| 130 |
+
"release": "v2 quantized deployment",
|
| 131 |
+
"repository": "Qhub-AI/QAdapt"
|
| 132 |
+
}
|
v2/quantized/matching/X.dem
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
v2/quantized/matching/Z.dem
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
v2/quantized/mixed-int8/X.qdq.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:33d40396b16d63fd893e37b332e75790af140bc44f6d7a427aa64ca76e90d9f7
|
| 3 |
+
size 3041040
|
v2/quantized/mixed-int8/X.quantize.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"status": "PASS",
|
| 3 |
+
"basis": "X",
|
| 4 |
+
"calibration_samples": 1024,
|
| 5 |
+
"calibration_seed": 12345,
|
| 6 |
+
"calibration_data_sha256": "7209a27d90b46aa0d2155664633d5ea3e1415de480fa58bb08c464584534e9a1",
|
| 7 |
+
"calibration_method": "entropy",
|
| 8 |
+
"quantizer": "onnxruntime",
|
| 9 |
+
"high_precision_dtype": "fp32",
|
| 10 |
+
"op_types_to_quantize": null,
|
| 11 |
+
"nodes_to_exclude": [],
|
| 12 |
+
"nodes_to_quantize": [
|
| 13 |
+
"/model/blocks/blocks.0/pre/pre.1/Conv",
|
| 14 |
+
"/model/blocks/blocks.0/project/project.0/Conv",
|
| 15 |
+
"/model/blocks/blocks.0/branch_mixer/branch_mixer.0/Conv",
|
| 16 |
+
"/model/blocks/blocks.1/pre/pre.1/Conv",
|
| 17 |
+
"/model/blocks/blocks.1/project/project.0/Conv",
|
| 18 |
+
"/model/blocks/blocks.1/branch_mixer/branch_mixer.0/Conv",
|
| 19 |
+
"/model/blocks/blocks.2/pre/pre.1/Conv",
|
| 20 |
+
"/model/blocks/blocks.2/project/project.0/Conv",
|
| 21 |
+
"/model/blocks/blocks.2/branch_mixer/branch_mixer.0/Conv"
|
| 22 |
+
],
|
| 23 |
+
"conv_output_quantized": false,
|
| 24 |
+
"modelopt_version": null,
|
| 25 |
+
"source_onnx_sha256": "b11269b2831a1f8104dc3b65fff17e32e62e71a64eee9b240f7a8ea50a56f141",
|
| 26 |
+
"int8_onnx_sha256": "33d40396b16d63fd893e37b332e75790af140bc44f6d7a427aa64ca76e90d9f7"
|
| 27 |
+
}
|
v2/quantized/mixed-int8/Z.qdq.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4f1e12cce74e0dfc9f61832d9e831beec0aeaca5da07bb11268bf243700b1957
|
| 3 |
+
size 3041579
|
v2/quantized/mixed-int8/Z.quantize.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"status": "PASS",
|
| 3 |
+
"basis": "Z",
|
| 4 |
+
"calibration_samples": 1024,
|
| 5 |
+
"calibration_seed": 12345,
|
| 6 |
+
"calibration_data_sha256": "3784d383d5bd14326553b8dd11ee968a965d42ad217509b013cd1b5c051b53d7",
|
| 7 |
+
"calibration_method": "entropy",
|
| 8 |
+
"quantizer": "onnxruntime",
|
| 9 |
+
"high_precision_dtype": "fp32",
|
| 10 |
+
"op_types_to_quantize": null,
|
| 11 |
+
"nodes_to_exclude": [],
|
| 12 |
+
"nodes_to_quantize": [
|
| 13 |
+
"/model/blocks/blocks.0/pre/pre.1/Conv",
|
| 14 |
+
"/model/blocks/blocks.0/project/project.0/Conv",
|
| 15 |
+
"/model/blocks/blocks.0/branch_mixer/branch_mixer.0/Conv",
|
| 16 |
+
"/model/blocks/blocks.1/pre/pre.1/Conv",
|
| 17 |
+
"/model/blocks/blocks.1/project/project.0/Conv",
|
| 18 |
+
"/model/blocks/blocks.1/branch_mixer/branch_mixer.0/Conv",
|
| 19 |
+
"/model/blocks/blocks.2/pre/pre.1/Conv",
|
| 20 |
+
"/model/blocks/blocks.2/project/project.0/Conv",
|
| 21 |
+
"/model/blocks/blocks.2/branch_mixer/branch_mixer.0/Conv"
|
| 22 |
+
],
|
| 23 |
+
"conv_output_quantized": false,
|
| 24 |
+
"modelopt_version": null,
|
| 25 |
+
"source_onnx_sha256": "087a0c03d0b50cb55fd6e8b5949cae712bf0a5fa24d6629ac9d4f87a28b1ee56",
|
| 26 |
+
"int8_onnx_sha256": "4f1e12cce74e0dfc9f61832d9e831beec0aeaca5da07bb11268bf243700b1957"
|
| 27 |
+
}
|
v2/quantized/requirements.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Install a PyTorch CUDA wheel matching your GPU/driver first (recorded: 2.5.1+cu121).
|
| 2 |
+
numpy==1.26.4
|
| 3 |
+
torch==2.5.1
|
| 4 |
+
pymatching==2.4.0
|
| 5 |
+
stim==1.16.0
|
| 6 |
+
safetensors==0.5.3
|
| 7 |
+
onnx==1.17.0
|
| 8 |
+
tensorrt-cu12==10.9.0.34
|
v2/quantized/runtime/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
+
"""Standalone QAdapt quantized deployment runtime."""
|
v2/quantized/runtime/build_engine.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 3 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 4 |
+
"""Rebuild an engine with the recorded precision policy on the target GPU."""
|
| 5 |
+
import argparse
|
| 6 |
+
import hashlib
|
| 7 |
+
import json
|
| 8 |
+
import re
|
| 9 |
+
import shutil
|
| 10 |
+
import subprocess
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def compute_precision_counts(payload):
|
| 15 |
+
counts = {}
|
| 16 |
+
for layer in payload['Layers']:
|
| 17 |
+
kind = str(layer.get('ParameterType', layer.get('LayerType', ''))).lower()
|
| 18 |
+
if not any(token in kind for token in ('convolution', 'gemm', 'matrixmultiply')):
|
| 19 |
+
continue
|
| 20 |
+
tactic = str(layer.get('TacticName', '')).lower()
|
| 21 |
+
weight = str(layer.get('Weights', {}).get('Type', '')).lower()
|
| 22 |
+
formats = ' '.join(str(value.get('Format/Datatype', '')) for value in layer.get('Inputs', []))
|
| 23 |
+
if weight == 'int8' or re.search(r'(?:^|_)(?:i8|s8)', tactic) or re.search(r'\bint8\b', formats, re.I):
|
| 24 |
+
precision = 'int8'
|
| 25 |
+
elif weight == 'half' or 'f16' in tactic or re.search(r'\bhalf\b', formats, re.I):
|
| 26 |
+
precision = 'fp16'
|
| 27 |
+
elif 'tf32' in tactic:
|
| 28 |
+
precision = 'tf32'
|
| 29 |
+
else:
|
| 30 |
+
precision = 'fp32'
|
| 31 |
+
counts[precision] = counts.get(precision, 0) + 1
|
| 32 |
+
return counts
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def build_command(args, source, temporary, layers):
|
| 36 |
+
return [args.trtexec, f'--onnx={source}', f'--saveEngine={temporary}',
|
| 37 |
+
'--minShapes=dets:1x720', '--optShapes=dets:1x720', '--maxShapes=dets:1x720',
|
| 38 |
+
'--fp16', '--noTF32', '--layerPrecisions=/model/*:fp16', '--precisionConstraints=prefer',
|
| 39 |
+
'--profilingVerbosity=detailed', f'--exportLayerInfo={layers}', '--skipInference']
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def main():
|
| 43 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 44 |
+
parser.add_argument('--bundle', type=Path, default=Path(__file__).resolve().parents[1])
|
| 45 |
+
parser.add_argument('--basis', choices=('X', 'Z'), required=True)
|
| 46 |
+
parser.add_argument('--precision', choices=('fp16', 'mixed-int8'), required=True)
|
| 47 |
+
parser.add_argument('--output', type=Path, required=True)
|
| 48 |
+
parser.add_argument('--trtexec', default=shutil.which('trtexec') or '/opt/tensorrt/bin/trtexec')
|
| 49 |
+
args = parser.parse_args()
|
| 50 |
+
source = args.bundle / (f'fp16/build_source_fp32/{args.basis}.onnx' if args.precision == 'fp16' else f'mixed-int8/{args.basis}.qdq.onnx')
|
| 51 |
+
manifest = json.loads((args.bundle / 'manifest.json').read_text(encoding='utf-8'))
|
| 52 |
+
expected = manifest['files'][source.relative_to(args.bundle).as_posix()]['sha256']
|
| 53 |
+
source_hash = hashlib.sha256(source.read_bytes()).hexdigest()
|
| 54 |
+
if source_hash != expected:
|
| 55 |
+
raise ValueError('Source ONNX checksum mismatch')
|
| 56 |
+
layers = args.output.with_suffix('.layers.json')
|
| 57 |
+
log = args.output.with_suffix('.build.log')
|
| 58 |
+
report = args.output.with_suffix('.build.json')
|
| 59 |
+
temporary = args.output.with_suffix('.engine.tmp')
|
| 60 |
+
if any(path.exists() for path in (args.output, layers, log, report, temporary)):
|
| 61 |
+
raise FileExistsError('Use a new output path; existing build artifacts are preserved')
|
| 62 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 63 |
+
command = build_command(args, source, temporary, layers)
|
| 64 |
+
completed = subprocess.run(command, capture_output=True, text=True)
|
| 65 |
+
log.write_text(completed.stdout + completed.stderr, encoding='utf-8')
|
| 66 |
+
if completed.returncode or not temporary.is_file() or not layers.is_file():
|
| 67 |
+
raise RuntimeError(f'Engine build failed; see {log}')
|
| 68 |
+
counts = compute_precision_counts(json.loads(layers.read_text(encoding='utf-8')))
|
| 69 |
+
if args.precision == 'mixed-int8' and not counts.get('int8'):
|
| 70 |
+
raise RuntimeError('Build contains no INT8 convolution/GEMM evidence')
|
| 71 |
+
if args.precision == 'fp16' and not counts.get('fp16'):
|
| 72 |
+
raise RuntimeError('Build contains no FP16 convolution/GEMM evidence')
|
| 73 |
+
temporary.replace(args.output)
|
| 74 |
+
payload = {'precision': args.precision, 'basis': args.basis, 'source_onnx_sha256': source_hash,
|
| 75 |
+
'engine_sha256': hashlib.sha256(args.output.read_bytes()).hexdigest(),
|
| 76 |
+
'command': command, 'compute_precision_counts': counts,
|
| 77 |
+
'acceptance': 'Build only; validate target-device accuracy and end-to-end latency separately'}
|
| 78 |
+
report.write_text(json.dumps(payload, indent=2) + '\n', encoding='utf-8')
|
| 79 |
+
print(json.dumps(payload, indent=2))
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
if __name__ == '__main__':
|
| 83 |
+
main()
|
v2/quantized/runtime/decoder.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
+
"""Standalone TensorRT predecoder + PyMatching, without a research-repo import."""
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import hashlib
|
| 7 |
+
import json
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
import pymatching
|
| 12 |
+
import stim
|
| 13 |
+
import tensorrt as trt
|
| 14 |
+
import torch
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def verify_file(bundle: Path, path: Path) -> None:
|
| 18 |
+
manifest = json.loads((bundle / 'manifest.json').read_text(encoding='utf-8'))
|
| 19 |
+
relative = path.resolve().relative_to(bundle.resolve()).as_posix()
|
| 20 |
+
expected = manifest['files'][relative]['sha256']
|
| 21 |
+
if hashlib.sha256(path.read_bytes()).hexdigest() != expected:
|
| 22 |
+
raise ValueError(f'Artifact checksum mismatch: {relative}')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class QuantizedDecoder:
|
| 26 |
+
"""Serial batch-one engine execution; use a separate instance per thread.
|
| 27 |
+
|
| 28 |
+
Detector arrays are uint8[N,720]. ``decode`` returns final logical bits;
|
| 29 |
+
``predecode`` returns uint8[N,721] logical-frame/residual-detector records.
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
def __init__(self, bundle=None, *, basis='X', precision='fp16', device='cuda:0',
|
| 33 |
+
engine_path=None, cuda_graph=True):
|
| 34 |
+
self.bundle = Path(bundle) if bundle is not None else Path(__file__).resolve().parents[1]
|
| 35 |
+
if basis not in ('X', 'Z') or precision not in ('fp16', 'mixed-int8'):
|
| 36 |
+
raise ValueError('basis must be X/Z and precision must be fp16/mixed-int8')
|
| 37 |
+
self.device = torch.device(device)
|
| 38 |
+
if self.device.type != 'cuda' or not torch.cuda.is_available():
|
| 39 |
+
raise RuntimeError('This TensorRT runtime requires an NVIDIA CUDA GPU')
|
| 40 |
+
self.engine_path = Path(engine_path) if engine_path is not None else self.bundle / f'engines/a100-trt10.9/{precision}/{basis}.engine'
|
| 41 |
+
dem_path = self.bundle / f'matching/{basis}.dem'
|
| 42 |
+
verify_file(self.bundle, dem_path)
|
| 43 |
+
if engine_path is None:
|
| 44 |
+
verify_file(self.bundle, self.engine_path)
|
| 45 |
+
if not self.engine_path.is_file():
|
| 46 |
+
raise FileNotFoundError(self.engine_path)
|
| 47 |
+
self.matcher = pymatching.Matching.from_detector_error_model(stim.DetectorErrorModel.from_file(str(dem_path)))
|
| 48 |
+
if self.matcher.num_detectors != 720:
|
| 49 |
+
raise ValueError('The detector error model must have 720 detectors')
|
| 50 |
+
self._logger = trt.Logger(trt.Logger.WARNING)
|
| 51 |
+
self._runtime = trt.Runtime(self._logger)
|
| 52 |
+
with torch.cuda.device(self.device):
|
| 53 |
+
self._engine = self._runtime.deserialize_cuda_engine(self.engine_path.read_bytes())
|
| 54 |
+
if self._engine is None:
|
| 55 |
+
raise RuntimeError('Engine deserialization failed; rebuild for the current GPU/TensorRT runtime')
|
| 56 |
+
self._context = self._engine.create_execution_context()
|
| 57 |
+
if self._context is None:
|
| 58 |
+
raise RuntimeError('Could not create a TensorRT execution context')
|
| 59 |
+
names = {self._engine.get_tensor_name(index) for index in range(self._engine.num_io_tensors)}
|
| 60 |
+
if names != {'dets', 'L_and_residual_dets'}:
|
| 61 |
+
raise ValueError(f'Unexpected engine I/O: {sorted(names)}')
|
| 62 |
+
if any(self._engine.get_tensor_dtype(name) != trt.uint8 for name in names):
|
| 63 |
+
raise ValueError('Engine input and output must both be uint8')
|
| 64 |
+
if not self._context.set_input_shape('dets', (1, 720)):
|
| 65 |
+
raise ValueError('Engine does not accept uint8[1,720]')
|
| 66 |
+
if tuple(self._context.get_tensor_shape('L_and_residual_dets')) != (1, 721):
|
| 67 |
+
raise ValueError('Engine output must be uint8[1,721]')
|
| 68 |
+
self._host_input = torch.zeros((1, 720), dtype=torch.uint8, pin_memory=True)
|
| 69 |
+
self._host_output = torch.empty((1, 721), dtype=torch.uint8, pin_memory=True)
|
| 70 |
+
self._gpu_input = self._host_input.to(self.device)
|
| 71 |
+
self._gpu_output = torch.empty((1, 721), dtype=torch.uint8, device=self.device)
|
| 72 |
+
self._context.set_tensor_address('dets', self._gpu_input.data_ptr())
|
| 73 |
+
self._context.set_tensor_address('L_and_residual_dets', self._gpu_output.data_ptr())
|
| 74 |
+
self._stream = torch.cuda.Stream(device=self.device)
|
| 75 |
+
self._stream.wait_stream(torch.cuda.current_stream(self.device))
|
| 76 |
+
self._graph = None
|
| 77 |
+
with torch.cuda.stream(self._stream):
|
| 78 |
+
for _ in range(20):
|
| 79 |
+
self._execute()
|
| 80 |
+
self._stream.synchronize()
|
| 81 |
+
if cuda_graph:
|
| 82 |
+
self._graph = torch.cuda.CUDAGraph()
|
| 83 |
+
with torch.cuda.graph(self._graph, stream=self._stream):
|
| 84 |
+
self._execute()
|
| 85 |
+
self._stream.synchronize()
|
| 86 |
+
|
| 87 |
+
def _execute(self):
|
| 88 |
+
if not self._context.execute_async_v3(stream_handle=self._stream.cuda_stream):
|
| 89 |
+
raise RuntimeError('TensorRT inference returned false')
|
| 90 |
+
|
| 91 |
+
@torch.inference_mode()
|
| 92 |
+
def predecode(self, detectors):
|
| 93 |
+
rows = np.asarray(detectors)
|
| 94 |
+
if rows.ndim == 1:
|
| 95 |
+
rows = rows.reshape(1, -1)
|
| 96 |
+
if rows.dtype != np.uint8 or rows.ndim != 2 or rows.shape[1] != 720:
|
| 97 |
+
raise ValueError('Expected uint8[N,720] detector bits')
|
| 98 |
+
if not len(rows) or bool(np.any(rows > 1)):
|
| 99 |
+
raise ValueError('Provide at least one detector record, with values 0 or 1')
|
| 100 |
+
outputs = np.empty((len(rows), 721), dtype=np.uint8)
|
| 101 |
+
for index, row in enumerate(rows):
|
| 102 |
+
self._host_input.copy_(torch.from_numpy(np.ascontiguousarray(row).reshape(1, 720)))
|
| 103 |
+
with torch.cuda.stream(self._stream):
|
| 104 |
+
self._gpu_input.copy_(self._host_input, non_blocking=True)
|
| 105 |
+
if self._graph is None:
|
| 106 |
+
self._execute()
|
| 107 |
+
else:
|
| 108 |
+
self._graph.replay()
|
| 109 |
+
self._host_output.copy_(self._gpu_output, non_blocking=True)
|
| 110 |
+
self._stream.synchronize()
|
| 111 |
+
outputs[index] = self._host_output.numpy()[0]
|
| 112 |
+
return outputs
|
| 113 |
+
|
| 114 |
+
def decode(self, detectors):
|
| 115 |
+
records = self.predecode(detectors)
|
| 116 |
+
matching = np.asarray(self.matcher.decode_batch(np.ascontiguousarray(records[:, 1:])), dtype=np.uint8).reshape(-1)
|
| 117 |
+
return np.bitwise_xor(records[:, 0], matching)
|