Skip to content

Commit

Permalink
Merge pull request #475 from genn-team/group_merged_refactor
Browse files Browse the repository at this point in the history
Group merged refactor
  • Loading branch information
neworderofjamie authored Nov 10, 2021
2 parents 2a09d50 + f12694f commit 33b81dc
Show file tree
Hide file tree
Showing 37 changed files with 3,301 additions and 3,509 deletions.
4 changes: 2 additions & 2 deletions generate_swig_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def generateConfigs(gennPath, backends):
INITVARSNIPPET, SPARSEINITSNIPPET):
pygennSmg.addCppInclude( '"' + header + 'Custom.h"' )
pygennSmg.addCppInclude( '"code_generator/backendBase.h"' )
pygennSmg.addCppInclude( '"code_generator/generateAll.h"' )
pygennSmg.addCppInclude( '"code_generator/generateModules.h"' )
pygennSmg.addCppInclude( '"code_generator/generateMakefile.h"' )
pygennSmg.addCppInclude( '"code_generator/generateMSBuild.h"' )
pygennSmg.addCppInclude( '"path.h"' )
Expand All @@ -579,7 +579,7 @@ def generateConfigs(gennPath, backends):
pygennSmg.addSwigIgnore("PreferencesBase")
pygennSmg.addSwigInclude('"code_generator/backendBase.h"')

