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

Parsing new expression uses incorrect variable when multiple are available #305

Closed
SamirDroubi opened this issue Jan 15, 2023 · 0 comments · Fixed by #306
Closed

Parsing new expression uses incorrect variable when multiple are available #305

SamirDroubi opened this issue Jan 15, 2023 · 0 comments · Fixed by #306
Assignees

Comments

@SamirDroubi
Copy link
Collaborator

======================================== FAILURES =========================================
_______________________________ test_new_expression_parsing _______________________________

    def test_new_expression_parsing():
        @proc
        def bar(n: size, arr: R[n] @ DRAM):
            for i in seq(0, n):
                tmp: R
                tmp = 1.0
                arr[i] = tmp
            i: R
            i = 1.0

>       expand_dim(
            bar, "tmp : _", "n", "i"
        )

tests/test_schedules.py:1604:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/exo/API_scheduling.py:101: in __call__
    return self.func(*bound_args.args, **bound_args.kwargs)
src/exo/API_scheduling.py:1147: in expand_dim
    CheckEffects(new_proc_c._loopir_proc)
src/exo/effectcheck.py:537: in __init__
    body_eff = self.map_stmts(self.orig_proc.body)
src/exo/effectcheck.py:1016: in map_stmts
    sub_body_eff = self.map_stmts(stmt.body)
src/exo/effectcheck.py:1044: in map_stmts
    self.check_bounds(stmt.name, shape, body_eff)
src/exo/effectcheck.py:791: in check_bounds
    self.check_in_bounds(sym, shape, e, y)
src/exo/effectcheck.py:775: in check_in_bounds
    e = self.expr_to_smt(e)
src/exo/effectcheck.py:612: in expr_to_smt
    return self.sym_to_smt(expr.name, expr.type)
src/exo/effectcheck.py:587: in sym_to_smt
    return self.env[sym]
/usr/lib/python3.9/collections/__init__.py:941: in __getitem__
    return self.__missing__(key)            # support subclasses that define __missing__
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = ChainMap({}, {i_3: i_3}, {n_1: n_1, arr_stride_0_7: arr_stride_0_7, tmp_stride_0_8: tmp_stride_0_8}, {})
key = i_5

    def __missing__(self, key):
>       raise KeyError(key)
E       KeyError: i_5

/usr/lib/python3.9/collections/__init__.py:933: KeyError
================================= short test summary info =================================
FAILED tests/test_schedules.py::test_new_expression_parsing - KeyError: i_5
==================================== 1 failed in 0.19s ====================================

During parsing, variable i_5 is captured as the variable i from the new expression. However, this is the variable i outside the loop definition.

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