Add GARI support to decoder CLIs - #277
Conversation
LalehB
left a comment
There was a problem hiding this comment.
can you also make sure that you update the README with examples as well please?
|
The CI failure appears unrelated to the GARI changes. It seems to come from Bazel reusing cached binaries built on a different CPU. A possible fix is to disable only the Bazel disk cache: This keeps the other caches enabled while ensuring native binaries are rebuilt on each runner. |
@arshpreetmaan Can you provide more info about the "different CPU" part? Since the GitHub workflows always run on the same type of runner, one would expect the CPU to be the same. Do you suspect a difference in the CPU feature sets? |
|
One thing I do see, though, is that the disk-cache should be further parametrized by the matrix OS. I'll do a quick PR. |
Thanks, PR #295 might fix the issue. By “different CPU,” I meant that separate GitHub-hosted ubuntu-latest VMs may expose different CPU instruction features, even though they are all Linux x64 runners. Since the build uses -march=native, cached binaries can depend on those exact features. |
The Bazel disk cache should probably be scoped by the `matrix.os` value and the Python version in matrix jobs. This observation was spurred by #277 (comment), although it is not yet clear whether narrowing the scope will in fact fix the failure in that PR.
|
Hi @arshpreetmaan @LalehB , WDYT about this alternative API: |
Summary
This PR adds C++ CLI support for consuming the GARI matrix and layout files produced by the Python utilities in #273.
--gari-layoutsupport to Tesseract and Simplex.Simplex applies the source-to-GARI detector mapping but does not otherwise interpret detector ordering.
Example
Generate a GARI matrix and layout from a circuit:
python src/py/_tesseract_py_util/gari.py \ --circuit circuit_file.stim \ --prior xor \ --out-dir gari_outputThis produces:
Tesseract can sample from the original circuit and decode using the GARI matrix:
We recommend using a smaller beam size (5 or 10 than usual longbeam 20) which provides a useful runtime/accuracy tradeoff while decoding with GARI dem as GARI reduces the row (check) weight by roughly 10 times for the tested BB codes and color codes circuits.
Detector-order options are omitted above, so Tesseract processes the GARI rows in their stored physical-then-virtual order. If explicit detector ordering is requested, Tesseract constructs the order from the source circuit, maps only the physical detector portion, and keeps the virtual detector portion in its natural order.
The same files can be used with Simplex:
./bazel-bin/src/simplex \ --circuit circuit_file.stim \ --dem gari_output/circuit_file_gari_xor.dem \ --gari-layout gari_output/circuit_file_gari_xor_layout.json \ --sample-num-shots 100 \ --sample-seed 1234 \ --threads 1 \ --stats-out simplex_gari_stats.jsonNote: The GARI DEM is a decoding representation and is never sampled. Detection-event data must either be sampled from the original source circuit or loaded from a file containing detector events in the original source-circuit detector order. The companion layout maps those source detector events into the physical GARI rows; virtual GARI rows are initialized to zero. When decoding source-circuit detection-event files against a GARI DEM,
--gari-layoutmust be supplied. Without the layout, the CLI interprets the records in the loaded DEM's detector space and cannot infer the source-to-GARI permutation. The .dem and _layout.json files must be the pair generated from the same source circuit.