Skip to content

off_grid_tasklet

ExtractOffGridTasklet

Bases: ScheduleNodeVisitor

Gather all off-grid nodes and store them at the top of the Schedule Tree like a C style declarative process.

Dev note: this pass functions because we keep the nodes in order the entire time, keeping any dependency on each other correct.

We move tasklet if all its writes have been SSA properly.

The pass will not apply within cartesian blocks.

InlineOffGridTasklet

Bases: ScheduleNodeVisitor

Move the off-grid tasklet as-close-as possible to their first usage but outside of any grid tight loop, e.g. C++ optimization style.

Dev note: movement need to be made in reverse order so we can keep any dependency on each other tasklet correct e.g. in

A = tasklet()
B = tasklet(A)
...
map _i
    C = tasklet(B, filed[_i])
B needs to be move first against map_i then, A in before B

OffGridTransientScalarSSA

Bases: ScheduleNodeVisitor

Transform all off-grid transient scalar through SSA without Phi functions, e.g.

    A = tasklet()
    if A:
        f0 = tasklet(A, ...)
    A = tasklet()
    if A:
        f1 = tasklet(A, ...)
becomes
    A = tasklet()
    if A:
        f0 = tasklet(A, ...)
    A_0 = tasklet()
    if A_0:
        f1 = tasklet(A_0, ...)
but when we have
A = tasklet()
if B:
    A = tasklet(...)
if C:
    A = tasklet(...)
D = tasklet(A)
we do keep A throughout (this is solvable by introducing a phi function for D =tasklet(phi(A))) which would capture the control flow above and replicate it.

Because we do not address the Phi function problem this pass will not yield a perfect SSA IR for transient scalars. Use OffGridTransientScalarWriteCounter afterward to map results.

The pass will not apply SSA within cartesian blocks, but will keep read renaming going.