Skip to content

Refactor caching of data products #24

Description

@knoepfel

phlex currently caches data products/stores for a few node types (e.g. transforms, observers). This caching should be factored out of those nodes themselves and placed in a dedicated node for situations where a cached data product is needed (e.g. an algorithm that uses a data product from both the "job" and the "spill").

Activity

  1. self-assigned this
    on Nov 12, 2025
  2. knoepfel commented on Nov 14, 2025

    @knoepfel
    MemberAuthor

    Introducing repeaters

    The following workflow shows a node consume that uses a data product $p$ from each run (indexed by $i$), and a data product $x$ from each spill in each run, which is indexed by the pair $(i, j)$.

    Image

    For example, in run 4, the data-product $p_4$ is paired with each data product $x_{4,j}$ when presented to the consume node. It is difficult in oneTBB's flow graph to "repeat" the $p_4$ data product when paired with another data product that is presented to consume at a different cadence.

    One solution, however, is to use a "repeater" node, which is a kind of unfold node. Because an unfold node generates one or more data products per input data product, the repeater node simply emits the same data product multiple times until an end token is received (checking that the right number of repetitions has occurred).

    The following shows a data-flow graph that supports repeater nodes:

    Image

    Note that 2 additional nodes are created (the repeater itself, and a node for sending the end token), and extra edges are added so that the repeater knows how often it should repeat the data product (the connection between $I(spill)$ and the $iter$ port).

    An implementation of this scheme is exercised in #118.

  3. added this to the Prototype 0.2 milestone on Feb 4, 2026
  4. added theissue type on Feb 4, 2026
  5. added
    enhancement
    on Feb 4, 2026
  6. knoepfel commented on Feb 4, 2026

    @knoepfel
    MemberAuthor

    Tasks:

  7. knoepfel commented on Feb 18, 2026

    @knoepfel
    MemberAuthor

    The eventual solution chosen was to introduce an entity whose purpose is to emit the correct message IDs that can be used by repeaters.

    Image

    Important changes wrt. the current implementation:

    1. The multiplexer ("router" in earlier diagrams) has been replaced by an index_router class (labeled "Index Router" in the above image)
    2. Explicit "index set" nodes have been added, which are responsible for reacting to data-cell indices belonging to a specific layer
    3. Caching has been removed from all nodes except any nodes that require joining two or more arguments:
      1. For nodes with two or more products that belong to the same data layer, a multilayer_join_node is created in such a manner that only the standard tbb::join_node<...> is used to tag-match the inputs
      2. For nodes with two or more products that belong to different data layers, a multilayer_join_node is created with "repeaters", which cache data products from the different layers while emitting them as needed to match the other inputs for the node.
  8. knoepfel commented on Feb 24, 2026

    @knoepfel
    MemberAuthor

    Migrating the fold-result caching to using the multilayer_join_node is now a separate issue (#359).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions