Skip to content
valentin petrov edited this page Nov 3, 2021 · 9 revisions

TL implementation manual

Each TL is a dynamically loadable component that implements collectives primitives defined in common interface ucc_tl_iface_t (src/components/tl/ucc_tl.h) TLs are discovered in runtime and used by CLs (higher level layers that build collective schedules using TL backends)

Interface

TL interface can be split into groups: control and data.

typedef struct ucc_tl_iface {
    ucc_component_iface_t          super;
    ucs_config_global_list_entry_t tl_lib_config;
    ucs_config_global_list_entry_t tl_context_config;
    ucc_base_lib_iface_t           lib;
    ucc_base_context_iface_t       context;
    ucc_base_team_iface_t          team;
    ucc_base_coll_iface_t          coll;
    ucc_tl_service_coll_t          scoll;
    ucc_base_coll_alg_info_t *     alg_info[UCC_COLL_TYPE_NUM];
} ucc_tl_iface_t;

Control includes: ucc_base_lib_iface_t, ucc_base_context_iface_t, ucc_base_team_iface_t

  • lib: tl library object constructor/destructor and get_lib_attr
  • context: tl context object constructor/destructor and get_context_attr
  • team: tl team constructor/destructor, team_create_test

Data includes: ucc_base_coll_iface_t

  • coll: collective_init

Code structure

TL code resides under src/components/tl/new and usually contains: tl_new.h, tl_new.c, tl_new_lib.c, tl_new_context.c, tl_new_team.c, tl_new_coll.c/h

tl_new.h:

  • Main interface structure
typedef struct ucc_tl_new_iface {
    ucc_tl_iface_t super;
} ucc_tl_new_iface_t;
/* Extern iface should follow the pattern: ucc_tl_<tl_name> */
extern ucc_tl_new_iface_t ucc_tl_new;

The actual ucc_tl_new object is instantiated in tl_new.c using macro: UCC_TL_IFACE_DECLARE(new, NEW);

  • Control structures:
  1. TL configuration (env var parameters). Configs are allowed for lib and for context (note, there 1-to-many relation between lib and ctx objects)
typedef struct ucc_tl_new_lib_config {
    ucc_tl_lib_config_t super;
    uint32_t            example_lib_param;
} ucc_tl_new_lib_config_t;
typedef struct ucc_tl_new_context_config {
    ucc_tl_context_config_t super;
    uint32_t                example_ctx_param;
} ucc_tl_new_context_config_t;
Clone this wiki locally