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

Behavior of break in the outermost for different from the documentation #4238

Closed
lin-hitonami opened this issue Feb 8, 2022 · 0 comments · Fixed by #4447
Closed

Behavior of break in the outermost for different from the documentation #4238

lin-hitonami opened this issue Feb 8, 2022 · 0 comments · Fixed by #4447
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@lin-hitonami
Copy link
Contributor

lin-hitonami commented Feb 8, 2022

Describe the bug
According to the documentation, only the for loop at the outermost scope is parallelized, and the outermost for loop not at the outermost scope is not parallelized, and parallelized for loops cannot be broken. However, according to my test, error raises when breaking the outermost for loop that is not at the outermost scope.

To Reproduce

import taichi as ti
ti.init()

@ti.kernel
def foo(k: ti.i32):
    if k > 42:
        for i in range(10):
            break

foo(1)

Log/Screenshots
Please post the full log of the program (instead of just a few lines around the error message, unless the log is > 1000 lines). This will help us diagnose what's happening. For example:

Traceback (most recent call last):
  File "test.py", line 10, in <module>
    foo(1)
  File "/Users/lin/taichi/python/taichi/lang/kernel_impl.py", line 736, in wrapped
    return primal(*args, **kwargs)
  File "/Users/lin/taichi/python/taichi/lang/kernel_impl.py", line 667, in __call__
    return self.compiled_functions[key](*args)
  File "/Users/lin/taichi/python/taichi/lang/kernel_impl.py", line 619, in func__
    t_kernel(launch_ctx)
RuntimeError: [ir.h:as@225] Assertion failure: is<T>()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug Something that looks like a bug but not yet confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant