mihzaha

good LRU algorithm?

Discussion created by mihzaha on Aug 4, 2010
Latest reply on Aug 4, 2010 by mihzaha
do you know a good least recently used algorithm for the GPU?

Hi again

I have a large list of voxels. When there is no more space for new voxels, the old ones have to be deleted. I was thinking of something like this:

1 global timer that increases every frame.

when inserting the voxel, set the time of the voxel to the global timer

every time a voxel is read, update the timer of the respective voxel

when there is no more space left or the global timer reaches the end, search for the (smallest values*) and free them and reset to 0 the other values.

 

(*)the global times is something small, like char. When searching, create a list of 255 values, in which we count the number of voxels which have the respective timer count (on index 0 the number of voxels which have the the timer set to 0; index 1 number of voxels with timer set to 1 ...). Count on this list which is the threshold value of the timer, so to free enough memory and do the search again and free voxels which timer values below threshold.

 

O(1) in general, but once in a while O(n), and it is a big N (a voxel has about 20 bytes, and I have to keep the memory almost full).

 

Do you know of any better solution?

 

Thank you

Outcomes