You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If one deepcopy a SDFG of a nested SDFG where there are constants defined in the parent SDFG which are also present in the nested SDFG, they are not anymore after the deepcopy
Constants are added to the (DaCe) property/dictionary SDFG.constants_prop. Constants are not copied to the nested SDFGs. Instead, the (Python) property SDFG.constants iterates recursively over the parent SDFG scopes to include their constants_prop items.
SDFG.__deepcopy__ does not copy an SDFG object exactly. Specifically, there is an issue with attributes such as SDFG.parent, SDFG.parent_sdfg, and SDFG.parent_nsdfg_node. These attributes reference objects (SDFGState, SDFG, NestedSDFG). If the SDFG being deep copied contains nested SDFGs, their (parent) reference attributes will be updated to point to the (deep) copied objects. However, it is a design decision that the (parent) reference attributes of the SDFG being copied are set to None. This is done because the deep copy method cannot know whether the SDFG copy will be placed in the same scope as the original or somewhere completely different. Therefore, it is left to the user to set those attributes explicitly.
However, the above design decision does not consider constants, as shown in the reported issue above. A potential issue from the user's perspective is that missing the original SDFG's parent constants may lead to some transformations failing to apply. For example, in CompositeFusion.can_be_applied, the SDFG has to be altered to complete all checks. Therefore, the SDFG is deep copied to avoid breaking the original. Should we update SDFG.constants_prop with SDFG.constants in such cases?
Describe the bug
If one deepcopy a SDFG of a nested SDFG where there are constants defined in the parent SDFG which are also present in the nested SDFG, they are not anymore after the deepcopy
To Reproduce
Execute the following code
This will print
Expected behavior
Expect it to print:
The text was updated successfully, but these errors were encountered: