2 Replies Latest reply on Mar 31, 2010 9:21 AM by Mugga

    Multiple cl_mem objects




      To summarize my problem: i have blocks (for instance each 2 MB) of memory on my device. Now, the data that has to be saved on the device is steadily increasing and I have no idea when its over.

      Now, I could create a new (bigger) buffer object, copy the old one, delete the old one and its fine. However, i will save the copy instruction on the device. Hence, i wanted to create some sort of filesystem where i store a kind of linked list of memory objects (each 2MB) and save me the order of those blocks.


      Unfortunately, there is no way to give the kernels a reference to all of these memory objects.


      Could anyone imagine a solution?




        • Multiple cl_mem objects

          Sounds like you have to do your own memory allocation. I'd just allocate a pool that could accomodate a reasonable amount of those 2mb blocks and another cl_mem object to hold the order of actually allocated blocks.

          If you run out of blocks, double the size of both arrays or something similar, like adjusting buffer sizes to accomodate a fixed, but large, number of new blocks. That way, the cost of the copy operation will be fairly small, in the sense that it will happen rarely.