# define and wrap three functions which replace main in generateALL.cc
# define and wrap code generator
with SwigInlineScope( pygennSmg ):
pygennSmg.write( '''
void init_logging(plog::Severity gennLevel, plog::Severity codeGeneratorLevel)
Expand Down
31 changes: 11 additions & 20 deletions include/genn/backends/cuda/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,26 +167,17 @@ class BACKEND_EXPORT Backend : public BackendSIMT
//--------------------------------------------------------------------------
// CodeGenerator::BackendBase virtuals
//--------------------------------------------------------------------------
virtual void genNeuronUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
NeuronGroupSimHandler simHandler, NeuronUpdateGroupMergedHandler wuVarUpdateHandler,
HostHandler pushEGPHandler) const override;

virtual void genSynapseUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
PresynapticUpdateGroupMergedHandler wumThreshHandler, PresynapticUpdateGroupMergedHandler wumSimHandler,
PresynapticUpdateGroupMergedHandler wumEventHandler, PresynapticUpdateGroupMergedHandler wumProceduralConnectHandler,
PostsynapticUpdateGroupMergedHandler postLearnHandler, SynapseDynamicsGroupMergedHandler synapseDynamicsHandler,
HostHandler pushEGPHandler) const override;

virtual void genCustomUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
CustomUpdateGroupMergedHandler customUpdateHandler, CustomUpdateWUGroupMergedHandler customWUUpdateHandler,
CustomUpdateTransposeWUGroupMergedHandler customWUTransposeUpdateHandler, HostHandler pushEGPHandler) const override;

virtual void genInit(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
NeuronInitGroupMergedHandler localNGHandler, CustomUpdateInitGroupMergedHandler cuHandler,
CustomWUUpdateDenseInitGroupMergedHandler cuDenseHandler, SynapseDenseInitGroupMergedHandler sgDenseInitHandler,
SynapseConnectivityInitMergedGroupHandler sgSparseRowConnectHandler, SynapseConnectivityInitMergedGroupHandler sgSparseColConnectHandler,
SynapseConnectivityInitMergedGroupHandler sgKernelInitHandler, SynapseSparseInitGroupMergedHandler sgSparseInitHandler,
CustomWUUpdateSparseInitGroupMergedHandler cuSparseHandler, HostHandler initPushEGPHandler, HostHandler initSparsePushEGPHandler) const override;
virtual void genNeuronUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genSynapseUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genCustomUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genInit(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler initPushEGPHandler, HostHandler initSparsePushEGPHandler) const override;

virtual void genDefinitionsPreamble(CodeStream &os, const ModelSpecMerged &modelMerged) const override;
virtual void genDefinitionsInternalPreamble(CodeStream &os, const ModelSpecMerged &modelMerged) const override;
Expand Down
31 changes: 11 additions & 20 deletions include/genn/backends/opencl/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,17 @@ class BACKEND_EXPORT Backend : public BackendSIMT
//--------------------------------------------------------------------------
// CodeGenerator::BackendBase:: virtuals
//--------------------------------------------------------------------------
virtual void genNeuronUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
NeuronGroupSimHandler simHandler, NeuronUpdateGroupMergedHandler wuVarUpdateHandler,
HostHandler pushEGPHandler) const override;

virtual void genSynapseUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
PresynapticUpdateGroupMergedHandler wumThreshHandler, PresynapticUpdateGroupMergedHandler wumSimHandler,
PresynapticUpdateGroupMergedHandler wumEventHandler, PresynapticUpdateGroupMergedHandler wumProceduralConnectHandler,
PostsynapticUpdateGroupMergedHandler postLearnHandler, SynapseDynamicsGroupMergedHandler synapseDynamicsHandler,
HostHandler pushEGPHandler) const override;

virtual void genCustomUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
CustomUpdateGroupMergedHandler customUpdateHandler, CustomUpdateWUGroupMergedHandler customWUUpdateHandler,
CustomUpdateTransposeWUGroupMergedHandler customWUTransposeUpdateHandler, HostHandler pushEGPHandler) const override;

virtual void genInit(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
NeuronInitGroupMergedHandler localNGHandler, CustomUpdateInitGroupMergedHandler cuHandler,
CustomWUUpdateDenseInitGroupMergedHandler cuDenseHandler, SynapseDenseInitGroupMergedHandler sgDenseInitHandler,
SynapseConnectivityInitMergedGroupHandler sgSparseRowConnectHandler, SynapseConnectivityInitMergedGroupHandler sgSparseColConnectHandler,
SynapseConnectivityInitMergedGroupHandler sgKernelInitHandler, SynapseSparseInitGroupMergedHandler sgSparseInitHandler,
CustomWUUpdateSparseInitGroupMergedHandler cuSparseHandler, HostHandler initPushEGPHandler, HostHandler initSparsePushEGPHandler) const override;
virtual void genNeuronUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genSynapseUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genCustomUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genInit(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler initPushEGPHandler, HostHandler initSparsePushEGPHandler) const override;

virtual void genDefinitionsPreamble(CodeStream &os, const ModelSpecMerged &modelMerged) const override;
virtual void genDefinitionsInternalPreamble(CodeStream &os, const ModelSpecMerged &modelMerged) const override;
Expand Down
34 changes: 12 additions & 22 deletions include/genn/backends/single_threaded_cpu/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,17 @@ class BACKEND_EXPORT Backend : public BackendBase
//--------------------------------------------------------------------------
// CodeGenerator::BackendBase virtuals
//--------------------------------------------------------------------------
virtual void genNeuronUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
NeuronGroupSimHandler simHandler, NeuronUpdateGroupMergedHandler wuVarUpdateHandler,
HostHandler pushEGPHandler) const override;

virtual void genSynapseUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
PresynapticUpdateGroupMergedHandler wumThreshHandler, PresynapticUpdateGroupMergedHandler wumSimHandler,
PresynapticUpdateGroupMergedHandler wumEventHandler, PresynapticUpdateGroupMergedHandler wumProceduralConnectHandler,
PostsynapticUpdateGroupMergedHandler postLearnHandler, SynapseDynamicsGroupMergedHandler synapseDynamicsHandler,
HostHandler pushEGPHandler) const override;

virtual void genCustomUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
CustomUpdateGroupMergedHandler customUpdateHandler, CustomUpdateWUGroupMergedHandler customWUUpdateHandler,
CustomUpdateTransposeWUGroupMergedHandler customWUTransposeUpdateHandler, HostHandler pushEGPHandler) const override;

virtual void genInit(CodeStream &os, const ModelSpecMerged &modelMerged, HostHandler preambleHandler,
NeuronInitGroupMergedHandler localNGHandler, CustomUpdateInitGroupMergedHandler cuHandler,
CustomWUUpdateDenseInitGroupMergedHandler cuDenseHandler, SynapseDenseInitGroupMergedHandler sgDenseInitHandler,
SynapseConnectivityInitMergedGroupHandler sgSparseRowConnectHandler, SynapseConnectivityInitMergedGroupHandler sgSparseColConnectHandler,
SynapseConnectivityInitMergedGroupHandler sgKernelInitHandler, SynapseSparseInitGroupMergedHandler sgSparseInitHandler,
CustomWUUpdateSparseInitGroupMergedHandler cuSparseHandler, HostHandler initPushEGPHandler, HostHandler initSparsePushEGPHandler) const override;
virtual void genNeuronUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genSynapseUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genCustomUpdate(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler pushEGPHandler) const override;

virtual void genInit(CodeStream &os, const ModelSpecMerged &modelMerged,
HostHandler preambleHandler, HostHandler initPushEGPHandler, HostHandler initSparsePushEGPHandler) const override;

virtual size_t getSynapticMatrixRowStride(const SynapseGroupInternal &sg) const override;

Expand Down Expand Up @@ -172,8 +163,7 @@ class BACKEND_EXPORT Backend : public BackendBase
//--------------------------------------------------------------------------
// Private methods
//--------------------------------------------------------------------------
void genPresynapticUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, const PresynapticUpdateGroupMerged &sg, const Substitutions &popSubs,
bool trueSpike, PresynapticUpdateGroupMergedHandler wumThreshHandler, PresynapticUpdateGroupMergedHandler wumSimHandler) const;
void genPresynapticUpdate(CodeStream &os, const ModelSpecMerged &modelMerged, const PresynapticUpdateGroupMerged &sg, const Substitutions &popSubs, bool trueSpike) const;

void genEmitSpike(CodeStream &os, const NeuronUpdateGroupMerged &ng, const Substitutions &subs, bool trueSpike, bool recordingEnabled) const;

Expand Down
Loading

0 comments on commit 33b81dc

Please sign in to comment.