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
Conditional Data Instrumentation #1202
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.
Almost
@@ -106,6 +106,11 @@ def on_node_end(self, sdfg: SDFG, state: SDFGState, node: nodes.AccessNode, oute | |||
# Only run on host code | |||
return | |||
|
|||
condition_preamble, condition_postamble = '', '' | |||
if node.instrument_condition is not None and not node.instrument_condition.as_string == '1': | |||
condition_preamble = f'if ({node.instrument_condition.as_string})' + ' {' |
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.
Please check how we generate C++ from codeblocks
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.
Learned something new, thanks.. :-)
@@ -178,6 +185,11 @@ def on_node_begin(self, sdfg: SDFG, state: SDFGState, node: nodes.AccessNode, ou | |||
# Only run on host code | |||
return | |||
|
|||
condition_preamble, condition_postamble = '', '' | |||
if node.instrument_condition is not None and not node.instrument_condition.as_string == '1': | |||
condition_preamble = f'if ({node.instrument_condition.as_string})' + ' {' |
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.
Same
for node, _ in sdfg.all_nodes_recursive(): | ||
if isinstance(node, nodes.AccessNode): | ||
node.instrument = dace.DataInstrumentationType.Save | ||
node.instrument_condition = CodeBlock('i == 0', language=dace.Language.CPP) |
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.
For completeness, please add a test with python codeblocks and “i ** 2 == 4”
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.
Done
Co-authored-by: Tal Ben-Nun <tbennun@users.noreply.github.com>
No description provided.