Main state assignment fails
a5kin opened this issue · comments
When assinging to main state, without previously get it:
def absorb(self):
new_val = core.IntegerVariable()
self.main.state = new_val + 1
it shows CUDA compiler warning:
kernel.cu(176): warning: variable "_cell" is used before its value is set
Kernel runs, but it results in all zero values at the second step.
The workaround for this case is:
def absorb(self):
new_val = core.IntegerVariable()
new_val += 1
self.main.state = new_val + 1 + 0 * self.main.state
Was a problem not only with the main state, but with all buffered states too. The reason is unnecessary code unpacking value from a memory. We fixed it by marking property "unpacked" the very first time it is set by __setattr__
.