Skip to content

Commit 8471849

Browse files
committed
disco, stem: check if consumer of reliable tile has shutdown and ignore cr avail result in stem_run loop
1 parent 9e5bd5e commit 8471849

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/disco/stem/fd_stem.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@
190190
#define STEM_LAZY (0L)
191191
#endif
192192

193+
#define STEM_SHUTDOWN_SEQ (ULONG_MAX-1UL)
194+
193195
static inline void
194196
STEM_(in_update)( fd_stem_tile_in_t * in ) {
195197
fd_fseq_update( in->fseq, in->seq );
@@ -431,6 +433,10 @@ STEM_(run1)( ulong in_cnt,
431433
ulong out_idx = cons_out[ cons_idx ];
432434
ulong cons_cr_avail = (ulong)fd_long_max( (long)out_depth[ out_idx ]-fd_long_max( fd_seq_diff( out_seq[ out_idx ], cons_seq[ cons_idx ] ), 0L ), 0L );
433435

436+
/* If a reliable consumer exits, they can set the credit
437+
return fseq to STEM_SHUTDOWN_SEQ to indicate they are no
438+
longer actively consuming. */
439+
cons_cr_avail = fd_ulong_if( cons_seq[ cons_idx ]==STEM_SHUTDOWN_SEQ, out_depth[ out_idx ], cons_cr_avail );
434440
slowest_cons = fd_ulong_if( cons_cr_avail<min_cr_avail, cons_idx, slowest_cons );
435441

436442
cr_avail[ out_idx ] = fd_ulong_min( cr_avail[ out_idx ], cons_cr_avail );
@@ -783,7 +789,7 @@ STEM_(run)( fd_topo_t * topo,
783789
ulong fseq_id = tile->in_link_fseq_obj_id[ i ];
784790
ulong * fseq = fd_fseq_join( fd_topo_obj_laddr( topo, fseq_id ) );
785791
FD_TEST( fseq );
786-
fd_fseq_update( fseq, ULONG_MAX );
792+
fd_fseq_update( fseq, STEM_SHUTDOWN_SEQ );
787793
}
788794
}
789795
}

0 commit comments

Comments
 (0)