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

LoopToMap followed by simplify leads to out-of-bounds memlets #1372

Open
Sajohn-CH opened this issue Sep 21, 2023 · 0 comments · May be fixed by #1461
Open

LoopToMap followed by simplify leads to out-of-bounds memlets #1372

Sajohn-CH opened this issue Sep 21, 2023 · 0 comments · May be fixed by #1461

Comments

@Sajohn-CH
Copy link
Contributor

Describe the bug
Creating a simple SDFG from fortran and applying the LoopToMap transformation and then simplifying it leads to an invalid SDFG as memlets are out-of-bounds.

To Reproduce
Steps to reproduce the behavior:

  1. Paste the following code into a file
from dace.frontend.fortran import fortran_parser
from dace.transformation.interstate import LoopToMap


def main():
    code = """
    PROGRAM foo
        IMPLICIT NONE
        REAL INP1(NBLOCKS, KLEV)
        INTEGER, PARAMETER  :: KLEV = 137
        INTEGER, PARAMETER  :: NBLOCKS = 8


        CALL foo_test_function(NBLOCKS, KLEV, INP1)

    END PROGRAM

    SUBROUTINE foo_test_function(NBLOCKS, KLEV, INP1)
        INTEGER, PARAMETER  :: KLEV = 137
        INTEGER, PARAMETER  :: NBLOCKS = 1
        REAL INP1(NBLOCKS, KLEV)

        DO JN=1,NBLOCKS
            DO JK=1,KLEV
                INP1(JN, JK) = (JN-1) * KLEV + (JK-1)
            ENDDO
        ENDDO
    END SUBROUTINE foo_test_function
    """

    sdfg = fortran_parser.create_sdfg_from_string(code, "test_loop_map_parallel")
    sdfg.simplify()
    sdfg.apply_transformations_repeated([LoopToMap])
    sdfg.simplify()


if __name__ == '__main__':
    main()
  1. Execute it

Expected behavior
Get a valid SDFG

@lukastruemper lukastruemper pinned this issue Nov 29, 2023
@lukastruemper lukastruemper unpinned this issue Nov 29, 2023
@tbennun tbennun linked a pull request Nov 30, 2023 that will close this issue
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 a pull request may close this issue.

1 participant