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

Assertion in C++ triggered by trying to use field of Shared mem vector #8435

Closed
oliver-batchelor opened this issue Dec 13, 2023 · 4 comments
Closed

Comments

@oliver-batchelor
Copy link
Contributor

import taichi as ti

@ti.kernel
def foo():

  for x in range(1000):
    shared = ti.simt.block.SharedArray((10, ), dtype=ti.math.vec3)
    print(shared[x].z) # Asserts 
    print(shared[x]) # Also asserts


ti.init(arch=ti.cuda)
foo()

[Taichi] version 1.7.0, llvm 15.0.4, commit 59156b3c, linux, python 3.10.11
[Taichi] Starting on arch=cuda
[E 12/13/23 20:10:29.261 521918] [frontend_ir.cpp:is_global@850] Assertion failure: var.cast<IndexExpression>()->is_matrix_field() || var.cast<IndexExpression>()->is_ndarray()


Traceback (most recent call last):
  File "/home/oliver/sync/bad_shared.py", line 13, in <module>
    foo()
  File "/home/oliver/mambaforge/envs/torch2/lib/python3.10/site-packages/taichi/lang/kernel_impl.py", line 1103, in wrapped
    return primal(*args, **kwargs)
  File "/home/oliver/mambaforge/envs/torch2/lib/python3.10/site-packages/taichi/lang/kernel_impl.py", line 1035, in __call__
    return self.launch_kernel(kernel_cpp, *args)
  File "/home/oliver/mambaforge/envs/torch2/lib/python3.10/site-packages/taichi/lang/kernel_impl.py", line 966, in launch_kernel
    raise e from None
  File "/home/oliver/mambaforge/envs/torch2/lib/python3.10/site-packages/taichi/lang/kernel_impl.py", line 959, in launch_kernel
    compiled_kernel_data = prog.compile_kernel(prog.config(), prog.get_device_caps(), t_kernel)
RuntimeError: [frontend_ir.cpp:is_global@850] Assertion failure: var.cast<IndexExpression>()->is_matrix_field() || var.cast<IndexExpression>()->is_ndarray()

@bobcao3
Copy link
Collaborator

bobcao3 commented Dec 21, 2023

That's a bit crazy... let me check

@bobcao3
Copy link
Collaborator

bobcao3 commented Dec 21, 2023

I figured out the assertion error, but encountered another one later down the compiler chain. I have a workaround for that one, but not entirely sure yet

bobcao3 added a commit to bobcao3/taichi that referenced this issue Dec 22, 2023
bobcao3 pushed a commit that referenced this issue Dec 24, 2023
Issue: #8435

### Brief Summary

copilot:summary

### Walkthrough

copilot:walkthrough
@bobcao3
Copy link
Collaborator

bobcao3 commented Dec 24, 2023

Should be fixed in #8445 and built in taichi-nightly

@bobcao3 bobcao3 closed this as completed Dec 24, 2023
@github-project-automation github-project-automation bot moved this from Untriaged to Done in Taichi Lang Dec 24, 2023
@oliver-batchelor
Copy link
Contributor Author

oliver-batchelor commented Dec 25, 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: Done
Development

No branches or pull requests

2 participants