[Beignet] [PATCH] GBE: Optimize scratch memory usage using register interval

Song, Ruiling ruiling.song at intel.com
Sun Feb 23 18:06:41 PST 2014


>The maximum scratch size is known, then we can initialize the set to contains all elements in [0 - (max_scratch_size/32 - 1))]. Then each time to allocate, we just call set.begin()/erase to extract one from the set. And at deallocation, we just call set.insert() to insert a virtual scratch register to the set. 
What do you think?
[Ruiling] Your idea sound interesting. But if we use a set like you mentioned, Is it easy to allocate contiguous scratch memory of size 32*2 or 32*4 after some allocation/deallocation?
       And consider that we may choose to spill some registers in a SelectionVector in one spill instruction. We need contiguous scratch memory.

> +      if(exp->maxID <= cur->minID) {
It should be exp->maxID < cur->minID. If the exp->maxID == cur->minID, then it is still alive and we should not expire it.
[Ruiling] oh, I previously thought maxID always maps to 'src'. And src & dst can use same scratch memory. You are right. I will change this.

Thanks!
Ruiling


More information about the Beignet mailing list