emer / axon

Axon is a spiking, biologically-based neural model driven by predictive error-driven learning, for systems-level models of the brain
BSD 3-Clause "New" or "Revised" License
18 stars 8 forks source link

GPU weird bug in NewState #234

Open rcoreilly opened 1 year ago

rcoreilly commented 1 year ago

There is a very strange bug in GPU NewState:

layerparams.go:

// NewStateNeuron handles all initialization at start of new input pattern.
// Should already have presented the external input to the network at this point.
func (ly *LayerParams) NewStateNeuron(ctx *Context, ni, di uint32, vals *LayerVals) {
    SetNrnV(ctx, ni, di, BurstPrv, NrnV(ctx, ni, di, Burst))
    SetNrnV(ctx, ni, di, SpkPrv, NrnV(ctx, ni, di, CaSpkD))

This works fine in CPU mode, and is clearly free of an actual coding error, but the GPU version returns 0 for those NrnV access calls of the Burst and CaSpkD variables. It sets the new values just fine, including setting Burst etc, but reading these values just plain fails for reasons that are entirely unclear.

Originally this code was being called from a Pool level dispatch, but changing it to neuron-level did not fix the problem (but is more performant).

There is some kind of read cache breakage here that we need to figure out. Meanwhile, using a temporary solution of just doing the NewState on CPU -- not a big deal performance-wise.

rcoreilly commented 1 year ago

Important: when switching back to NewState on GPU, need to update to use proper logic for NewStateLayerActAvg