Allow memory allocation in shaders like cudaMalloc OR an "append" buffer
| Originator: | adgror | ||
| Number: | rdar://22936818 | Date Originated: | 01-Oct-2015 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | |
| Classification: | Feature (New) | Reproducible: | Always |
Summary: It would be very useful to have a way of allocating memory when needed in compute shader tasks that don't have a predefined output size, e.g. the marching cubes algorithm (https://en.wikipedia.org/wiki/Marching_cubes), like cudaMalloc allows in CUDA. Currently the workaround is to preallocate a big heap of memory and have the current thread on GPU increment an atomic int to know which chunk it can use. While this works, it requires a lot of memory (especially if you forecast a lot of chunks *could* be used) and sometimes garbage collection is needed (e.g. some chunks that were in use can now be deleted/reused). Steps to Reproduce: use a compute shader that has a varying output size Expected Results: don't need to worry about the size of the output buffer before the shader runs Actual Results: preallocate a big heap of memory with CPU instructions
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!