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

Experimental Inline Pass #1153

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

mroethlin
Copy link
Contributor

@mroethlin mroethlin commented Aug 10, 2021

DO NOT MERGE, HAS CONCEPTUAL ISSUES

Technical Description

The inlining pass present in dawn (PassInlining) is not designed to inline computations within stencils, but inlines stencil functions. It is also untested. This PR is a proof of concept a simple inlining pass that argues over computations within a single stencil scope. It performs one time temporary inlining if and only if the result is story into temporary field or var that is only written to once.

Example

def subseq(inF: Field[Cell], outF: Field[Vertex]):
  tempF: Field[Edge]
  with domain.upward:
    tempF = sum_over(Edge > Cell, inF)   
    outF = sum_over(Vertex > Edge, tempF)

is inlined to

def subseq(inF: Field[Cell], outF: Field[Vertex]):
  with domain.upward:
    outF = sum_over(Vertex > Edge, sum_over(Edge > Cell, inF))

No attempt is made to inline e.g.

def subseq(inF: Field[Cell], outF: Field[Vertex]):
  tempF: Field[Edge]
  with domain.upward:
    tempF = sum_over(Edge > Cell, inF)   
    tempF = tempF + 1 
    outF = sum_over(Vertex > Edge, tempF)

Testing

Two tests reflecting the examples above are introduced.

Dependencies

This PR is independent.

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