Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static optimizers for constant folding #804

Merged
merged 4 commits into from Aug 30, 2023

Conversation

TristonianJones
Copy link
Collaborator

@TristonianJones TristonianJones commented Aug 15, 2023

Support for constant folding and configurable optimizers.

Constant folding introduces several API changes to support the construction
ASTs which are intended to be type-check and unparser friendly. The constant
folding algorithm exercises many parts of this new framework and does
best effort folding through comprehension expressions as well.

Static optimizers are standalone instances and not configured as part of the standard
environment simply because their options, configurations, and sequencing may be
use-case specific and might not fit well within the parse -> compile -> eval flow.

@TristonianJones TristonianJones marked this pull request as ready for review August 23, 2023 23:50
Copy link
Collaborator

@l46kok l46kok left a comment

Choose a reason for hiding this comment

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

Submitting what I have so far -- the literal adaptation and optional handling is sufficiently complex. It could be a good idea to create abstractions for them to reuse them across other optimizer implementations.

cel/optimizer.go Show resolved Hide resolved
cel/optimizer.go Outdated Show resolved Hide resolved
cel/folding_test.go Show resolved Hide resolved
cel/folding.go Outdated Show resolved Hide resolved
cel/folding.go Show resolved Hide resolved
cel/folding.go Show resolved Hide resolved
common/ast/expr.go Outdated Show resolved Hide resolved
cel/folding.go Show resolved Hide resolved
@TristonianJones TristonianJones changed the title Static optimizers for inlining and constant folding Static optimizers for constant folding Aug 25, 2023
l46kok
l46kok previously approved these changes Aug 30, 2023
cel/folding.go Outdated Show resolved Hide resolved
cel/folding.go Show resolved Hide resolved
@TristonianJones
Copy link
Collaborator Author

PTAL

@TristonianJones TristonianJones merged commit 705546a into google:master Aug 30, 2023
2 checks passed
@TristonianJones TristonianJones deleted the optimizer branch August 30, 2023 23:23
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.

None yet

2 participants