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

[RTG][Elaboration] Add support for 'scf.if' and 'scf.for' #7986

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

maerhart
Copy link
Member

Did a quick profile of the following input:

func.func @dummy(%arg0: index) -> () {return}

rtg.test @test : !rtg.dict<> {
  %0 = index.constant 0
  %1 = index.constant 1
  %2 = index.constant 10000000
  %3 = index.constant 2
  %4 = scf.for %i = %0 to %2 step %1 iter_args(%a = %0) -> (index) {
    %5 = index.add %a, %3
    scf.yield %5 : index
  }
  func.call @dummy(%4) : (index) -> ()
}

Currently takes ~5.4 sec on my machine, with most of the time spent internalizing the intermediate integers.
Will follow-up with a PR that refactors the ElaboratorValue to only internalize complex values such as sets and bags, but not primitive integers.

Copy link
Contributor

@darthscsi darthscsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I think maybe we can be a bit simpler for some of the structure rewriting, but I'm not going to push on that right now.

lib/Dialect/RTG/Transforms/ElaborationPass.cpp Outdated Show resolved Hide resolved
lib/Dialect/RTG/Transforms/ElaborationPass.cpp Outdated Show resolved Hide resolved
@maerhart maerhart force-pushed the maerhart-rtg-elaboration-indexops branch from eda599f to 83c12d2 Compare January 14, 2025 21:00
Base automatically changed from maerhart-rtg-elaboration-indexops to main January 14, 2025 21:51
@maerhart maerhart force-pushed the maerhart-rtg-elaboration-scfif branch from c387cd7 to d4fa31c Compare January 17, 2025 11:23
@maerhart maerhart merged commit 76cc791 into main Jan 17, 2025
5 checks passed
@maerhart maerhart deleted the maerhart-rtg-elaboration-scfif branch January 17, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RTG Involving the `rtg` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants