Skip to content

Add LateFunctionBinding declaration and fix constant folding #1117

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

zeitgeist87
Copy link
Contributor

Some functions are intended to have side effects and therefore should not be folded even if all parameters are constants. Currently the constant folding optimizer throws an error if such a function does not provide an implementation. This change allows functions with side effects to return Unknown.

@TristonianJones TristonianJones self-requested a review January 30, 2025 23:02
@TristonianJones
Copy link
Collaborator

/gcbrun

@zeitgeist87 zeitgeist87 force-pushed the constant_folding_fix branch from 83720e3 to 5d7f09b Compare March 17, 2025 14:01
@zeitgeist87 zeitgeist87 changed the title Adapt constant folding to ignore functions returning Unknown Add LateFunctionBinding declaration and fix constant folding Mar 17, 2025
@zeitgeist87
Copy link
Contributor Author

@TristonianJones I added the cel.LateFunctionBinding() and adapted the constant folding optimizer to use it. However, this is just the declaration and it does not add support for adding late function bindings to the Activation.

@zeitgeist87 zeitgeist87 force-pushed the constant_folding_fix branch 2 times, most recently from bbb7627 to caacded Compare March 17, 2025 15:21
@TristonianJones
Copy link
Collaborator

/gcbrun

Adds the declaration for LateFunctionBindings, which can be used to
indicate to the Runtime and the Optimizers that the function will
be bound at runtime through the Activation.

This lets the constant folding optimizer know that the function
potentially has side effects and cannot be folded. Without this
the optimization will fail with an error for late bound functions
where all arguments are constants.

The implementation for late bound functions will be added in a
subsequent commit.
@zeitgeist87 zeitgeist87 force-pushed the constant_folding_fix branch from caacded to e5d292c Compare April 9, 2025 09:52
@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones TristonianJones merged commit 0f9133d into google:master Apr 14, 2025
2 checks passed
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.

2 participants