-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
got various GPU bugs sorted -- only 1 real bug, in NewStateNeuron -- …
…filed issue #234
- Loading branch information
Showing
14 changed files
with
157 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) 2022, The Emergent Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// does NewState Update on each Neuron | ||
// note: anything *reading from neuron level must be called at neuron level! | ||
|
||
#include "synmem.hlsl" | ||
|
||
// note: all must be visible always because accessor methods refer to them | ||
[[vk::binding(0, 1)]] StructuredBuffer<uint> NeuronIxs; // [Neurons][Idxs] | ||
[[vk::binding(1, 1)]] StructuredBuffer<uint> SynapseIxs; // [Layer][SendPrjns][SendNeurons][Syns] | ||
[[vk::binding(1, 2)]] RWStructuredBuffer<float> Neurons; // [Neurons][Vars][Data] | ||
[[vk::binding(2, 2)]] RWStructuredBuffer<float> NeuronAvgs; // [Neurons][Vars] | ||
[[vk::binding(5, 2)]] RWStructuredBuffer<float> Globals; // [NGlobals] | ||
[[vk::binding(0, 3)]] RWStructuredBuffer<SynMemBlock> Synapses; // [Layer][SendPrjns][SendNeurons][Syns] | ||
[[vk::binding(1, 3)]] RWStructuredBuffer<SynMemBlock> SynapseCas; // [Layer][SendPrjns][SendNeurons][Syns][Data] | ||
|
||
#include "context.hlsl" | ||
#include "layerparams.hlsl" | ||
|
||
// note: binding is var, set | ||
|
||
// Set 0: uniform layer params -- could not have prjns also be uniform.. | ||
[[vk::binding(0, 0)]] StructuredBuffer<LayerParams> Layers; // [Layer] | ||
|
||
// Set 1: effectively uniform prjn params as structured buffers in storage | ||
|
||
// Set 2: main network structs and vals -- all are writable | ||
[[vk::binding(0, 2)]] StructuredBuffer<Context> Ctx; // [0] | ||
[[vk::binding(3, 2)]] RWStructuredBuffer<Pool> Pools; // [Layer][Pools][Data] | ||
[[vk::binding(4, 2)]] RWStructuredBuffer<LayerVals> LayVals; // [Layer][Data] | ||
|
||
|
||
void NewStateNeuron2(in Context ctx, in LayerParams ly, uint ni, uint di) { | ||
ly.NewStateNeuron(ctx, ni, di, LayVals[ly.Idxs.ValsIdx(di)]); | ||
} | ||
|
||
void NewStateNeuron(in Context ctx, uint ni, uint di) { | ||
uint li = NrnI(ctx, ni, NrnLayIdx); | ||
NewStateNeuron2(ctx, Layers[li], ni, di); | ||
} | ||
|
||
[numthreads(64, 1, 1)] | ||
void main(uint3 idx : SV_DispatchThreadID) { // over Neurons * Data | ||
uint ni = Ctx[0].NetIdxs.ItemIdx(idx.x); | ||
if (!Ctx[0].NetIdxs.NeurIdxIsValid(ni)) { | ||
return; | ||
} | ||
uint di = Ctx[0].NetIdxs.DataIdx(idx.x); | ||
if (!Ctx[0].NetIdxs.DataIdxIsValid(di)) { | ||
return; | ||
} | ||
NewStateNeuron(Ctx[0], ni, di); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters