-
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
Remove unused global data descriptor shapes from arguments #1338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions on the selected implementation.
for o in self.offset: | ||
if isinstance(o, sp.Expr): | ||
result |= set(o.free_symbols) | ||
|
||
if self.transient or all_symbols: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the transient check only here? What about strides and offset just above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strides and offset are always necessary if you have any memlet (a[i*stride] will be generated in the code).
dace/sdfg/sdfg.py
Outdated
for name, desc in self.arrays.items(): | ||
defined_syms.add(name) | ||
if not desc.transient: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I understand the algorithm now. What I don't like is that it spills the need to specialize for Data subclasses to SDFG/SDFGState.free_symbols
. Wouldn't it be cleaner not to have the transient check in Data.free_symbols
and instead have it only here, without needing to specialize for strides/totalsize/etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, I would do:
for name, desc in self.arrays.items():
if not desc.transient:
not_strictly_necessary_global_symbols |= set(map(str, desc.free_symbols))
where free_symbols
is the current definition. Alternatively, if the new definitions of free/used symbols are necessary, it could be desc.used_symbols(all_symbols=True)
.
Is the solution chosen an optimization, e.g., we can safely rule out that we don't need to check the strides or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’re right and I started to rewrite it as such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears the ssa-symbol tests didn't need to be amended after all. This makes more sense since this PR should not change the result of free_symbols
.
context=context, | ||
ignore_properties={'src_subset', 'dst_subset', 'num_accesses', 'is_data_src'}) | ||
|
||
dace.serialize.set_properties_from_json( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to the PR, but why is YAPF constantly switching the formatting of such lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it depends on the version of yapf being used
This PR allows symbols that exist only in non-transient arrays to generate code successfully. This avoids the case of unused program arguments and enables compilation of more programs, while retaining symbolic analysis.