Replies: 5 comments
-
I'm sorry but I have never implemented quadtree traversal on a GPU. Maybe @toji has and has a demo? Or maybe someone else will have an answer. I asked ChatGPT but I have no idea how much it hallucinated vs how much it's good info: https://chatgpt.com/share/67ac6c02-8654-8003-9db3-f506cfb803bc |
Beta Was this translation helpful? Give feedback.
-
I have not implemented quad trees on the GPU either, but when it comes to making use of GPU workgroups we can maybe supply some general advice, depending on what you're trying to do with the data structure. (I'm only vaguely familiar with force-directed algorithms, so I'm not sure how to apply it here.) The highest level advice I would give is that you're not likely to gain much if you are trying to structure your code such that each invocation of the shader navigate a single level of the tree, or anything really granular like that. It's going to require too much cooperation and waiting between thread. Instead, sometimes it's more beneficial to allow each thread to be more long-running and complete more of the workload if it can do so independently and you can have still have multiple threads all working in tandem. |
Beta Was this translation helpful? Give feedback.
-
To add, what specifically are you trying to do? Why do you want to traverse a quad tree? It might be better to know what problem you are trying to solve and then find out what solutions there are for that specific problem. I don't know this is useful but I remember watching this video on optimizing particle lookups using a GPU friendly technique. It takes a while as the video works through algorithms on the CPU and then later adapting to the GPU |
Beta Was this translation helpful? Give feedback.
-
My goal is to implement a WebGPU version of the d3-force algorithm. In this algorithm, to calculate the repulsive force between points, each point typically needs to calculate its repulsive force with every other point. To simplify this computation, d3-force implements a Quadtree. The steps are as follows:
To utilize multi-threading, I have split the three steps into three compute passes:
js code
|
Beta Was this translation helpful? Give feedback.
-
I quick search brings up this: https://developer.nvidia.com/blog/thinking-parallel-part-iii-tree-construction-gpu/ which shows a method of building a tree on the GPU. It's not a "quad tree" but it might suggest how to do it. There's also this: https://adms-conf.org/2019-camera-ready/zhang_adms19.pdf |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I plan to use a Quadtree to optimize the computation of data volume when implementing the force-directed algorithm.
I have a Quadtree array structure as follows:
Generally speaking, Quadtree traversal can be divided into two types: visit and visitAfter. It seems I can implement the traversal using a stack and a while loop (since recursion is not supported).
I'm stuck because I'm not sure how to leverage GPU workgroups for acceleration.
Beta Was this translation helpful? Give feedback.
All reactions