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

[BUG] Tuple not supported in dataflow analysis #114

Open
zzzDavid opened this issue Nov 27, 2023 · 0 comments
Open

[BUG] Tuple not supported in dataflow analysis #114

zzzDavid opened this issue Nov 27, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@zzzDavid
Copy link
Contributor

Describe the bug
Issue with use-def analysis for functions with multiple return values.

To Reproduce

def callee(a: float32, b: float32) -> (float32, float32):
    c: float32 = a   b
    d: float32 = a - b
    return c, d

def kernel(A: float32[10], B: float32[10]) -> (float32[10], float32[10]):
    C: float32[10] = 0
    D: float32[10] = 0
    for i in range(10):
        C[i], D[i] = callee(A[i], B[i])
    return C, D

s = allo.customize(kernel)
print(s.module)

Buggy output

Traceback (most recent call last):
  File "test_builder.py", line 556, in <module>
    non_tensor_args()
  File "test_builder.py", line 545, in non_tensor_args
    s = allo.customize(kernel)
  File "/work/shared/users/phd/nz264/allo/allo/customize.py", line 826, in customize
    use_def_chain.visit(tree)
  File "/home/nz264/anaconda3/envs/mlir/lib/python3.8/ast.py", line 371, in visit
    return visitor(node)
  File "/work/shared/users/phd/nz264/allo/allo/ir/use_def.py", line 282, in visit_Module
    res.append(self.visit(stmt))
  File "/home/nz264/anaconda3/envs/mlir/lib/python3.8/ast.py", line 371, in visit
    return visitor(node)
  File "/work/shared/users/phd/nz264/allo/allo/ir/use_def.py", line 270, in visit_FunctionDef
    res.append(self.visit(stmt))
  File "/home/nz264/anaconda3/envs/mlir/lib/python3.8/ast.py", line 371, in visit
    return visitor(node)
  File "/work/shared/users/phd/nz264/allo/allo/ir/use_def.py", line 137, in visit_For
    res.append(self.visit(stmt))
  File "/home/nz264/anaconda3/envs/mlir/lib/python3.8/ast.py", line 371, in visit
    return visitor(node)
  File "/work/shared/users/phd/nz264/allo/allo/ir/use_def.py", line 212, in visit_Assign
    name = get_name(node.targets[0])
  File "/work/shared/users/phd/nz264/allo/allo/ir/use_def.py", line 210, in get_name
    return get_name(subnode.value)
AttributeError: 'Tuple' object has no attribute 'value'
@zzzDavid zzzDavid added the bug Something isn't working label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants