Skip to content

Commit d261143

Browse files
committed
pack: adjust CU pacing
1 parent 2a96115 commit d261143

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/disco/pack/fd_pack_pacing.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct fd_pack_pacing_private {
1515
long t_start;
1616
long t_end;
1717
/* Number of CUs in the block */
18-
ulong max_cus;
18+
float max_cus;
1919

2020
float ticks_per_cu;
2121
float remaining_cus;
@@ -36,15 +36,19 @@ fd_pack_pacing_init( fd_pack_pacing_t * pacer,
3636
ulong max_cus ) {
3737

3838
pacer->t_start = t_start;
39-
pacer->t_end = t_end - (long)((t_end-t_start)/20L); /* try to finish 95% of the way through */
40-
pacer->max_cus = max_cus;
39+
pacer->t_end = t_end;
4140

4241
/* Time per CU depends on the hardware, the transaction mix, what
4342
fraction of the transactions land, etc. It's hard to just come up
44-
with a value, but a small sample says 8 ns/CU is in the right
43+
with a value, but a small sample says 9 ns/CU is in the right
4544
ballpark. */
46-
pacer->ticks_per_cu = 8.0f * ticks_per_ns;
47-
pacer->remaining_cus = (float)max_cus;
45+
pacer->ticks_per_cu = 9.0f * ticks_per_ns;
46+
47+
/* Originally, we had all the lines ending 5% before t_end, but the
48+
better thing to do is to adjust max_cus up so that the 1 bank line
49+
ends 5% before t_end. */
50+
pacer->max_cus = (float)max_cus + 0.05f * (float)(t_end-t_start)/pacer->ticks_per_cu;
51+
pacer->remaining_cus = pacer->max_cus;
4852
}
4953

5054
/* fd_pack_pacing_update_consumed_cus notes that the instantaneous value
@@ -61,7 +65,7 @@ fd_pack_pacing_update_consumed_cus( fd_pack_pacing_t * pacer,
6165
(void)now;
6266
/* It's possible (but unlikely) that consumed_cus can be greater than
6367
max_cus, so clamp the value at 0 */
64-
pacer->remaining_cus = (float)(fd_ulong_max( pacer->max_cus, consumed_cus ) - consumed_cus);
68+
pacer->remaining_cus = fmaxf( pacer->max_cus-(float)consumed_cus, 0.0f );
6569
}
6670

6771

@@ -78,10 +82,11 @@ fd_pack_pacing_enabled_bank_cnt( fd_pack_pacing_t const * pacer,
7882
milliseconds. That way we pass up the best transaction because it
7983
conflicts with something actively running as infrequently as
8084
possible. To do that, we draw lines through in the time-CU plane
81-
that pass through (400 milliseconds, 48M CUs) with slope k*(single
82-
bank speed), where k varies between 1 and the number of bank tiles
83-
configured. This splits the plane into several regions, and the
84-
region we are in tells us how many bank tiles to use.
85+
that pass through approximately (400 milliseconds, 48M CUs) with
86+
slope k*(single bank speed), where k varies between 1 and the
87+
number of bank tiles configured. This splits the plane into
88+
several regions, and the region we are in tells us how many bank
89+
tiles to use.
8590
8691
8792
48M - / /|

0 commit comments

Comments
 (0)