3 ms·
A workgroup/kernel can launch other ones without talking to the host. Like cuda's dynamic thing except with no nested lifetime restrictions. This is somewhat do
by JonChesterfield 3y ago
A workgroup/kernel can launch other ones without talking to the host. Like cuda's dynamic thing except with no nested lifetime restrictions. This is somewhat documented under the name HSA.
Involves getting a pointer to a HSA queue and writing a dispatch packet to it. Same interface the host has for launching kernels - easier in some ways (you've got the kernel descriptor as a symbol, not as a name to dlsym) and harder in others (dynamic memory allocation is a pain).
- raphlinus 3y agoYeah, dynamic memory allocation from GPU space seems to be the real sticking point. I'll look into HSA queues, that looks very interesting, thanks.
- JonChesterfield 3y agoThat's solved too. But as usual there's elements of DIY. The host runtime can allocate memory that is read/write by the host and by GPUs in atomic operation fashion. If you're on pci-e that means load/store/cas/swap/fetch-add. Mutable shared memory is sufficient for arbitrary exchange of information, e.g. a GPU kernel asking the host to allocate some GPU memory and give it the corresponding pointer. Implementing robust cross device function calls on that was fairly tough going, but these days you could rip the code with 'rpc' in the file name out of the llvm libc implementation where it underpins the GPU equivalent of syscall. Non-cuda style programming models on GPUs is a pet interest of mine, feel free to email if you want to talk offline.