Skip to content

Improve bitwidth optimization for FTD circuits#959

Draft
AyaElAkhras wants to merge 2 commits into
mainfrom
isolate-bitwidth-constant-changes
Draft

Improve bitwidth optimization for FTD circuits#959
AyaElAkhras wants to merge 2 commits into
mainfrom
isolate-bitwidth-constant-changes

Conversation

@AyaElAkhras

@AyaElAkhras AyaElAkhras commented Jun 3, 2026

Copy link
Copy Markdown
Member

The existing bitwidth optimization implementation does not work well for FTD-generated circuits, particularly when constants and branch-bound information flow through FTD mux structures.

This PR adds a new handshake-minimize-cst-width pass that rewrites Handshake constants to the minimum required integer bitwidth and inserts extension operations to preserve user-facing types.

It also updates handshake-optimize-bitwidths to:

  • Share constant-width computation utilities with the new pass.
  • Improve bitwidth propagation through muxes and conditional branch bounds.
  • Better handle the mux structures generated by FTD.

@AyaElAkhras AyaElAkhras closed this Jun 3, 2026
@AyaElAkhras AyaElAkhras reopened this Jun 3, 2026
@AyaElAkhras AyaElAkhras marked this pull request as draft June 3, 2026 01:32
@AyaElAkhras AyaElAkhras changed the title Add constant bitwidth minimization Improve bitwidth optimization for FTD circuits Jun 3, 2026
@Jiahui17

Jiahui17 commented Jun 5, 2026

Copy link
Copy Markdown
Member

What's the relation between this change and #816?

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.

2 participants