Summary
Fix the partition-slot counting-layer selection for multi-input folds.
phlex::detail::fold_join_node::index_ports() currently uses layers_[0] as the counting layer for the partition slot. This is only correct when that input layer is the deepest input layer.
Required change
Resolve the deepest input layer from the fold input hierarchy and use that layer as the partition slot counting_layer.
Pass the resolved deepest layer into fold_join_node, or add an equivalent router-supported depth resolution. Preserve partition_layer_ when the fold has no input layers.
Do not use an arbitrary input order position such as layers_[0] for multi-input folds.
Rationale
The accumulator increments once per fold call at the deepest input data layer. The partition flush count must use the same layer. If the router counts at a different layer, it can flush too early or too late. This can release an incomplete fold result or retain a result indefinitely.
Affected areas
phlex/core/fold_join_node.hpp
- Fold construction and index-router wiring that determine input layer hierarchy
Acceptance criteria
- For a multi-input fold, the partition slot uses the actual deepest input layer as its
counting_layer.
- The selected counting layer does not depend on the order of
layers_.
- Folds with no input layers continue to use
partition_layer_.
- Tests cover multi-input inputs with different hierarchy depths and verify that flush accounting completes correctly.
Backlinks
Summary
Fix the partition-slot counting-layer selection for multi-input folds.
phlex::detail::fold_join_node::index_ports()currently useslayers_[0]as the counting layer for the partition slot. This is only correct when that input layer is the deepest input layer.Required change
Resolve the deepest input layer from the fold input hierarchy and use that layer as the partition slot
counting_layer.Pass the resolved deepest layer into
fold_join_node, or add an equivalent router-supported depth resolution. Preservepartition_layer_when the fold has no input layers.Do not use an arbitrary input order position such as
layers_[0]for multi-input folds.Rationale
The accumulator increments once per fold call at the deepest input data layer. The partition flush count must use the same layer. If the router counts at a different layer, it can flush too early or too late. This can release an incomplete fold result or retain a result indefinitely.
Affected areas
phlex/core/fold_join_node.hppAcceptance criteria
counting_layer.layers_.partition_layer_.Backlinks