walk() should have a non-None per-default stop_type depending on certain values of my_type #2794
Replies: 2 comments
-
Thanks for the suggestion @schreiberx, I see what you mean, but remember that the PSyIR is a canonicalized version of the Fortran semantics (and this is good to make the transformation scripts easy and broadly applicable). Therefore these concepts that you mention can be recursive in the PSyIR, for example Call includes calls to routine, functions and intrinsics, so: Similarly for Container: it is used for the file scope which can have multiple modules inside, and also subroutines can have their own "contains" sections inside (currently creates a Codeblock but some day may mean nested containers). And for subroutines: nested routines are possible in Fortran (as mentioned before), and in the future we hay want to support statements functions as a nested routine. In addition the time of walks are barely visible in the profiler now, so I would avoid doing this optimisation even if we really find and edge case where this is possible. |
Beta Was this translation helpful? Give feedback.
-
Indeed, Calls shouldn't belong on the list of the suggested cyclone nodes. I'm adding this link to the nested "routines" and will close this discussion. Thanks for your answer! |
Beta Was this translation helpful? Give feedback.
-
Without testing this explicitly, I assume it will improve the performance of walking over psyir trees significantly in many cases if setting a 2nd default
stop_type
(in case thatstop_type == None
ifmy_type
is set to a type that can't be used recursively.E.g.,
Call
,Container
(the pure container, not FileContainer) andRoutine
can't be used recursively (in Fortran).Therefore, I suggest setting the
stop_type
per default for a certain values ofmy_type
(Routine
,Call
,Container
) simply to the value ofmy_type
.@arporter @sergisiso
Beta Was this translation helpful? Give feedback.
All reactions