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

Fix pystr_to_symbolic not correctly interpreting constants as boolean values in boolean comparisons #1756

Merged
merged 3 commits into from
Nov 14, 2024

Conversation

phschaad
Copy link
Collaborator

Strings like not ((N > 20) != 0) (== Not(Ne(Gt(N, 20), 0))) were incorrectly interpreted by sympy.sympify as constant "False". This is a limitation by sympy, which does not assume integer 0 to be a Falsy, and enforces exact equivalence (or difference) checks with Ne. To get around this limitation, the DaCe internal AST preprocessor now replaces constants with boolean values if they are arguments to Comparison operations, where the other operand is also a comparison operation, thus returning a boolean.

This fixes an issue with DeadStateElimination, closing issue #1129.

@phschaad phschaad requested a review from tbennun November 14, 2024 07:08
@phschaad phschaad added this to the 1.0 milestone Nov 14, 2024
@phschaad phschaad added the bug Something isn't working label Nov 14, 2024
Copy link
Collaborator

@tbennun tbennun left a comment

Choose a reason for hiding this comment

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

I don't like the name truthy_falsy but I approve :)

@tbennun tbennun enabled auto-merge November 14, 2024 17:23
@tbennun tbennun added this pull request to the merge queue Nov 14, 2024
Merged via the queue into main with commit c83f601 Nov 14, 2024
10 checks passed
@tbennun tbennun deleted the users/phschaad/dead_state_elimination_fix branch November 14, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeadStateElimination on edge conditions with integers as boolean values
2 participants