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

Atomic add on SharedArray vector causes LLVM assertion #8456

Open
oliver-batchelor opened this issue Dec 28, 2023 · 2 comments
Open

Atomic add on SharedArray vector causes LLVM assertion #8456

oliver-batchelor opened this issue Dec 28, 2023 · 2 comments

Comments

@oliver-batchelor
Copy link
Contributor

Using an atomic add on a SharedArray vector causes the assertion below.
(May be related to #8435?)

> python bad_shared.py
[Taichi] version 1.7.0, llvm 15.0.4, commit 6a30b8dc, linux, python 3.10.11
[Taichi] Starting on arch=cuda
python: /home/ailzhang/github/llvm-project/llvm/lib/IR/Instructions.cpp:1647: void llvm::AtomicRMWInst::Init(llvm::AtomicRMWInst::BinOp, llvm::Value *, llvm::Value *, llvm::Align, llvm::AtomicOrdering, SyncScope::ID): Assertion `cast<PointerType>(getOperand(0)->getType()) ->isOpaqueOrPointeeTypeMatches(getOperand(1)->getType()) && "Ptr must be a pointer to Val type!"' failed.
[1]    28401 IOT instruction (core dumped)  python bad_shared.py

import taichi as ti

@ti.kernel
def foo():

  ti.loop_config(block_dim=64)
  for x in range(1000):
    shared = ti.simt.block.SharedArray((64, ), dtype=ti.math.vec3)
    shared[x % 64] = ti.math.vec3(0)
    ti.simt.block.sync()
    
    for i in range(64):
      ti.atomic_add(shared[i], ti.math.vec3(1))

ti.init(arch=ti.cuda)
foo()
@bobcao3
Copy link
Collaborator

bobcao3 commented Dec 28, 2023

Does float work in the shared array?

@oliver-batchelor
Copy link
Contributor Author

oliver-batchelor commented Dec 29, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Untriaged
Development

No branches or pull requests

2 participants