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
Generate Duplicated NestedSDFGs only once #393
Conversation
…name. Added tests
Codecov Report
@@ Coverage Diff @@
## master #393 +/- ##
==========================================
+ Coverage 82.65% 82.68% +0.03%
==========================================
Files 148 148
Lines 28335 28364 +29
==========================================
+ Hits 23420 23452 +32
+ Misses 4915 4912 -3
Continue to review full report at Codecov.
|
dace/codegen/targets/cpu.py
Outdated
self._locals.clear_scope(self._ldepth + 1) | ||
# Mark node as "generated" | ||
self._generated_nodes.add(node) | ||
|
||
self._locals.clear_scope(self._ldepth + 1) | ||
|
||
def allocate_array(self, sdfg, dfg, state_id, node, function_stream, |
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.
That might not be a good idea
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.
Thanks for spotting it. Some wrong editing!
dace/codegen/targets/cpu.py
Outdated
if not code_already_generated: | ||
function_stream.write(global_code) |
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.
not sure why you'd want to put that in a condition, since above you skip the generation of the function
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.
global_code is created in one of the ifs above
Also @tbennun : the The hashing is breaking multiple tests. |
@TizianoDeMatteis I discussed this with Tal, and we think there's a pretty clean solution that will benefit the whole codegen (not just FPGA). We generate nested SDFGs bottom up instead of top down:
|
I didn't quite get your proposals:
Independently from this, we should decide how to hash (symbols are included? access nodes?...) |
|
@tbennun Regarding 4. Ok, I think is that the main problem could be related to symbols. But that (the way in which hashing is done) could be easily changed later on. Another minor thing: the way in which function names for nested SDFG is generated must be changed as well. |
…e the name to call already generated code
We should decide whether to have a configuration to enable/disable this behavior. Maybe be useful especially for FPGAs, where we explicitly want to generate duplicated code |
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.
One (not so) minor comment
@TizianoDeMatteis if it's done and passing all tests, make sure it's not WIP and re-tag me for review. looks like some minor documentation updates |
Co-authored-by: Tal Ben-Nun <tbennun@users.noreply.github.com>
Co-authored-by: Tal Ben-Nun <tbennun@users.noreply.github.com>
Co-authored-by: Tal Ben-Nun <tbennun@users.noreply.github.com>
Co-authored-by: Tal Ben-Nun <tbennun@users.noreply.github.com>
PR for #392
First commit, so that we can iterate.
Goal: avoid generating 2+ times the same code for a NestedSDFGs that is used multiple times (which include also LibNodes after expansion)
Current implementation:
unique_name
(type string, default empty)So, up to now, it is up to the user to specify the SDFG unique name. We would probably need something (in the configuration file?), to disable this.
Don't know why code coverage fails: the relative difference is 100%