Repository navigation
Accept gate callbacks in the extractor - #33
Merged
Merged
Conversation
Selective backport of core/src changes from e4df243.
The runner always passed --llzk-field-name to LLZK as a builtin field, so circuits over other primes could not be emitted and a mislabeled field was silently accepted. For example, a circuit over BLS12-381's scalar field labeled `bn254` produced LLZK over BN254's prime. Builtin names are now checked against the circuit's prime and rejected on a mismatch. Any other name defines a field with the circuit's prime. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Lookup IR was instantiated on every row of a group, including rows where all lookup selectors are off, such as the rows of table regions. Those copies fold away later, but only after being fully materialized; on the packed SHA3 circuit IR generation ran out of memory (>22 GB). A lookup is now vacuous on a row when a selector multiplying every one of its inputs is disabled there, and rows where every lookup is vacuous are skipped. A selector that only appears inside a sum, as in `q * a + (1 - q) * b`, does not gate the lookup, and lookups without a gating selector are kept on every row. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
0xddom
force-pushed
the
dani/cargo-haloumi-2
branch
from
October 13, 2026 18:01
85524a8 to
2aa4a22
Compare
IRGenParams already takes gate callbacks, but the extractor had no way to pass them, so circuits could not customize how their gates are lowered. Add Extractor::extract_circuit_with_callbacks, which takes gate callbacks next to the lookup callbacks; extract_circuit delegates to it without any. Add GateScope::enabled_rows, so that patterns outside ir-gen can find the rows where a gate is enforced. Like the lookup row filter, a row counts as enabled when every selector multiplying the whole polynomial is enabled. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
shankarapailoor
force-pushed
the
shankara/gate-callbacks-on-cli2
branch
from
October 13, 2026 18:37
2fd8ed6 to
2e979ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #15 (
dani/cargo-haloumi-2). This replaces #28, which was based on #19.This lets circuits pass gate callbacks to the extractor. The SHA3 demo needs it to replace the 27-ordering
determinism()lookup axioms with one bootstrap axiom per enabled gate row.Extractor::extract_circuit_with_callbacks(circuit, lookups, gates):IRGenParamsalready takes gate callbacks, but the extractor had no way to pass them in.extract_circuitnow calls this with no gate callbacks.GateScope::enabled_rows(poly): returns the rows where every selector multiplying the whole polynomial is enabled. It uses the same rule as the lookup row filter (find_selector_factors). This lets patterns outsideir-genfind where a gate is enforced, sinceregion_rowsis crate-private.Results with the demo's
BootstrapAxiomspattern on top of this:keccakfsha3/digest_1Each keccakf harness's LLZK output is ~17 MB, down from ~1 GB. Picus gives the same result with
--no-solverand with cvc5.It builds on
dani/cargo-haloumi-2@ 2aa4a22.cargo test -p haloumi-ir-gen --all-featurespasses, and clippy and nightly rustfmt report nothing on the changed files.🤖 Generated with Claude Code