-
Notifications
You must be signed in to change notification settings - Fork 133
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
Restoration of Symbolic Properties #1946
Comments
I don't understand the text describing the issue, specifically -(10*__coarse_i_K_gtx_vertical + vertical_start - Min(vertical_end, 10*__coarse_i_K_gtx_vertical + vertical_start + 10))(4Max(283876, horizontal_end) - 4Min(0, horizontal_start) + 1) is transformed into -(10__coarse_i_K_gtx_vertical + vertical_start - Min(vertical_end, 10*__coarse_i_K_gtx_vertical + vertical_start + 10))(4Max(283876, horizontal_end) - 4*Min(0, horizontal_start) + 1) I had to copy that into a text file and compare it character by character, but I still do not see the difference. The code does not run for me because |
gives
So yes, sympy either is not deterministic or we call it differently :) |
I think there is at least another issue, this time regarding to connectors, especially out connectors of Maps. def foo(A: dace.float64[10], B: dace.float64[10], C: dace.float64[10]):
for i in dace.map[0:10]:
B[i] = A[i] + 1. # The Memlet connecting the MapEntry node with the Tasklet is `A[i]`
C[i] = A[i] - 1. # The Memlet connecting the MapEntry node with the Tasklet is `A[i]` Simplify will ensure that both Memlets originate at the same outgoing connector at the MapEntry node. Now consider this code snipped: def foo(A: dace.float64[10], idx: dace.int32[10], B: dace.float64[10], C: dace.float64[10]):
for i in dace.map[0:10]:
B[i] = A[i] + 10. # This Tasklet has a single connected with the MapEntry node with the Memlet `A[i]`.
C[i] = A[idx[i]] # This Tasklet has two connections with the MapEntry node, the first Memlet is `Idx[i]`
# the second Memlet is `A[:]`. Again simplify will make sure that both Memlets, that are associated to the data As I understand the code in
I am not sure, but I am not fully sure if this is an issue in the specific case. |
@tim0s |
Restoration of symbolic, i.e. restoration from file/json, property essentially works by relying on
pystr_to_symbolic()
withsimplify
set toFalse
.See
dace/properties.py:1150
:The idea of setting
simplify
toFalse
is that the content of the symbol does not change.However it seems that this is not the case, at least for certain expressions, which sometimes change.
This has sever implication, for example storing an SDFG to disc and restoring it right away will alter the SDFG's hash.
The issue is that expressions of the form
-(a + b) * c
are transformed into(b - a) * c
, i.e. the minus is moved into the first parentheses, as far as I can tell during restoration, by looking at the content ofserialized_a
.In my specific case it happens to the expression
-(10*__coarse_i_K_gtx_vertical + vertical_start - Min(vertical_end, 10*__coarse_i_K_gtx_vertical + vertical_start + 10))*(4*Max(283876, horizontal_end) - 4*Min(0, horizontal_start) + 1)
.This is an expression I found inside a Memlet, to be precise inside the
volume
expression.In the reproducer below, it is important that
simplify()
is called on the final expression, without it would not have worked.Note that the Memlet propagation uses
simplify()
during the calculation of the volume.I wrote this reproducer:
The text was updated successfully, but these errors were encountered: