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

[ScfToCf] Signedness-aware scf::ForOp lowering #38

Merged
merged 1 commit into from
Sep 18, 2023
Merged

Conversation

lucas-rami
Copy link
Member

This introduces a new conversion pass to Dynamatic++ (--lower-scf-to-cf) that is almost identical to the upstream --convert-scf-to-cf pass, which, as its name indicates, converts scf operations to unstructured control flow (cf). The only difference between the two is that the scf::ForOp rewrite pattern used in our pass (which overwrites the default one) inserts an unsigned comparison operation for checking whether the loop iterator is within the for loop's bounds instead of a signed one if it can prove that both the iterator and upper bound are guaranteed to be positive. The estimation relies on the recently introduced numerical analysis. This has a performance impact down-the-line during bitwidth analysis.

Fixes #28.

@lucas-rami lucas-rami merged commit 8db32e6 into main Sep 18, 2023
@lucas-rami lucas-rami deleted the lower-for-ops branch December 27, 2023 10:32
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.

[OptimizeBitwidths] Make the scf::ForOp lowering create unsigned comparisons when possible
1 participant