A buffer is allocated the size of the total memory required by the data structure, I get that much, using clSVMAlloc… I’m filling it up with a binary tree, so the root node will be the first data pointed to, now how do I create additional pointers into the shared virtual memory to represent additional nodes. In C using malloc or C++ with new generally I wouldn’t worry about where the data was, and just make each new node allocate its own memory space with additional calls to malloc or new. But I have a feeling doing that with clSVMalloc will just introduce additional complexity when it comes time to send all this data to the kernel, and possibly produce a much slower to start kernel.
The AMD and Intel examples are helpful, but I’m having a little trouble finding where they’re populating the data in their structures to answer this question on my own…
(if only my gpu fully supported fine grain SVM system >.>)
edit ----
Now maybe answering my own question… If I just treated it like a dynamically allocated array, I could just plop the data into computed offsets, leading to faster tree traversal as well since each level of the tree would be in contiguous memory… I’d still appreciate some input… I guess I feel like there’s a call I’m missing to generate a pointer to a currently unused block of the previously allocated buffer.
My nodes are very simple, basically just 3 pointers, 1 pointer to some data, and then of course the left and right node pointers. The data will be in a separate SVM buffer.