Skip to content

Fix forward mode AD for for-like ops#2780

Open
vimarsh6739 wants to merge 2 commits intomainfrom
scf.for-fix2
Open

Fix forward mode AD for for-like ops#2780
vimarsh6739 wants to merge 2 commits intomainfrom
scf.for-fix2

Conversation

@vimarsh6739
Copy link
Copy Markdown
Member

@vimarsh6739 vimarsh6739 commented Apr 8, 2026

This primarily affects scf.for and affine.for, but should also handle a the same case in scf.parallel and affine.parallel ops (iter-arg is a constant/dead inside loop but terminators still have activity).

Aside: I think one interesting thing we can do here is to reuse the successor information to effectively eliminate the creation of some dead regions. This already kind of happens in scf.for which prunes the entry successors depending on if the loop has no iterations, or non-zero trip count(e.g. if the only entry successor is the parent, then just skip diffing the regionBranchOp body).

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.

1 participant