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

[shape_poly] Simplify and speed-up the __eq__ functions for symbolic expressions #19231

Merged
merged 1 commit into from Jan 7, 2024

Conversation

gnecula
Copy link
Collaborator

@gnecula gnecula commented Jan 7, 2024

Equality is used heavily for symbolic expressions because we use them as dictionary keys or in sets. Previously, we used a more complete and more expensive form of equality where we attempted to prove that "e1 - e2 >= 0" and "e1 - e2 <= 0". This is an overkill and none of the tests we have so far rely on this power. Now we just normalize "e1 - e2" and if it reduces syntactically to an integer we check if the integer is 0. If the difference does not reduce to an integer we say that the expressions are disequal.

This may possibly change user-visible behavior when it depends on the outcome of equality comparisons of symbolic dimensions in presence of shape polymorphism.

@gnecula gnecula self-assigned this Jan 7, 2024
@gnecula gnecula added the pull ready Ready for copybara import and testing label Jan 7, 2024
…expressions

Equality is used heavily for symbolic expressions because we use them
as dictionary keys or in sets. Previously, we used a more complete
and more expensive form of equality where we attempted to prove that
"e1 - e2 >= 0" and "e1 - e2 <= 0". This is an overkill and none
of the tests we have so far rely on this power. Now we just
normalize "e1 - e2" and if it reduces syntactically to an integer
we check if the integer is 0. If the difference does not reduce
to an integer we say that the expressions are disequal.

This may possibly change user-visible behavior when it depends
on the outcome of equality comparisons of symbolic dimensions
in presence of shape polymorphism.
@copybara-service copybara-service bot merged commit 4998c80 into google:main Jan 7, 2024
13 checks passed
@gnecula gnecula deleted the poly_eq branch January 8, 2024 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull ready Ready for copybara import and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant