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

strange behavior using atomic operation with snode on cuda #5142

Closed
yhesper opened this issue Jun 13, 2022 · 0 comments · Fixed by #5161
Closed

strange behavior using atomic operation with snode on cuda #5142

yhesper opened this issue Jun 13, 2022 · 0 comments · Fixed by #5161
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@yhesper
Copy link

yhesper commented Jun 13, 2022

Describe the bug
Using atomic_min when looping through snode gives wrong result on cuda.

To Reproduce

import taichi as ti

ti.init(arch=ti.gpu)

x = ti.field(ti.f32)
block = ti.root.pointer(ti.ij, (1000,1))
pixel = block.dense(ti.ij, (1,1))
pixel.place(x)

@ti.kernel
def test():
    hit_time = 1000.0
    x[100, 0] = 1.0
    x[200, 0] = 2.0
    for i,j in x:
        # print(hit_time, i, j, x[i,j])
        # hit_time += 0.0
        ti.atomic_min(hit_time, x[i,j])
    print(hit_time)

test()

Log/Screenshots
The above program should print 1.0. However, it will print 0.0 if we don't uncomment one of the commented lines. This seems to only happen when arch is cuda.

@yhesper yhesper added the potential bug Something that looks like a bug but not yet confirmed label Jun 13, 2022
@taichi-ci-bot taichi-ci-bot moved this to Untriaged in Taichi Lang Jun 13, 2022
Repository owner moved this from Untriaged to Done in Taichi Lang Jun 14, 2022
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
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant