Skip to content

pack, poh: use a dynamic microblock bound#9065

Merged
jherrera-jump merged 1 commit intofiredancer-io:mainfrom
jherrera-jump:jherrera/poh-fix-max-microblocks
Apr 2, 2026
Merged

pack, poh: use a dynamic microblock bound#9065
jherrera-jump merged 1 commit intofiredancer-io:mainfrom
jherrera-jump:jherrera/poh-fix-max-microblocks

Conversation

@jherrera-jump
Copy link
Copy Markdown
Contributor

@jherrera-jump jherrera-jump commented Mar 27, 2026

closes #8989

Problem

pack's slot_done message arrives at POH at 350ms after slot start. At this point POH still has to do ~130K hashes, which takes 4-5ms.

Solution

By reducing the microblock bound over the course of the slot (and eventually to 1/3 of the remaining budget at the end of the slot), we should be able to cut this down to ~1-2ms. 1/3 is probably a bit conservative and we could go lower but I think it's a good starting point.

@jherrera-jump jherrera-jump force-pushed the jherrera/poh-fix-max-microblocks branch 2 times, most recently from 1a70176 to 73be6f8 Compare March 27, 2026 18:22
@jherrera-jump jherrera-jump requested a review from Copilot March 27, 2026 18:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a dynamically tightening upper bound on the total number of microblocks expected in a leader slot, computed by pack and forwarded along the microblock pipeline so PoH can reduce its remaining-microblock estimate as the slot elapses.

Changes:

  • Add max_microblocks_in_slot to microblock trailers and forward it from pack → (execle|bank) → PoH.
  • Implement dynamic microblock budgeting in fd_pack_tile based on elapsed slot wallclock time and enforce a monotonically decreasing bound.
  • Add PoH-side API to update/tighten max_microblocks_per_slot using the forwarded bound.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/disco/pack/fd_pack_tile.c Computes/maintains a decreasing per-slot dynamic microblock cap and forwards it in the execle trailer.
src/disco/tiles.h Extends microblock trailers with max_microblocks_in_slot for forwarding across tiles.
src/discof/execle/fd_execle_tile.c Propagates the dynamic bound from pack trailer into the PoH-facing trailer.
src/discoh/bank/fd_bank_tile.c Propagates the dynamic bound from pack trailer into the PoH-facing trailer (Frankendancer path).
src/discof/poh/fd_poh_tile.c Consumes the forwarded bound on each microblock and calls the new PoH update API.
src/discof/poh/fd_poh.h Declares fd_poh_update_max_microblocks.
src/discof/poh/fd_poh.c Implements fd_poh_update_max_microblocks to adjust PoH’s microblock upper bound.

Comment thread src/discof/poh/fd_poh.c
Comment thread src/disco/tiles.h Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/disco/pack/fd_pack_tile.c Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/discoh/bank/fd_bank_tile.c Outdated
Comment on lines +138 to +142
ctx->_bank = trailer->bank;
ctx->_pack_idx = trailer->pack_idx;
ctx->_txn_idx = trailer->pack_txn_idx;
ctx->_is_bundle = trailer->is_bundle;
ctx->_is_bundle = trailer->is_bundle;
ctx->_max_microblocks_in_slot = trailer->max_microblocks_in_slot;
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this assignment block, only the last two lines were realigned, leaving the earlier assignments (_bank, _pack_idx, _txn_idx) with different spacing. Consider aligning all of these related assignments consistently to keep the block readable and avoid future diffs that only change whitespace.

Copilot uses AI. Check for mistakes.
@jherrera-jump jherrera-jump marked this pull request as ready for review March 27, 2026 22:05
@mmcgee-jump
Copy link
Copy Markdown
Contributor

Reasonable but I don't think the math here is great, you probably want like a y = - x^1.5 or something curve on the pacing that hits 0 microblocks remaining right at end of slot? But you get the rapid decay closer to the end. Check with Philip might have good ideas.

Copy link
Copy Markdown
Contributor

@mmcgee-jump mmcgee-jump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@jherrera-jump jherrera-jump force-pushed the jherrera/poh-fix-max-microblocks branch from 5af0479 to 8887aff Compare March 31, 2026 22:47
Copilot AI review requested due to automatic review settings March 31, 2026 22:51
@jherrera-jump jherrera-jump force-pushed the jherrera/poh-fix-max-microblocks branch from 8887aff to 0d73137 Compare March 31, 2026 22:51
@jherrera-jump jherrera-jump marked this pull request as draft March 31, 2026 22:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Comment thread src/discoh/bank/fd_bank_tile.c
Comment thread src/discoh/bank/fd_bank_tile.c Outdated
Comment thread src/discoh/bank/fd_bank_tile.c Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

@jherrera-jump jherrera-jump marked this pull request as ready for review April 1, 2026 17:32
Comment thread src/disco/pack/fd_pack_tile.c Outdated
Comment thread src/disco/pack/fd_pack_tile.c
Comment thread src/disco/pack/fd_pack_tile.c Outdated
Comment thread src/discof/execle/fd_execle_tile.c Outdated
@jherrera-jump jherrera-jump force-pushed the jherrera/poh-fix-max-microblocks branch from f211ccb to 7840a9b Compare April 1, 2026 22:59
Copilot AI review requested due to automatic review settings April 1, 2026 23:00
@jherrera-jump jherrera-jump force-pushed the jherrera/poh-fix-max-microblocks branch from 7840a9b to 3371ecc Compare April 1, 2026 23:00
@jherrera-jump jherrera-jump force-pushed the jherrera/poh-fix-max-microblocks branch from 3371ecc to 8a78b9f Compare April 1, 2026 23:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/discof/poh/fd_poh_tile.c
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@ptaffet-jump ptaffet-jump dismissed mmcgee-jump’s stale review April 2, 2026 20:25

I reviewed the newer version.

@jherrera-jump jherrera-jump merged commit d516164 into firedancer-io:main Apr 2, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

block duration always late by ~10ms

4 participants