Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
d8ae687
add better error message
Jun 18, 2026
426ebf0
add support for REPROPAGATE and --keep-noise
Jun 18, 2026
89aaab0
Merge remote-tracking branch 'origin/main' into feature-issue-79-como…
Jun 18, 2026
3d09909
add tutorial check
Jun 18, 2026
afa25af
add tutorial chapter
Jun 19, 2026
20bfddf
add support for conditional
Jun 19, 2026
ba49686
fill test gap
Jun 19, 2026
f526417
update teleportation part
Jun 26, 2026
afcc1c4
Merge origin/main into feature-83
Jun 26, 2026
457eb9a
update test deq files
Jul 2, 2026
ee1268f
add jit test
Jul 2, 2026
552f699
update old tutorial chapters to be consistent
Jul 6, 2026
2272f80
split conditional correction chapter into two
Jul 6, 2026
b6d13d1
add figures
Jul 6, 2026
863aae0
update language
Jul 7, 2026
b1e22b7
fix language
Jul 7, 2026
12adcf7
update test files
Jul 8, 2026
6dedd72
update
Jul 8, 2026
c9cdc59
update language
Jul 8, 2026
3857d09
update tutorial chapters
Jul 8, 2026
d915a55
check in lattice surgery chapter
Jul 9, 2026
2a6b41a
update test reference files
Jul 9, 2026
e186a17
update tutorial chapters
Jul 9, 2026
79d03be
add readout propagation chapter
Jul 9, 2026
3a13502
add generator script
Jul 9, 2026
545f604
add changes
Jul 10, 2026
6fa15c8
update proto binding
Jul 10, 2026
748e8ef
fix pipeline failure (#96)
yuewuo Jun 29, 2026
5a749ec
Cap grpcio-tools below 1.82 to fix protobuf gencode/runtime drift (#103)
Copilot Jul 6, 2026
52513c6
pauliverse/paulimer: expose FramePropagator to Python, add reset_qubi…
jmbr Jul 7, 2026
fdbaf04
Basic Loss Support (#99)
yuewuo Jul 9, 2026
ba170fd
Fix clippy lints introduced by Rust 1.97 stable (#109)
jmbr Jul 10, 2026
16306d3
fix tutorial build error
Jul 10, 2026
863e1e9
fix test case
Jul 10, 2026
8e5a2c5
Add Emacs major mode for .deq files (#107)
jmbr Jul 10, 2026
96b03ad
Merge branch 'main' into feature-83
Jul 11, 2026
0fa140b
remove unnecessary step in annotate
Jul 11, 2026
60b45a2
remove unnecessary function
Jul 11, 2026
a970af9
improve spec coverage to 100%
Jul 11, 2026
0cbb1a9
revert renaming
Jul 11, 2026
d7f2cd5
simplifiy doc
Jul 11, 2026
529fde9
simplify unnecessary if
Jul 12, 2026
c235c49
simplify function
Jul 12, 2026
32731fd
add comment
Jul 12, 2026
8699bbc
remove unnecessary doc
Jul 12, 2026
4909c03
fix minor issues
Jul 12, 2026
dc36dc4
clean up chapter
Jul 12, 2026
c9d183e
update tutorial chapter
Jul 13, 2026
7710b7b
fix repetition code implementation
Jul 13, 2026
c2d5810
find joint logical observable automatically
Jul 13, 2026
856de92
optimize code
Jul 13, 2026
f0d5d0a
minor fixes
Jul 13, 2026
dd7e863
fix repetition code n,k,d
Jul 13, 2026
37491d2
fix minor tutorial errors
Jul 13, 2026
03894d4
simplify tutorial generator with common run_cli
Jul 13, 2026
b07adb1
remove unnecessary PROPAGATE specification in trivial gadget
Jul 13, 2026
97ab3cf
simplify test file
Jul 14, 2026
4c887ee
simplify jit test
Jul 14, 2026
05a7c19
simplify jit test
Jul 14, 2026
8d8e60d
simplify jit test
Jul 14, 2026
7668303
Merge remote-tracking branch 'origin/main' into feature-83
Jul 14, 2026
68629e0
add MZZZ gadget
Jul 14, 2026
7fe21eb
Merge remote-tracking branch 'origin/main' into feature-90-pauli-enve…
Jul 14, 2026
02c2df5
add language level loss support
Jul 18, 2026
ad66cf4
update protobuf
Jul 21, 2026
3013199
Merge remote-tracking branch 'origin/main' into feature-90-pauli-enve…
Jul 24, 2026
6ae11ed
Merge remote-tracking branch 'origin/main' into feature-90-pauli-enve…
Jul 28, 2026
964deb2
update decoder interface
Jul 29, 2026
52358ed
update protobuf
Jul 29, 2026
a95ed34
update blackbox decoder proto
Aug 3, 2026
bb3b1fe
add language support
Aug 5, 2026
12f4b37
add fault propagation common tool
Aug 10, 2026
b5fe83a
clean jit noise builder
Aug 10, 2026
da33efc
clean jit library builder
Aug 10, 2026
cadba6c
clean up compose builder
Aug 10, 2026
b63df2c
reduce rename
Aug 10, 2026
e253f6f
allow dynamic reweighting in tesseract
Aug 10, 2026
fd82f38
minor update to tutorial chapters
Aug 10, 2026
3cf6ca8
preserve order when interleaving ERROR and X_ERROR
Aug 10, 2026
bdb58f8
update jit annotate to consider loss
Aug 10, 2026
32c765e
add test cases
Aug 10, 2026
dbb5ddf
runtime updates
Aug 10, 2026
470fece
check in small test updates
Aug 10, 2026
88d517b
update tutorial chapters
Aug 11, 2026
899a0a8
support DECODE_ONLY and SIMULATE_ONLY in annotate tool
Aug 11, 2026
1c07b11
minor changes
Aug 11, 2026
82b16c5
code review
Aug 11, 2026
951fb35
increase test coverage
Aug 11, 2026
849879f
update test cases
Aug 11, 2026
c6d1036
add more tests
Aug 14, 2026
326e235
add tests
Aug 14, 2026
195db66
add more test cases
Aug 15, 2026
740668f
relex window coordinator test timing
Aug 15, 2026
c94667b
better assertion on async counter
Aug 15, 2026
d187da5
add more tests
Aug 15, 2026
345e877
let naive decoder support all features for testing
Aug 15, 2026
ce5d384
add loss model API
Aug 15, 2026
c9ee180
simplify feature passing
Aug 15, 2026
f342f64
basic files
Aug 15, 2026
74a831e
update decoders
Aug 15, 2026
b9e31ec
add decoder.rs and changelog
Aug 15, 2026
2ab8b85
add more loss models
Aug 15, 2026
5df6921
integrate loss model parameter into CLI tools
Aug 16, 2026
25ff4bc
update protobuf
Aug 16, 2026
65a5f3b
update protobuf and tests
Aug 16, 2026
cdc704f
remove decoder gRPC interface
Aug 16, 2026
23d8adc
remove need for model_reconfigured
Aug 16, 2026
42a74d5
support user provided loss model .py and json config
Aug 16, 2026
4ce459f
update model
Aug 16, 2026
513fc4e
fix CX,CY policy handling
Aug 16, 2026
afee8cc
rename
Aug 16, 2026
9b70dbb
change loss pauli to generator
Aug 16, 2026
0fcaced
add loss graph definition
Aug 16, 2026
fd90b54
add loss analysis tool
Aug 16, 2026
9e97da9
update tutorial chapter
Aug 16, 2026
5884f9b
add loss transpiler
Aug 16, 2026
fbe7f43
bump minor version because we are adding a significant feature with s…
Aug 16, 2026
914cdff
gather stim conversion into a single place
Aug 16, 2026
8f1111a
add loss syntax
Aug 16, 2026
4f4d5d9
merge loss model
Aug 16, 2026
fe713e4
add tests
Aug 16, 2026
11f6529
add loss analysis test
Aug 17, 2026
5976138
rename to native_gates
Aug 17, 2026
85bcf39
add loss transpiler test
Aug 17, 2026
bee3339
simplify loss model API
Aug 17, 2026
ddc53a2
default to none loss model when interpret
Aug 17, 2026
f4284ab
add loss compiler
Aug 17, 2026
a43f0bd
remove reweight strategy from loss compiler
Aug 17, 2026
237129e
add util functions
Aug 17, 2026
f15e610
add heralds to loss decoder interface
Aug 17, 2026
850b9c2
update blackbox decoder util
Aug 17, 2026
b82c321
add function to loss compiler
Aug 17, 2026
4a085eb
update coordinator
Aug 17, 2026
d14a921
add monolithic coordinator
Aug 17, 2026
7f5bde9
check in window coordinator with loss support
Aug 18, 2026
9badfa2
extract decoder features from thread pooling
Aug 18, 2026
2db7122
check in thread pooling
Aug 18, 2026
ab45e0a
simplify hypergraph pass by allowing isolated vertices
Aug 18, 2026
f30b676
update API
Aug 18, 2026
40e3bd3
add thread pooling tests
Aug 18, 2026
05afb34
add reweight handler
Aug 18, 2026
6130a2c
simplify type conversion of indices
Aug 18, 2026
aa337e6
move validation to misc
Aug 18, 2026
4933fc3
add reweight handler test
Aug 18, 2026
82eab4b
reweight always respect latest probabilities
Aug 18, 2026
d4c3c2b
revise reweight handler
Aug 18, 2026
f4e299f
add loss handler
Aug 18, 2026
5a2c920
add parameters to simulate
Aug 18, 2026
696127b
add loss handler tests
Aug 19, 2026
722c007
update visualizer package
Aug 19, 2026
ca769d8
add mle loss decoder
Aug 19, 2026
64b7bb4
Merge branch 'main' into feature-90-pauli-envelop-loss
yuewuo Aug 19, 2026
4713dc8
minor updates to tutorial chapters
Aug 19, 2026
0869928
update loss model test
Aug 19, 2026
60a6637
update syntax highlight tutorial chapter
Aug 19, 2026
28151b7
fix linux build error
Aug 19, 2026
9dd3810
fix test error
Aug 19, 2026
3d5bd53
install missing dependency
Aug 19, 2026
b64c058
add scipy to ado pipeline install
Aug 19, 2026
0ca0d4c
bump deqagram version
Aug 19, 2026
f1b3dac
bump dependency version
Aug 19, 2026
048f481
update deqagram python version as well
Aug 19, 2026
886107a
fix qubit id assignment
Aug 19, 2026
387fb68
fix corner case of window loss decoding
Aug 19, 2026
3898c54
bump deq runtime version
Aug 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ado/stages/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ stages:
# agents ship a much newer glibc (Ubuntu 22.04 = 2.35, Azure
# Linux 3 = 2.38) and a native link would raise the wheel's
# glibc floor above the tag we claim.
pip install "maturin[zig]" pytest hypothesis more-itertools numpy
pip install "maturin[zig]" pytest hypothesis more-itertools numpy scipy
maturin_args+=(--zig --target "$(uname -m)-unknown-linux-gnu" --compatibility $(manylinuxTag))
;;
Darwin)
pip install maturin pytest hypothesis more-itertools numpy
pip install maturin pytest hypothesis more-itertools numpy scipy
;;
*)
echo "Unsupported Unix platform: $(uname -s)" >&2
Expand Down Expand Up @@ -161,7 +161,7 @@ stages:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install --upgrade pip
pip install maturin pytest hypothesis more-itertools numpy
pip install maturin pytest hypothesis more-itertools numpy scipy

$wheelhouse = Join-Path $PWD 'target\wheels'
function Build-AndTest([string]$cratePath, [string[]]$pytestArgs = @()) {
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,28 @@ jobs:
with:
python-version: "3.11"
cache: 'pip'

- name: Configure Python embedding linker (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
python_libdir="$(python -c 'import sysconfig; print(sysconfig.get_config_var("LIBDIR"))')"
python_soname="$(python -c 'import sysconfig; print(sysconfig.get_config_var("INSTSONAME") or sysconfig.get_config_var("LDLIBRARY"))')"
python_link_name="$(python -c 'import sys; print(f"libpython{sys.version_info.major}.{sys.version_info.minor}.so")')"
test -f "$python_libdir/$python_soname"
python_link_dir="$RUNNER_TEMP/python-lib"
mkdir -p "$python_link_dir"
ln -sf "$python_libdir/$python_soname" "$python_link_dir/$python_link_name"
echo "LIBRARY_PATH=$python_link_dir${LIBRARY_PATH:+:$LIBRARY_PATH}" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$python_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV"

- name: Create Python virtual environment and install dependencies (Linux/Mac)
if: runner.os != 'Windows'
run: |
python -m venv qdk_env
source qdk_env/bin/activate
python -m pip install --upgrade pip
pip install maturin pytest pytest-asyncio hypothesis more-itertools numpy
pip install maturin pytest pytest-asyncio hypothesis more-itertools numpy scipy

- name: Create Python virtual environment and install dependencies (Windows)
if: runner.os == 'Windows'
Expand All @@ -90,7 +104,7 @@ jobs:
python -m venv qdk_env
call qdk_env\Scripts\activate.bat
python -m pip install --upgrade pip
pip install maturin pytest pytest-asyncio hypothesis more-itertools numpy
pip install maturin pytest pytest-asyncio hypothesis more-itertools numpy scipy

- name: Build binar Python bindings (Linux/Mac)
if: runner.os != 'Windows'
Expand Down
15 changes: 15 additions & 0 deletions deq/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed
- `deq annotate` now always retains physical noise under `@SIMULATE_ONLY` while
emitting canonical `ERROR` and `LOSS` metadata for decoding. Noisy
measurements receive clean `@DECODE_ONLY` counterparts.
- Black-box decoders now expose capabilities and receive one unified decode
request. Per-shot edge reweights and structured loss may be supplied together;
unsupported fields fail explicitly instead of triggering a decoder-side
fallback.
- Monolithic and window coordinators now apply `Outcomes.modifiers` as
shot-scoped probability overrides. The `decoder_reweighting` policy controls
whether overrides use loaded decoder support or an equivalent one-shot graph.
- Preselection consumers now recognize QDK 1.31's `SELECT { ... REQUIRE ... }`
syntax. Legacy `PREPARE { ... }` input remains accepted for older generated
Stim files.

## [0.4.2] - 2026-08-03

### Removed
- **Breaking:** remove the `deq annotate --keep-noise` option; its behavior is
now the unconditional default.
- **Breaking:** bare physical Pauli targets in `ERROR(p)` statements (e.g.
`ERROR(0.05) C0 X0`) are no longer valid syntax (previously already rejected by the transpiler).

Expand Down
22 changes: 22 additions & 0 deletions deq/deq/circuit/deqagram_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,28 @@ def _gadget_statement_impl(
expected_value=preselect.expected_value,
decorators=decorators,
)
case deqagram.AttachedGadget.Statement(deqagram.GadgetStatement.Loss(loss)):
if loss.input_port is not None:
if loss.source_errors:
raise SyntaxError(
"input LOSS(IN<i>.L<j>) must not carry source-error (SE) "
"targets"
)
elif loss.probability is None or not 0.0 < loss.probability <= 1.0:
raise SyntaxError(
f"LOSS probability must be in (0, 1], got {loss.probability}"
)
return model.LossStatement(
probability=loss.probability,
input_port=loss.input_port,
input_qubit=loss.input_qubit,
source_errors=list(loss.source_errors),
continuation_errors=list(loss.continuation_errors),
child_losses=list(loss.child_losses),
output_qubits=[(port, qubit) for port, qubit in loss.output_qubits],
measurement_indices=list(loss.measurement_indices),
decorators=decorators,
)
case _:
raise TypeError(f"unexpected gadget statement: {decorated.statement!r}")

Expand Down
47 changes: 47 additions & 0 deletions deq/deq/circuit/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,52 @@ class ErrorStatement:
decorators: list[Decorator] = field(default_factory=list)


@dataclass
class LossStatement:
"""A ``LOSS(...)`` declaration mirroring one JIT loss-model entry.

A *source* loss carries the declared ``LOSS_ERROR`` probability. An
*input* loss (``input_port``/``input_qubit`` set) is the continuation of
a loss entering on that input physical qubit; it carries no probability
and no source-error generators, and its position is identified by the
``IN<i>.L<j>`` head rather than by list order.

``source_errors`` / ``continuation_errors`` index the
gadget's ``ERROR`` mechanisms; ``child_losses`` index the source
losses (within-gadget children); ``output_qubits`` are ``(port, qubit)``
physical exits; ``measurement_indices`` are herald measurements. These
collections are set-valued, so explicit duplicate references are rejected.
"""

probability: float | None = None
input_port: int | None = None
input_qubit: int | None = None
source_errors: list[int] = field(default_factory=list)
continuation_errors: list[int] = field(default_factory=list)
child_losses: list[int] = field(default_factory=list)
output_qubits: list[tuple[int, int]] = field(default_factory=list)
measurement_indices: list[int] = field(default_factory=list)
decorators: list[Decorator] = field(default_factory=list)

@property
def is_input(self) -> bool:
"""Whether this is an input-continuation loss (vs a source loss)."""
return self.input_port is not None

def __str__(self) -> str:
if self.is_input:
head = f"LOSS(IN{self.input_port}.L{self.input_qubit})"
else:
head = f"LOSS({self.probability})"
parts = [head]
parts += [f"SE{i}" for i in self.source_errors]
parts += [f"CE{i}" for i in self.continuation_errors]
parts += [f"L{i}" for i in self.child_losses]
parts += [f"OUT{port}.L{qubit}" for port, qubit in self.output_qubits]
parts += [f"M{i}" for i in self.measurement_indices]
return " ".join(parts)


@dataclass
class ConditionalStatement:
"""A ``CONDITIONAL R<j> L<P><i>...`` or ``CONDITIONAL rec[-k] L<P><i>...`` declaration.
Expand Down Expand Up @@ -584,6 +630,7 @@ class PreselectStatement:
| ReadoutStatement
| CheckStatement
| ErrorStatement
| LossStatement
| ConditionalStatement
| VirtualLogicalStatement
| PropagateStatement
Expand Down
1 change: 1 addition & 0 deletions deq/deq/circuit/vscode-deq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Syntax highlighting for `.deq` quantum error correction files.
- `LOGICAL`, `STABILIZER` declarations with Pauli products
- `INPUT`, `OUTPUT`, `CHECK`, `READOUT` statements
- `ERROR(prob)` and `MEASURE(count)` statements
- `LOSS_ERROR(prob)` instructions and `LOSS(...)` loss-model statements with their `SE`/`CE`/`L`/`OUT.L`/`M` targets
- Distinct colors for check (`C0`), Pauli (`X0`/`Y0`/`Z0`), readout (`R0`), and logical Pauli shortcut (`LX0`/`LY0`/`LZ0`) targets
- `ASSERT_EQ` assertions
- Gadget applications with `IN(...)` / `OUT(...)` port bindings
Expand Down
59 changes: 59 additions & 0 deletions deq/deq/circuit/vscode-deq/syntaxes/deq.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@
{
"include": "#error-statement"
},
{
"include": "#loss-statement"
},
{
"include": "#conditional-statement"
},
Expand Down Expand Up @@ -568,6 +571,62 @@
}
]
},
"loss-statement": {
"begin": "\\b(LOSS)(?![A-Za-z0-9_])\\s*(\\()",
"beginCaptures": {
"1": {
"name": "keyword.directive.deq"
},
"2": {
"name": "punctuation.bracket.deq"
}
},
"end": "(?=#)|$",
"patterns": [
{
"include": "#mako-expression"
},
{
"match": "IN\\d+\\.L\\d+",
"name": "entity.name.tag.logical.deq"
},
{
"include": "#loss-targets"
},
{
"match": "-?\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?",
"name": "constant.numeric.deq"
},
{
"match": "\\)",
"name": "punctuation.bracket.deq"
}
]
},
"loss-targets": {
"patterns": [
{
"match": "SE\\d+",
"name": "support.class.loss.source.deq"
},
{
"match": "CE\\d+",
"name": "support.class.loss.continuation.deq"
},
{
"match": "OUT\\d+\\.L\\d+",
"name": "entity.name.tag.logical.deq"
},
{
"match": "L\\d+",
"name": "support.class.loss.child.deq"
},
{
"match": "M\\d+",
"name": "variable.other.deq"
}
]
},
"conditional-statement": {
"begin": "\\b(CONDITIONAL)\\b",
"beginCaptures": {
Expand Down
37 changes: 20 additions & 17 deletions deq/deq/cli/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from deq.cli.strip_tags import strip_jit_library
from deq.transpiler.jit_annotate import annotate as _annotate_impl
from deq.transpiler.jit_library_builder import build_jit_library
from deq.transpiler.loss import create_loss_model
from deq.circuit.mako_support import parse_mako_vars


Expand All @@ -23,18 +24,17 @@ def annotate(
mako: list[str] | None = None,
#: suppress the interactive Mako safety prompt
skip_mako_warning: bool = False,
#: physical loss model: "neutral-atom", "trapped-ion", "none", or a .py file
loss_model: str = "neutral-atom",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Literal['neutral-atom', 'trapped-ion', 'none'] as type instead of str. Consider an enum if it makes sense.

#: skip verification that annotated output transpiles identically
no_verify: bool = False,
#: keep noise instructions verbatim instead of commenting them
#: out and emitting expanded ERROR rows
keep_noise: bool = False,
) -> None:
"""
Rewrite a .deq file to mirror the structure of its compiled .deq.jit.

Inlines imports, replaces stabilizers/logicals with `_` identity
placeholders (originals kept as comments), comments out noise instructions,
forces every gadget to
placeholders (originals kept as comments), separates physical noise from
decoder metadata, and forces every gadget to
@CHECKS("manual", verify=0), and inserts auto-derived CHECKs (marked
`# auto`). COMPOSE/PROGRAM blocks are emitted commented-out for reference.

Expand All @@ -47,13 +47,15 @@ def annotate(
error probabilities are reproducible.
Use ``--no-verify`` to skip this (faster but no correctness guarantee).

With ``--keep-noise``, noise instructions (``X_ERROR``,
``DEPOLARIZE1/2``, noisy measurements, etc.) are emitted verbatim
in the annotated output and the corresponding ``ERROR(p) ...``
rows are *not* emitted. Re-transpilation of the annotated file
re-derives those ERROR rows from the kept noise instructions.
This is the recommended mode for producing a Stim-simulatable
annotated file.
Undecorated noise instructions (``X_ERROR``, ``DEPOLARIZE1/2``,
``LOSS_ERROR``, noisy measurements, etc.) are split by visibility: the
original noisy instruction is retained under ``@SIMULATE_ONLY`` for Stim
sampling, while canonical ``ERROR(p) ...`` rows and loss metadata carry
its decode-side effect. A decode-visible noisy measurement additionally
keeps a clean ``@DECODE_ONLY`` measurement instruction. Existing
``@SIMULATE_ONLY`` and ``@DECODE_ONLY`` intent is preserved; measurement
instructions must still be paired so both views produce the same number
of records.

Args:
deq_file: path to the input .deq file.
Expand All @@ -76,7 +78,8 @@ def annotate(
skip_mako_warning=skip_mako_warning,
)

rendered = _annotate_impl(qfile, keep_noise=keep_noise)
selected_loss_model = create_loss_model(loss_model)
rendered = _annotate_impl(qfile, loss_model=selected_loss_model)

# Determine output path.
if out is None:
Expand All @@ -94,12 +97,12 @@ def annotate(

# Verify: transpile the annotated output and compare.
print(
f"Verifying annotated output is equivalent to original",
f"(pass --no-verify to skip)...",
"Verifying annotated output is equivalent to original",
"(pass --no-verify to skip)...",
file=sys.stderr,
)
orig_lib = build_jit_library(qfile)
anno_lib = build_jit_library(parse_deq(rendered))
orig_lib = build_jit_library(qfile, loss_model=selected_loss_model)
anno_lib = build_jit_library(parse_deq(rendered), loss_model=selected_loss_model)
orig_stripped, _ = strip_jit_library(orig_lib)
anno_stripped, _ = strip_jit_library(anno_lib)
if orig_stripped.SerializeToString() == anno_stripped.SerializeToString():
Expand Down
6 changes: 5 additions & 1 deletion deq/deq/cli/interpret.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,16 @@ def _load_library(
import tempfile
from deq.circuit.parser import render_and_parse_file
from deq.transpiler.jit_library_builder import build_jit_library
from deq.transpiler.loss import NeutralAtomLossModel
from deq.cli.jit import jit_compile_program_to_file
from deq.compiler.jit_compiler import static_jit_compiler
import deq.proto.deq_jit_pb2 as jit_pb

qfile = render_and_parse_file(file)
jit_library = build_jit_library(qfile)
jit_library = build_jit_library(
qfile,
loss_model=NeutralAtomLossModel(),
)
with tempfile.TemporaryDirectory() as tmpdir:
jit_path = os.path.join(tmpdir, "temp.deq.jit")
jit_compile_program_to_file(jit_library, qfile, jit_path, program=program)
Expand Down
Loading
Loading