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

[Sparse] Make ti.append() support dynamic snode with **multiple child** #1282

Open
archibate opened this issue Jun 19, 2020 · 1 comment
Open
Assignees
Labels
c++ C++ engineering related discussion Welcome discussion! feature request Suggest an idea on this project

Comments

@archibate
Copy link
Collaborator

archibate commented Jun 19, 2020

Concisely describe the proposed feature
Currently ti.append(snode, n, val) only supports dynamic snode with exactly one child.
I think why @yuanming-hu do such design is limited by the fact that it's hard to make val extendable.

Describe the solution you'd like (if any)
Instead of passing val to append, how about this: we just allocate a slot for it, but not initialize it with val. The initialization can be done later since append is atomic.


Old API:

ti.dynamic(ti.i, 233).place(ch1)

ti.append(ch1.snode(), [], val)  # old ad-hoc inline value appender

New API:

ti.dynamic(ti.i, 233).place(ch1, ch2, ch3)

n = ti.append(ch1.snode(), [])  # atomically increase dynamic snode length by 1
ch1[n] = n  # since n is atomic, so it's fine to let the user fill the slots one-by-one
ch2[n] = n * 2
ch3[n] = n * 3

Additional comments
I found this issue when developing https://github.com/taichi-dev/taichi_three with a OpenGL-alike API glQuad and glSphere, which needs to dynamically append triangle vertices.
图片
图片
(Sorry, I can't help but show off the cool works in Tai3D :)
We may want to start solving this issue after #1256 merged to prevent conflict.

@archibate archibate added the feature request Suggest an idea on this project label Jun 19, 2020
@archibate archibate added discussion Welcome discussion! c++ C++ engineering related llvm LLVM backend and removed llvm LLVM backend labels Jun 19, 2020
@yuanming-hu yuanming-hu mentioned this issue Jun 20, 2020
10 tasks
@yuanming-hu
Copy link
Member

The visual results look good! Btw, the dynamic node is going to be redesigned to support various extensions like the one you mentioned here. I'll share the refactoring plan in the week of June 29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ C++ engineering related discussion Welcome discussion! feature request Suggest an idea on this project
Projects
None yet
Development

No branches or pull requests

4 participants