Skip to content

feat: factorize computed column usage#1831

Open
letypequividelespoubelles wants to merge 6 commits into
mainfrom
1793-feat-optimise-constraints-arising-from-control-flow
Open

feat: factorize computed column usage#1831
letypequividelespoubelles wants to merge 6 commits into
mainfrom
1793-feat-optimise-constraints-arising-from-control-flow

Conversation

@letypequividelespoubelles
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: F Bojarski <ceciestunepoubelle@protonmail.ch>
Copilot AI review requested due to automatic review settings June 2, 2026 15:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR factors out “is-zero indicator” computation used by MIR→AIR lowering so repeated NotEqual constraints over the same expression reuse a single shared computed column (via AIR gadgets), rather than rebuilding equivalent arithmetic subtrees.

Changes:

  • Replaces inline 1 - normalise(lhs-rhs) construction in lowerNonEqualityTo with a dedicated lowerIsZeroIndicator helper.
  • Adds air_gadgets.IsZeroIndicator, which CSEs iz(e) = 1 - e*inv(e) into a shared computed column with defining vanishings.
  • Introduces a new trace-filling assignment assignment.PseudoIz for computed “is zero” indicator columns.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/ir/mir/lower.go Routes NotEqual lowering through a new lowerIsZeroIndicator helper (with small-range shortcuts + shift normalisation).
pkg/ir/assignment/pseudo_iz.go Adds a computed-column assignment that fills an iz column with 0/1 based on whether an expression evaluates to zero per-row.
pkg/ir/air/gadgets/normalisation.go Adds IsZeroIndicator gadget that materialises (and reuses) an iz computed column tied to the existing pseudo-inverse gadget.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

letypequividelespoubelles and others added 5 commits June 4, 2026 12:31
Signed-off-by: F Bojarski <ceciestunepoubelle@protonmail.ch>
Signed-off-by: F Bojarski <ceciestunepoubelle@protonmail.ch>
Signed-off-by: F Bojarski <ceciestunepoubelle@protonmail.ch>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment on lines +333 to +345
// NOTE: the pre-expanded (expand=false) fixtures below are disabled. They
// embed every computed column verbatim, so any change to the set of computed
// columns (e.g. the (iz ...) is-zero indicator introduced for control-flow
// optimisation, see #1793) requires hand-editing each fixture. That
// maintenance burden outweighs the coverage they add, so they are skipped
// pending a decision to regenerate or remove them.
//
// {"expanded.accepts", true, false, false, "BLS12_377", allOptLevels},
// {"expanded.O1.accepts", true, false, false, "BLS12_377", defaultOptLevel},
// {"expanded.koalabear_16.rejects", false, false, false, "KOALABEAR_16", defaultOptLevel},
// {"expanded.gf_8209.rejects", false, false, false, "GF_8209", defaultOptLevel},
// {"expanded.rejects", false, false, false, "BLS12_377", allOptLevels},
// {"expanded.O1.rejects", false, false, false, "BLS12_377", defaultOptLevel},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: optimise constraints arising from control-flow

2 participants