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

Missing validation for memlet symbolic subset expression #1418

Open
BenWeber42 opened this issue Oct 31, 2023 · 0 comments
Open

Missing validation for memlet symbolic subset expression #1418

BenWeber42 opened this issue Oct 31, 2023 · 0 comments

Comments

@BenWeber42
Copy link
Contributor

BenWeber42 commented Oct 31, 2023

Currently, validation does not check whether the symbolic subset expressions of memlets don't contain array accesses. Such a case is invalid and should throw a validation error. See this testcase:

def test_memlet_subset_validation_bug():
    sdfg = dace.SDFG("test")

    sdfg.add_array("A", shape=(5, ), dtype=dace.int32)
    sdfg.add_array("B", shape=(5, ), dtype=dace.int32)
    sdfg.add_array("indirection", shape=(5, ), dtype=dace.int32)

    state = sdfg.add_state("start", is_start_state=True)
    access_A = state.add_access("A")
    access_B = state.add_access("B")
    memlet = state.add_edge(access_A, "A", access_B, None, dace.Memlet("A[0]"))

    # This is invalid SDFG as we are not allowed to use other arrays as subset expressions!
    memlet.data.subset = subsets.Range([("indirection[0]", "indirection[0]", "1")])

    # FIXME: we don't seem to have an appropriate type for memlet errors?
    with pytest.raises(Exception):
        sdfg.validate()

    # This must also work if the array is doesn't exist
    memlet.data.subset = subsets.Range([("undeclared_array[0]", "undeclared_array[0]", "1")])

    # FIXME: we don't seem to have an appropriate type for memlet errors?
    with pytest.raises(Exception):
        sdfg.validate()

The full testcase is available here: https://github.com/BenWeber42/dace/blob/060d873a7609633752b6f3bf3f7687b1b6d51506/tests/memlet_subset_validation_bug_test.py

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

No branches or pull requests

1 participant