Skip to content

stage_mem window aliasing #784

@kehemo

Description

@kehemo

stage_mem does not consider windows which alias with the buffer that is being staged.

@proc
def foo(a: i32[16]):
    c = a[2:6]
    for i in seq(0, 4):
        c[i] += 1
        a[i + 2] += c[i]
stage_mem(foo, foo.find('for i in _: _'), 'a[2:6]', 'b')

outputs:

def foo(a: i32[16] @ DRAM):
    c = a[2:6]
    b: i32[6 - 2] @ DRAM
    for i0 in seq(0, 6 - 2):
        b[i0] = a[i0 + 2]
    for i in seq(0, 4):
        c[i] += 1
        b[i + 2 - 2] += c[i]
    for i0 in seq(0, 6 - 2):
        a[i0 + 2] = b[i0]

which is not equivalent to the original procedure because the write to c[i] aliases with the staged window b.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: Prog AnalysisRelated to formal analysis, SMT, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions