Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group merged refactor #475

Merged
merged 15 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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