Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions src/app/firedancer-dev/commands/backtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,31 @@ backtest_topo( config_t * config ) {
topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size );
topo->gigantic_page_threshold = config->hugetlbfs.gigantic_page_threshold_mib << 20;

ushort parsed_tile_to_cpu[ FD_TILE_MAX ];
ulong affinity_tile_cnt = 0UL;
int is_auto_affinity = !strcmp( config->layout.affinity, "auto" );
if( FD_UNLIKELY( !is_auto_affinity ) )
affinity_tile_cnt = fd_topob_parse_affinity_cstr( config->layout.affinity, parsed_tile_to_cpu, 1 );

ulong cpu_idx = 1;
# define NEXT_CPU ( is_auto_affinity ? cpu_idx++ : ( cpu_idx<affinity_tile_cnt ? (ulong)parsed_tile_to_cpu[ cpu_idx++ ] : ULONG_MAX ) )

fd_topob_wksp( topo, "metric" );
fd_topob_wksp( topo, "metric_in" );
fd_topob_tile( topo, "metric", "metric", "metric_in", ULONG_MAX, 0, 0, 0, 1 );

fd_topob_wksp( topo, "backt" );
fd_topo_tile_t * backt_tile = fd_topob_tile( topo, "backt", "backt", "metric_in", cpu_idx++, 0, 0, 0, 0 );
fd_topo_tile_t * backt_tile = fd_topob_tile( topo, "backt", "backt", "metric_in", NEXT_CPU, 0, 0, 0, 0 );

fd_topob_wksp( topo, "replay" );
fd_topo_tile_t * replay_tile = fd_topob_tile( topo, "replay", "replay", "metric_in", cpu_idx++, 0, 1, 0, 0 );
fd_topo_tile_t * replay_tile = fd_topob_tile( topo, "replay", "replay", "metric_in", NEXT_CPU, 0, 1, 0, 0 );

