Skip to content

Conversation

weinbe58
Copy link
Member

@weinbe58 weinbe58 commented Sep 15, 2025

This PR packages the current scf.unroll rewrite rules into a pass to be used to try and unroll the scf.

The usage:

from kirin. passes.aggressive import UnrollScf
UnrollScf(dialects).fixpoint(method)

For a single application, this pass unrolls the top-level of scf nodes in the method body. Therefore, to unroll nested SCF you must apply this in a fixpoint way.

The modification if removing terminate in the UnrollFor rewrite rule fixes issue #475 because now this Pass fixpoint should be over the depth of the nesting, not the number of iterations.

@weinbe58 weinbe58 linked an issue Sep 15, 2025 that may be closed by this pull request
@weinbe58 weinbe58 requested a review from Roger-luo September 15, 2025 18:26
Copy link
Contributor

github-actions bot commented Sep 15, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-09-17 15:27 UTC

Copy link

codecov bot commented Sep 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Sep 15, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
10475 9416 90% 0% 🟢

New Files

File Coverage Status
src/kirin/passes/aggressive/unroll.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
src/kirin/dialects/scf/unroll.py 83% 🟢
src/kirin/passes/aggressive/_init_.py 100% 🟢
TOTAL 91% 🟢

updated for commit: 074df6a by action🐍

@Roger-luo Roger-luo merged commit c10bf3c into main Sep 17, 2025
13 checks passed
@Roger-luo Roger-luo deleted the phil/475-non-fixpoint-based-unroll-rewrite branch September 17, 2025 15:26
weinbe58 added a commit that referenced this pull request Sep 17, 2025
This PR packages the current `scf.unroll` rewrite rules into a pass to
be used to try and unroll the scf.

The usage:

```python
from kirin. passes.aggressive import UnrollScf
UnrollScf(dialects).fixpoint(method)
```

For a single application, this pass unrolls the top-level of scf nodes
in the method body. Therefore, to unroll nested SCF you must apply this
in a fixpoint way.

The modification if removing `terminate` in the UnrollFor rewrite rule
fixes issue #475 because now this Pass fixpoint should be over the depth
of the nesting, not the number of iterations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-fixpoint based Unroll Rewrite
2 participants