Skip to content

Adding SCF support to AutomaticReferenceCountingPass.#22813

Merged
benvanik merged 1 commit intomainfrom
users/benvanik/arc-scf
Jan 13, 2026
Merged

Adding SCF support to AutomaticReferenceCountingPass.#22813
benvanik merged 1 commit intomainfrom
users/benvanik/arc-scf

Conversation

@benvanik
Copy link
Collaborator

@benvanik benvanik commented Dec 3, 2025

Adds comprehensive support for SCF control flow ops (scf.for, scf.if, scf.while) to the pass.

  • ScopedTimepointCoverage: Replaces LocalTimepointCoverage with scope-aware timepoint tracking that properly handles nested regions and control flow
  • SCF op handlers: analyzeForLoop, analyzeIfOp, analyzeWhileOp that correctly track resources across region boundaries
  • Resource yield prevention: Ensures resources captured by control flow regions are properly handled to prevent use-after-free
  • Cross-scope timepoint coverage: Joins timepoints at scope boundaries for correct deallocation ordering

The pass now properly handles programs with SCF control flow instead of bailing out when any SCF ops are present in a function.

(most of this was authored with claude)

@benvanik benvanik requested a review from AWoloszyn December 3, 2025 18:27
@benvanik benvanik added the compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm) label Dec 3, 2025
@benvanik benvanik force-pushed the users/benvanik/arc-scf branch from 6f4b866 to 335e133 Compare December 3, 2025 22:22
@benvanik benvanik force-pushed the users/benvanik/elide-update branch from adb4057 to fb7d0a4 Compare December 3, 2025 22:54
@benvanik benvanik force-pushed the users/benvanik/arc-scf branch from 335e133 to 102c67c Compare December 3, 2025 22:54
@benvanik benvanik marked this pull request as ready for review December 4, 2025 07:04
@benvanik benvanik force-pushed the users/benvanik/arc-scf branch from 102c67c to b5987fc Compare December 5, 2025 16:51
@benvanik benvanik force-pushed the users/benvanik/elide-update branch from fb7d0a4 to 2d679e9 Compare December 5, 2025 16:51
@benvanik benvanik force-pushed the users/benvanik/elide-update branch from 2d679e9 to db89706 Compare January 12, 2026 20:07
@benvanik benvanik force-pushed the users/benvanik/arc-scf branch from b5987fc to 245e2a3 Compare January 12, 2026 20:08
Base automatically changed from users/benvanik/elide-update to main January 12, 2026 21:28
Adds comprehensive support for SCF control flow ops (scf.for, scf.if,
scf.while) to the pass.

- ScopedTimepointCoverage: Replaces LocalTimepointCoverage with scope-aware
  timepoint tracking that properly handles nested regions and control flow
- SCF op handlers: analyzeForLoop, analyzeIfOp, analyzeWhileOp that correctly
  track resources across region boundaries
- Resource yield prevention: Ensures resources captured by control flow regions
  are properly handled to prevent use-after-free
- Cross-scope timepoint coverage: Joins timepoints at scope boundaries for
  correct deallocation ordering

The pass now properly handles programs with SCF control flow instead of bailing
out when any SCF ops are present in a function.
@benvanik benvanik force-pushed the users/benvanik/arc-scf branch from 245e2a3 to ebbc387 Compare January 12, 2026 21:29
@benvanik benvanik merged commit 57cf6d7 into main Jan 13, 2026
56 of 57 checks passed
@benvanik benvanik deleted the users/benvanik/arc-scf branch January 13, 2026 01:13
amd-eochoalo added a commit that referenced this pull request Jan 19, 2026
These tests have been failing since
#22813 . An issue has been filed in
#23189
@amd-eochoalo
Copy link
Contributor

@benvanik can you take a look at #23189 whenever you have the chance. Some tests started failing with this PR. Thanks!

keshavvinayak01 pushed a commit that referenced this pull request Jan 27, 2026
Adds comprehensive support for SCF control flow ops (scf.for, scf.if,
scf.while) to the pass.

- ScopedTimepointCoverage: Replaces LocalTimepointCoverage with
scope-aware timepoint tracking that properly handles nested regions and
control flow
- SCF op handlers: analyzeForLoop, analyzeIfOp, analyzeWhileOp that
correctly track resources across region boundaries
- Resource yield prevention: Ensures resources captured by control flow
regions are properly handled to prevent use-after-free
- Cross-scope timepoint coverage: Joins timepoints at scope boundaries
for correct deallocation ordering

The pass now properly handles programs with SCF control flow instead of
bailing out when any SCF ops are present in a function.

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
keshavvinayak01 pushed a commit that referenced this pull request Jan 27, 2026
These tests have been failing since
#22813 . An issue has been filed in
#23189

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants