LCOV - code coverage report
Current view: top level - disco/topo - fd_topob.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 4 0.0 %
Date: 2026-03-19 18:19:27 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_topo_fd_topob_h
       2             : #define HEADER_fd_src_disco_topo_fd_topob_h
       3             : 
       4             : /* fd_topob is a builder for fd_topo, providing many convenience
       5             :    functions for creating a useful topology. */
       6             : 
       7             : #include "../../disco/topo/fd_topo.h"
       8             : #include "fd_cpu_topo.h"
       9             : 
      10             : /* A link in the topology is either unpolled or polled.  Almost all
      11             :    links are polled, which means a tile which has this link as an in
      12             :    will read fragments from it and pass them to the tile handling
      13             :    code.  An unpolled link will not read off the link by default and
      14             :    the user code will need to specifically read it as needed. */
      15             : 
      16           0 : #define FD_TOPOB_UNPOLLED 0
      17           0 : #define FD_TOPOB_POLLED 1
      18             : 
      19             : /* A reliable link is a flow controlled one, where the producer will
      20             :    not send fragments if any downstream consumer does not have enough
      21             :    capacity (credits) to handle it. */
      22             : 
      23           0 : #define FD_TOPOB_UNRELIABLE 0
      24           0 : #define FD_TOPOB_RELIABLE 1
      25             : 
      26             : FD_PROTOTYPES_BEGIN
      27             : 
      28             : /* Initialize a new fd_topo_t with the given app name and at the memory address
      29             :    provided.  Returns the topology at given address.  The topology will be empty
      30             :    with no tiles, objects, links. */
      31             : 
      32             : fd_topo_t *
      33             : fd_topob_new( void * mem,
      34             :               char const * app_name );
      35             : 
      36             : /* Add a workspace with the given name to the topology.  Workspace names
      37             :    must be unique and adding the same workspace twice will produce an
      38             :    error. */
      39             : 
      40             : fd_topo_wksp_t *
      41             : fd_topob_wksp( fd_topo_t *  topo,
      42             :                char const * name );
      43             : 
      44             : /* Add an object with the given type to the toplogy.  An object is
      45             :    something that takes up space in memory, in a workspace.
      46             : 
      47             :    The workspace must exist and have been added to the topology.
      48             :    Adding an object will cause it to occupt space in memory, but not
      49             :    be mapped into any tiles.  If you wish the object to be readable or
      50             :    writable by a tile, you need to add a fd_topob_tile_uses relationship. */
      51             : 
      52             : fd_topo_obj_t *
      53             : fd_topob_obj( fd_topo_t *  topo,
      54             :               char const * obj_type,
      55             :               char const * wksp_name );
      56             : 
      57             : /* Same as fd_topo_obj, but labels the object. */
      58             : 
      59             : fd_topo_obj_t *
      60             : fd_topob_obj_named( fd_topo_t *  topo,
      61             :                     char const * obj_type,
      62             :                     char const * wksp_name,
      63             :                     char const * label );
      64             : 
      65             : /* Add a relationship saying that a certain tile uses a given object.
      66             :    This has the effect that when memory mapping required workspaces
      67             :    for a tile, it will map the workspace required for this object in
      68             :    the appropriate mode.
      69             : 
      70             :    mode should be one of FD_SHMEM_JOIN_MODE_READ_ONLY or
      71             :    FD_SHMEM_JOIN_MODE_READ_WRITE. */
      72             : 
      73             : void
      74             : fd_topob_tile_uses( fd_topo_t *           topo,
      75             :                     fd_topo_tile_t *      tile,
      76             :                     fd_topo_obj_t const * obj,
      77             :                     int                   mode );
      78             : 
      79             : /* Add a link to the toplogy.  The link will not have any producer or
      80             :    consumer(s) by default, and those need to be added after.  The link
      81             :    can have no backing data buffer, a dcache, or a reassembly buffer
      82             :    behind it. */
      83             : 
      84             : fd_topo_link_t *
      85             : fd_topob_link( fd_topo_t *  topo,
      86             :                char const * link_name,
      87             :                char const * wksp_name,
      88             :                ulong        depth,
      89             :                ulong        mtu,
      90             :                ulong        burst );
      91             : 
      92             : /* Add a tile to the topology.  This creates various objects needed for
      93             :    a standard tile, including tile scratch memory, metrics memory and so
      94             :    on.  These objects will be created and linked to the respective
      95             :    workspaces provided, and the tile will be specified to map those
      96             :    workspaces when it is attached. */
      97             : 
      98             : fd_topo_tile_t *
      99             : fd_topob_tile( fd_topo_t *    topo,
     100             :                char const *   tile_name,
     101             :                char const *   tile_wksp,
     102             :                char const *   metrics_wksp,
     103             :                ulong          cpu_idx,
     104             :                int            is_agave,
     105             :                int            uses_id_keyswitch,
     106             :                int            uses_av_keyswitch );
     107             : 
     108             : /* Add an input link to the tile.  If the tile is created with fd_stem,
     109             :    it will automatically poll the in link and forward fragments to the
     110             :    user code (unless the link is specified as unpolled).
     111             : 
     112             :    An input link has an fseq which is a ulong used for returning the
     113             :    current reader position in sequence space, used for wiring flow
     114             :    control to the producer.  The producer will not produce fragments
     115             :    while any downstream consumer link is not ready to receive them,
     116             :    unless the link is marked as unreliable. */
     117             : 
     118             : void
     119             : fd_topob_tile_in( fd_topo_t *  topo,
     120             :                   char const * tile_name,
     121             :                   ulong        tile_kind_id,
     122             :                   char const * fseq_wksp,
     123             :                   char const * link_name,
     124             :                   ulong        link_kind_id,
     125             :                   int          reliable,
     126             :                   int          polled );
     127             : 
     128             : /* Add an output link to the tile.  This doesn't do much by itself,
     129             :    but will cause the link to get mapped in as writable for the tile,
     130             :    and the tile can later look up the link by name and write to it
     131             :    as it wants. */
     132             : 
     133             : void
     134             : fd_topob_tile_out( fd_topo_t *  topo,
     135             :                    char const * tile_name,
     136             :                    ulong        tile_kind_id,
     137             :                    char const * link_name,
     138             :                    ulong        link_kind_id );
     139             : 
     140             : /* Automatically layout the tiles onto CPUs in the topology for a
     141             :    best effort.  fd_topob_auto_layout reads CPU topology from the OS.
     142             :    fd_topob_auto_layout_cpus takes a pre-built CPU topology, useful
     143             :    for testing. */
     144             : 
     145             : void
     146             : fd_topob_auto_layout( fd_topo_t * topo,
     147             :                       int         reserve_agave_cores );
     148             : 
     149             : void
     150             : fd_topob_auto_layout_cpus( fd_topo_t *      topo,
     151             :                            fd_topo_cpus_t * cpus,
     152             :                            int              reserve_agave_cores );
     153             : 
     154             : /* Finish creating the topology.  Lays out all the objects in the
     155             :    given workspaces, and sizes everything correctly.  Also validates
     156             :    the topology before returning.
     157             : 
     158             :    This must be called to finish creating the topology. */
     159             : 
     160             : void
     161             : fd_topob_finish( fd_topo_t *                topo,
     162             :                  fd_topo_obj_callbacks_t ** callbacks );
     163             : 
     164             : FD_PROTOTYPES_END
     165             : 
     166             : #endif /* HEADER_fd_src_disco_topo_fd_topob_h */

Generated by: LCOV version 1.14