fd_topo_obj_t * node_info_obj = fd_topob_obj( topo, "node_info", "replay" );
fd_topob_tile_uses( topo, replay_tile, node_info_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
FD_TEST( fd_pod_insertf_ulong( topo->props, node_info_obj->id, "node_info" ) );

fd_topob_wksp( topo, "accdb" )->core_dump_level = FD_TOPO_CORE_DUMP_LEVEL_FULL;
fd_topo_tile_t * accdb_tile = fd_topob_tile( topo, "accdb", "accdb", "metric_in", cpu_idx++, 0, 0, 0, 0 );
fd_topo_tile_t * accdb_tile = fd_topob_tile( topo, "accdb", "accdb", "metric_in", NEXT_CPU, 0, 0, 0, 0 );

fd_topob_wksp( topo, "progcache" );
setup_topo_progcache( topo, "progcache",
Expand Down Expand Up @@ -119,14 +126,14 @@ backtest_topo( config_t * config ) {
/**********************************************************************/
fd_topob_wksp( topo, "execrp" );
#define FOR(cnt) for( ulong i=0UL; i<cnt; i++ )
FOR(execrp_tile_cnt) fd_topob_tile( topo, "execrp", "execrp", "metric_in", cpu_idx++, 0, 0, 0, 0 );
FOR(execrp_tile_cnt) fd_topob_tile( topo, "execrp", "execrp", "metric_in", NEXT_CPU, 0, 0, 0, 0 );

/**********************************************************************/
/* Add the capture tile to topo */
/**********************************************************************/
if( solcap_enabled ) {
fd_topob_wksp( topo, "solcap" );
fd_topob_tile( topo, "solcap", "solcap", "metric_in", cpu_idx++, 0, 0, 0, 0 );
fd_topob_tile( topo, "solcap", "solcap", "metric_in", NEXT_CPU, 0, 0, 0, 0 );
}

fd_topob_wksp( topo, "diag" );
Expand All @@ -143,19 +150,19 @@ backtest_topo( config_t * config ) {
fd_topob_wksp( topo, "snapin" );
fd_topob_wksp( topo, "snapwr" );

fd_topo_tile_t * snapct_tile = fd_topob_tile( topo, "snapct", "snapct", "metric_in", cpu_idx++, 0, 0, 0, 0 );
fd_topo_tile_t * snapld_tile = fd_topob_tile( topo, "snapld", "snapld", "metric_in", cpu_idx++, 0, 0, 0, 0 );
FOR(snapdc_tile_cnt) fd_topob_tile( topo, "snapdc", "snapdc", "metric_in", cpu_idx++, 0, 0, 0, 0 )->allow_shutdown = 1;
snapin_tile = fd_topob_tile( topo, "snapin", "snapin", "metric_in", cpu_idx++, 0, 0, 0, 0 );
fd_topo_tile_t * snapwr_tile = fd_topob_tile( topo, "snapwr", "snapwr", "metric_in", cpu_idx++, 0, 0, 0, 0 );
fd_topo_tile_t * snapct_tile = fd_topob_tile( topo, "snapct", "snapct", "metric_in", NEXT_CPU, 0, 0, 0, 0 );
fd_topo_tile_t * snapld_tile = fd_topob_tile( topo, "snapld", "snapld", "metric_in", NEXT_CPU, 0, 0, 0, 0 );
FOR(snapdc_tile_cnt) fd_topob_tile( topo, "snapdc", "snapdc", "metric_in", NEXT_CPU, 0, 0, 0, 0 )->allow_shutdown = 1;
snapin_tile = fd_topob_tile( topo, "snapin", "snapin", "metric_in", NEXT_CPU, 0, 0, 0, 0 );
fd_topo_tile_t * snapwr_tile = fd_topob_tile( topo, "snapwr", "snapwr", "metric_in", NEXT_CPU, 0, 0, 0, 0 );

snapct_tile->allow_shutdown = 1;
snapld_tile->allow_shutdown = 1;
snapin_tile->allow_shutdown = 1;
snapwr_tile->allow_shutdown = 1;
} else {
fd_topob_wksp( topo, "genesi" );
fd_topob_tile( topo, "genesi", "genesi", "metric_in", cpu_idx++, 0, 0, 0, 0 )->allow_shutdown = 1;
fd_topob_tile( topo, "genesi", "genesi", "metric_in", NEXT_CPU, 0, 0, 0, 0 )->allow_shutdown = 1;
}

/**********************************************************************/
Expand All @@ -167,8 +174,8 @@ backtest_topo( config_t * config ) {
fd_topob_wksp( topo, "event_sign" );
fd_topob_wksp( topo, "sign_event" );

fd_topob_tile( topo, "sign", "sign", "metric_in", cpu_idx++, 0, 1, 1, 0 );
fd_topo_tile_t * event_tile = fd_topob_tile( topo, "event", "event", "metric_in", cpu_idx++, 0, 1, 0, 1 );
fd_topob_tile( topo, "sign", "sign", "metric_in", NEXT_CPU, 0, 1, 1, 0 );
fd_topo_tile_t * event_tile = fd_topob_tile( topo, "event", "event", "metric_in", NEXT_CPU, 0, 1, 0, 1 );

ushort shred_version = 0;
uchar genesis_hash[ 32 ] = {0};
Expand Down Expand Up @@ -333,7 +340,7 @@ backtest_topo( config_t * config ) {
requires the snapshot tiles. */
if( FD_UNLIKELY( config->tiles.gui.enabled && !disable_snap_loader ) ) {
fd_topob_wksp( topo, "gui" );
fd_topo_tile_t * gui_tile = fd_topob_tile( topo, "gui", "gui", "metric_in", cpu_idx++, 0, 1, 0, 1 );
fd_topo_tile_t * gui_tile = fd_topob_tile( topo, "gui", "gui", "metric_in", NEXT_CPU, 0, 1, 0, 1 );

fd_topob_wksp( topo, "diag_gui" );
fd_topob_link( topo, "diag_gui", "diag_gui", 4UL, sizeof(fd_diag_system_resources_t), 1UL );
Expand Down
Loading