a5kin / xentica

GPU-accelerated engine for multi-dimensional cellular automata

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support packing/unpacking for broad bit width

a5kin opened this issue · comments

Right now, if state's bit width is too broad (> 64 bits), value packing/unpacking do not work properly. Although we already have a mechanism to reserve necessary number of memory cells for such states, the unpacking assumes we are dealing with a single integer value only.
Need to implement an advanced packing, that will spread the values across multiple integer cells, and unpack them in similar manner.
The easy way to do it is just to jump to a new cell when next value is overflowing current cell. But this way, we'll get a 'holes' in memory that carries no info at all.
Better, but a bit harder way is to split the values between memory cells on borderline while packing, then to glue those parts together on unpacking. This requires additional operations, but they are mostly shifts and bitwise & (very cheap), and it would be faster in general due to less memory transactions are made (packed cell takes less space in RAM).
This feature is essential to Stochastic Corrector alike models, since the genome representation could easily overflow single 64-bit integer.