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

arch dx11 the atomic_add not working #6122

Open
mgttt opened this issue Sep 21, 2022 · 0 comments
Open

arch dx11 the atomic_add not working #6122

mgttt opened this issue Sep 21, 2022 · 0 comments
Assignees
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@mgttt
Copy link

mgttt commented Sep 21, 2022

here is the testing code

from time import time as now

import taichi as ti
#ti.init(arch=ti.gpu) # ok for normal gpu but failed for directx
ti.init(arch=ti.dx11) # not ok
#ti.init(arch=ti.cpu) #ok
#ti.init()

ext_arr = ti.types.ndarray

@ti.kernel
def ti_test1(a:ext_arr(),b:ext_arr()):
  for I in ti.grouped(a): ti.atomic_add(b[I.sum()],a[I])
  
a = np.random.rand(3,4,5).astype(np.float32)
print('a',a)
b = np.zeros((sum(a.shape),),dtype=np.float32)
print('b',b)
print(a[1,1,1])
t1=now()
ti_test1(a,b)
ti.sync()
t2=now()
#print(a[1,1,1])
print('t2-t1',t2-t1)
print(b)
print(a.sum(),b.sum())

# should pass:
assert abs(a.sum()-b.sum())<0.001

@mgttt mgttt added the potential bug Something that looks like a bug but not yet confirmed label Sep 21, 2022
@taichi-gardener taichi-gardener moved this to Untriaged in Taichi Lang Sep 21, 2022
@turbo0628 turbo0628 moved this from Untriaged to Backlog in Taichi Lang Sep 23, 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: Backlog
Development

No branches or pull requests

2 participants