-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Make atomic_add() return value (should be ready to review...) #381
Conversation
Hmm, the tests passed, but the CI failed due to missing Speaking of unit tests, I feel like they are great to have, especially for us new contributors, as they are effective and a good documentation of the code itself. (I initially found the |
More thoughts: allow the optimization only if the return value of |
Sorry I've been traveling these days and have very limited time to code. I will settle down and get back to you on Thursday. I think what you have done is awesome but I need a little bit of time to take a careful pass. Quick answers for now:
Thank you so much for contributing!! |
No worries at all!! (太客气了...!) Please take your time (i'm doing it mostly for fun)! |
Thanks so much for contributing! I have taken a close look at the implementation and everything makes sense to me. The only part that is not yet trivially correct to me is |
Thank you for the review! FYI I'd be totally cool if some part didn't seem intuitive, and you wanted some more refactoring or testings before the merge... With this feature, I was finally able to port my position based fluid demo to Taichi, which took about two nights 😆 Again, thanks for the amazing work! (I'd be more than proud to add this to |
Wow this looks really nice! Please feel free to add it to examples and make a PR. After the memory allocator is redesigned, we can also consider adding spatial hashing to make it more efficient and probably scale it up to 3D! (I plan to finish the performance tuning of the LLVM backend by the end of Jan and then redo the memory allocator.) |
Btw, this PR passed all tests on GPUs. Thanks again :-) |
Nice! Spatial hashing was definitely one of the things i was looking for, but |
Issue #332
I've finally got things working (only tested on CPU, sadly...). I had to make a few changes to IR passes to adapt to this change. Specifically:
LocalStoreStmt
cannot be simplified in a few cases where atomic ops appearedIfStmt
cannot move certainLocalStore
out of the branch clauses if the store depends on atomic operations. This one is somewhat nontrivial in this change, as it does two thingsLocalStore
that depend on atomics, for correctness reasonsAllocaStmt
that is 1) in the clause, and 2) the dest ofLocalStore
. This is for performance reason, as otherwise some dead code cannot be eliminated.I wonder if this PR is getting too big, especially the
IfStmt -> AllocaStmt
part, as that is logically a separate thing, and lacks proper unit tests... If you think so, I can separate this into two PRs.If you think the code looks fine, can you help test the GPU version? Or is Travis CI able to test that?