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

continue not worked when loop over sparse field #3271

Closed
g1n0st opened this issue Oct 26, 2021 · 0 comments
Closed

continue not worked when loop over sparse field #3271

g1n0st opened this issue Oct 26, 2021 · 0 comments
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@g1n0st
Copy link
Contributor

g1n0st commented Oct 26, 2021

Describe the bug

continue statement seems not to work when looping over the sparse field. The continue will jump out of the current loop and skip the whole activated block.

To Reproduce

import taichi as ti

ti.init(arch=ti.cuda, kernel_profiler = False)

n = 128
x = ti.field(ti.f32)
block = ti.root.pointer(ti.i, n // 16)
block.dense(ti.i, 16).place(x)

@ti.kernel 
def test():
    x[0] = 1
    x[1] = 2
    cnt = 0
    for i in x:
        if x[i] == 1: continue
        if x[i] == 2: cnt += 1
    print(cnt) # output 0

test()
@g1n0st g1n0st added the potential bug Something that looks like a bug but not yet confirmed label Oct 26, 2021
@k-ye k-ye closed this as completed Oct 26, 2021
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

No branches or pull requests

2 participants