Skip to content

Commit

Permalink
all gpu kernels updated and building; just one gosl error remaining..
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Nov 2, 2024
1 parent a7a3dc6 commit c863b80
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 225 deletions.
File renamed without changes.
File renamed without changes.
63 changes: 41 additions & 22 deletions axon/network.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 41 additions & 21 deletions axon/network.goal
Original file line number Diff line number Diff line change
Expand Up @@ -221,21 +221,19 @@ func (nt *Network) SpkSt2(ctx *Context) {
func (nt *Network) DWt(ctx *Context) {
nix := GetNetworkIxs(0)
sd := int(nix.NSyns * ctx.NData)
RunDWtSyn(sd) // todo: iterate over groups as needed
RunDWtFromDi(int(nix.NSyns))
RunDWtSyn(sd)
RunDWtFromDiSyn(int(nix.NSyns))
}

// WtFromDWt updates the weights from delta-weight changes.
// Also does ctx.SlowInc() and calls SlowAdapt at SlowInterval
func (nt *Network) WtFromDWt(ctx *Context) {
// todo: fixme
// nix := GetNetworkIxs(0)
// nn := nix.NNeurons
// RunDWtSubMean(nn)
// RunWtFromDWt(int(nix.NSyns))
// if ctx.SlowInc() {
// nt.SlowAdapt(ctx)
// }
nix := GetNetworkIxs(0)
RunDWtSubMeanPath(int(nix.NPaths))
RunWtFromDWtSyn(int(nix.NSyns))
if ctx.SlowInc() {
nt.SlowAdapt(ctx)
}
}

//gosl:start
Expand Down Expand Up @@ -306,7 +304,7 @@ func CyclePost(i uint32) { //gosl:kernel
Layers[li].CyclePost(ctx, di)
}

// CycleInc increments the cycle counter.
// CycleInc is the kernel over 1 call to increment the cycle counter.
func CycleInc(i uint32) { //gosl:kernel
if i != 0 {
return
Expand All @@ -315,7 +313,8 @@ func CycleInc(i uint32) { //gosl:kernel
ctx.CycleInc()
}

// ApplyExtsNeuron does neuron-level applying of the Exts.
// ApplyExtsNeuron is the kernel over Neurons * Data to
// apply Ext external input to the neurons receiving inputs.
func ApplyExtsNeuron(i uint32) { //gosl:kernel
ctx := GetCtx(0)
di := ctx.DataIndex(i)
Expand All @@ -324,7 +323,8 @@ func ApplyExtsNeuron(i uint32) { //gosl:kernel
Layers[li].ApplyExtsNeuron(ctx, ni, di)
}

// MinusPhasePool does pool-level updating after end of minus phase.
// MinusPhasePool is the kernel over Pools * Data to
// do pool-level updating after end of minus phase.
func MinusPhasePool(i uint32) { //gosl:kernel
ctx := GetCtx(0)
di := ctx.DataIndex(i)
Expand All @@ -333,7 +333,8 @@ func MinusPhasePool(i uint32) { //gosl:kernel
Layers[li].MinusPhasePool(ctx, pi, di)
}

// MinusPhaseNeuron does neuron-level updating after end of minus phase.
// MinusPhaseNeuron is the kernel over Neurons * Data to
// do neuron-level updating after end of minus phase.
func MinusPhaseNeuron(i uint32) { //gosl:kernel
ctx := GetCtx(0)
di := ctx.DataIndex(i)
Expand All @@ -342,7 +343,8 @@ func MinusPhaseNeuron(i uint32) { //gosl:kernel
Layers[li].MinusPhaseNeuron(ctx, ni, di)
}

// PlusPhaseStartNeuron does neuron-level updating at start of plus phase.
// PlusPhaseStartNeuron is the kernel over Neurons * Data to
// do neuron-level updating at start of plus phase.
func PlusPhaseStartNeuron(i uint32) { //gosl:kernel
ctx := GetCtx(0)
di := ctx.DataIndex(i)
Expand All @@ -351,7 +353,8 @@ func PlusPhaseStartNeuron(i uint32) { //gosl:kernel
Layers[li].PlusPhaseStartNeuron(ctx, ni, di)
}

// PlusPhasePool does pool-level updating after end of plus phase.
// PlusPhasePool is the kernel over Pools * Data to
// do pool-level updating after end of plus phase.
func PlusPhasePool(i uint32) { //gosl:kernel
ctx := GetCtx(0)
di := ctx.DataIndex(i)
Expand All @@ -360,7 +363,8 @@ func PlusPhasePool(i uint32) { //gosl:kernel
Layers[li].PlusPhasePool(ctx, pi, di)
}

// PlusPhaseNeuron does neuron-level updating after end of plus phase.
// PlusPhaseNeuron is the kernel over Neurons * Data to
// do neuron-level updating after end of plus phase.
func PlusPhaseNeuron(i uint32) { //gosl:kernel
ctx := GetCtx(0)
di := ctx.DataIndex(i)
Expand All @@ -369,8 +373,8 @@ func PlusPhaseNeuron(i uint32) { //gosl:kernel
Layers[li].PlusPhaseNeuron(ctx, ni, di)
}

// DWtSyn is the kernel over Synapses * Data for computing weight change
// (learning).
// DWtSyn is the kernel over Synapses * Data to
// compute weight changes (learning).
func DWtSyn(i uint32) { //gosl:kernel
ctx := GetCtx(0)
di := ctx.DataIndex(i)
Expand All @@ -381,13 +385,29 @@ func DWtSyn(i uint32) { //gosl:kernel
Paths[pti].DWtSyn(ctx, syni, si, ri, di)
}

// DWtFromDi is the kernel over Synapses for integrating DWt over Di.
func DWtFromDi(syni uint32) { //gosl:kernel
// DWtFromDiSyn is the kernel over Synapses (not * Data) to
// integrate DWt over Di data parallel values.
func DWtFromDiSyn(syni uint32) { //gosl:kernel
ctx := GetCtx(0)
pti := SynapseIxs[SynPathIndex, syni]
Paths[pti].DWtFromDi(ctx, syni)
}

// DWtSubMeanPath is the kernel over Paths to
// compute DWt - mean(DWt).
func DWtSubMeanPath(pti uint32) { //gosl:kernel
ctx := GetCtx(0)
Paths[pti].DWtSubMean(ctx, pti)
}

// WtFromDWtSyn is the kernel over Synapses (not * Data) to
// compute Wt from DWt weight changes.
func WtFromDWtSyn(syni uint32) { //gosl:kernel
ctx := GetCtx(0)
pti := SynapseIxs[SynPathIndex, syni]
Paths[pti].WtFromDWtSyn(ctx, syni)
}

//gosl:end


Expand Down
58 changes: 19 additions & 39 deletions axon/networkbase.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c863b80

Please sign in to comment.