Two traps in runners/dace/transformations/utils.py that a caller cannot reasonably anticipate. Neither is reachable from the pipeline today, so this is about robustness of shared helpers rather than a live defect.
1. track_view raises on a View produced by the lowering
A View created by gtir_dataflow.LambdaToDataflow._construct_local_view lives inside a Map scope, is fed through a MapEntry, and carries no views connector (dst_conn=None). dace.sdfg.utils.get_view_edge cannot then determine the direction:
RuntimeError: Failed to determine the direction of the view 'view_gtir_tmp_8' |
map_5_fieldop[...]:OUT_gtir_tmp_8 -(gtir_tmp_8[...])-> view_gtir_tmp_8:None.
track_view is the natural helper for "is this data viewed", and this is the shape the lowering actually emits — so the first thing a caller tries fails on the case that matters. Worse, catching the exception and treating it as "not a view" gives a false negative rather than an error.
_gt_modify_strides_of_views_non_recursive (strides.py:650+) calls track_view unguarded. In gt_auto_optimize that code runs after RemovePointwiseViews, so it is not reachable there at present — but the non-transient skip at strides.py:685-690 can consequently only ever apply to properly connected views, which is worth knowing when reasoning about that function.
2. reconfigure_dataflow_after_rerouting asserts on an uninitialised Memlet
utils.py:542, assert subset_to_adjust is not None. reroute_edge and reconfigure_dataflow_after_rerouting read the raw src_subset/dst_subset properties, which return None when Memlet._is_data_src was never set. add_mapped_tasklet sets it to False, which is why every producer built the normal way works, and why this only shows up on a hand constructed edge.
Not a defect in the helpers' intended use, but an unhelpful failure mode for anyone assembling an SDFG programmatically — an assertion deep inside a helper rather than a message about the input. It is equally reachable from GT4PyMapBufferElimination.
Suggestion
For (1), either make track_view return a definite "cannot determine" result instead of raising, or document that it only accepts properly connected views and provide something that answers the "is this data viewed" question for the lowering's own shapes. For (2), a clearer error, or try_initialize in the helper.
Found while adding a view rejection to GT4PyWriteBackBufferElimination (#2763) — track_view was the obvious tool and could not be used, so the check resolves the name from the view edge instead.
Two traps in
runners/dace/transformations/utils.pythat a caller cannot reasonably anticipate. Neither is reachable from the pipeline today, so this is about robustness of shared helpers rather than a live defect.1.
track_viewraises on a View produced by the loweringA View created by
gtir_dataflow.LambdaToDataflow._construct_local_viewlives inside a Map scope, is fed through aMapEntry, and carries noviewsconnector (dst_conn=None).dace.sdfg.utils.get_view_edgecannot then determine the direction:track_viewis the natural helper for "is this data viewed", and this is the shape the lowering actually emits — so the first thing a caller tries fails on the case that matters. Worse, catching the exception and treating it as "not a view" gives a false negative rather than an error._gt_modify_strides_of_views_non_recursive(strides.py:650+) callstrack_viewunguarded. Ingt_auto_optimizethat code runs afterRemovePointwiseViews, so it is not reachable there at present — but the non-transient skip atstrides.py:685-690can consequently only ever apply to properly connected views, which is worth knowing when reasoning about that function.2.
reconfigure_dataflow_after_reroutingasserts on an uninitialised Memletutils.py:542,assert subset_to_adjust is not None.reroute_edgeandreconfigure_dataflow_after_reroutingread the rawsrc_subset/dst_subsetproperties, which returnNonewhenMemlet._is_data_srcwas never set.add_mapped_taskletsets it toFalse, which is why every producer built the normal way works, and why this only shows up on a hand constructed edge.Not a defect in the helpers' intended use, but an unhelpful failure mode for anyone assembling an SDFG programmatically — an assertion deep inside a helper rather than a message about the input. It is equally reachable from
GT4PyMapBufferElimination.Suggestion
For (1), either make
track_viewreturn a definite "cannot determine" result instead of raising, or document that it only accepts properly connected views and provide something that answers the "is this data viewed" question for the lowering's own shapes. For (2), a clearer error, ortry_initializein the helper.Found while adding a view rejection to
GT4PyWriteBackBufferElimination(#2763) —track_viewwas the obvious tool and could not be used, so the check resolves the name from the view edge instead.