Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic block merging threshold #1461

Merged
merged 5 commits into from
Aug 21, 2024
Merged

Conversation

plafer
Copy link
Contributor

@plafer plafer commented Aug 20, 2024

Adds a threshold when merging basic blocks after which we won't merge more blocks in.

Benchmarks for 2 different values (quite similar):

  • on branch next:
    • deserialize_std_lib: 14.6ms
    • stdlib compilation: 120ms
  • MAX_OPERATIONS_PER_BASIC_BLOCK_WHEN_MERGING = 1000:
    • deserialize_std_lib: 3.4 ms
    • stdlib compilation: 62 ms
  • MAX_OPERATIONS_PER_BASIC_BLOCK_WHEN_MERGING = 2500:
    • deserialize_std_lib: 4.8ms
    • stdlib compilation: 65ms

Note that deserialize_std_lib time is directly proportional to the size of the stdlib serialized binary. So with the constant at 1000 or 2500, it roughly halves the size of the binary (i.e. ~0.6MB).

@plafer plafer added the assembly Related to Miden assembly label Aug 20, 2024
@plafer plafer requested a review from bobbinth August 20, 2024 20:24
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

I updated the methodology used for merging. In terms of the binary size, the new approach is roughly equivalent to the the 2500 threshold in the old one. But I'm hoping it will result in smaller runtime penalties. Curious what you think though.

@bobbinth bobbinth merged commit 8030370 into next Aug 21, 2024
9 checks passed
@bobbinth bobbinth deleted the plafer-basic-block-combine-threshold branch August 21, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assembly Related to Miden assembly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants