15 const std::vector<std::reference_wrapper<const NeuronGroupInternal>> &groups);
21 bool isInSynWUMVarInitParamHeterogeneous(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
24 bool isInSynWUMVarInitDerivedParamHeterogeneous(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
27 bool isOutSynWUMVarInitParamHeterogeneous(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
30 bool isOutSynWUMVarInitDerivedParamHeterogeneous(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
39 boost::uuids::detail::sha1::digest_type getHashDigest()
const;
45 generateRunnerBase(backend, definitionsInternal, definitionsInternalFunc, definitionsInternalVar,
46 runnerVarDecl, runnerMergedStructAlloc, name);
54 static const std::string
name;
61 void generateWUVar(
const BackendBase &backend,
const std::string &fieldPrefixStem,
62 const std::vector<std::vector<SynapseGroupInternal *>> &sortedSyn,
70 bool isInSynWUMVarInitParamReferenced(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
73 bool isInSynWUMVarInitDerivedParamReferenced(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
76 bool isOutSynWUMVarInitParamReferenced(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
79 bool isOutSynWUMVarInitDerivedParamReferenced(
size_t childIndex,
size_t varIndex,
size_t paramIndex)
const;
82 bool spikeEvent,
unsigned int batchSize)
const;
85 bool spikeEvent,
unsigned int batchSize)
const;
88 const std::string &varName,
unsigned int batchSize)
const;
92 std::vector<std::vector<SynapseGroupInternal *>> m_SortedInSynWithPostVars;
93 std::vector<std::vector<SynapseGroupInternal *>> m_SortedOutSynWithPreVars;
104 const std::vector<std::reference_wrapper<const SynapseGroupInternal>> &groups)
117 generateRunnerBase(backend, definitionsInternal, definitionsInternalFunc, definitionsInternalVar,
118 runnerVarDecl, runnerMergedStructAlloc, name);
136 const std::vector<std::reference_wrapper<const SynapseGroupInternal>> &groups)
149 generateRunnerBase(backend, definitionsInternal, definitionsInternalFunc, definitionsInternalVar,
150 runnerVarDecl, runnerMergedStructAlloc, name);
168 const std::vector<std::reference_wrapper<const SynapseGroupInternal>> &groups)
181 generateRunnerBase(backend, definitionsInternal, definitionsInternalFunc, definitionsInternalVar,
182 runnerVarDecl, runnerMergedStructAlloc, name);
199 void genInitConnectivity(
CodeStream &os,
Substitutions &popSubs,
const std::string &ftype,
bool rowNotColumns)
const;
215 return (isVarInitParamReferenced(varIndex, paramIndex) &&
216 this->isParamValueHeterogeneous(paramIndex, [varIndex](
const G &cg) {
return cg.getVarInitialisers().at(varIndex).getParams(); }));
222 return (isVarInitDerivedParamReferenced(varIndex, paramIndex) &&
223 this->isParamValueHeterogeneous(paramIndex, [varIndex](
const G &cg) {
return cg.getVarInitialisers().at(varIndex).getDerivedParams(); }));
228 const std::vector<std::reference_wrapper<const G>> &groups)
233 const auto vars = cm->
getVars();
234 const auto &varInit = this->getArchetype().getVarInitialisers();
235 assert(vars.size() == varInit.size());
236 for(
size_t v = 0; v < vars.size(); v++) {
238 const auto var = vars[v];
239 if(!varInit[v].getSnippet()->getCode().empty()) {
244 this->addEGPs(varInit[v].getSnippet()->getExtraGlobalParams(), backend.
getDeviceVarPrefix(), var.name);
247 this->
template addHeterogeneousVarInitParams<CustomUpdateInitGroupMergedBase<G>>(
248 vars, &G::getVarInitialisers,
251 this->
template addHeterogeneousVarInitDerivedParams<CustomUpdateInitGroupMergedBase<G>>(
252 vars, &G::getVarInitialisers,
265 this->
template updateVarInitParamHash<CustomUpdateInitGroupMergedBase<G>>(
268 this->
template updateVarInitDerivedParamHash<CustomUpdateInitGroupMergedBase<G>>(
277 bool isVarInitParamReferenced(
size_t varIndex,
size_t paramIndex)
const 280 const auto *varInitSnippet = this->getArchetype().getVarInitialisers().at(varIndex).getSnippet();
281 const std::string paramName = varInitSnippet->getParamNames().at(paramIndex);
282 return this->isParamReferenced({varInitSnippet->getCode()}, paramName);
286 bool isVarInitDerivedParamReferenced(
size_t varIndex,
size_t paramIndex)
const 289 const auto *varInitSnippet = this->getArchetype().getVarInitialisers().at(varIndex).getSnippet();
290 const std::string derivedParamName = varInitSnippet->getDerivedParams().at(paramIndex).name;
291 return this->isParamReferenced({varInitSnippet->getCode()}, derivedParamName);
302 const std::vector<std::reference_wrapper<const CustomUpdateInternal>> &groups);
307 boost::uuids::detail::sha1::digest_type getHashDigest()
const;
313 generateRunnerBase(backend, definitionsInternal, definitionsInternalFunc, definitionsInternalVar,
314 runnerVarDecl, runnerMergedStructAlloc, name);
333 const std::vector<std::reference_wrapper<const CustomUpdateWUInternal>> &groups);
338 boost::uuids::detail::sha1::digest_type getHashDigest()
const;
344 generateRunnerBase(backend, definitionsInternal, definitionsInternalFunc, definitionsInternalVar,
345 runnerVarDecl, runnerMergedStructAlloc, name);
390 const std::vector<std::reference_wrapper<const CustomUpdateWUInternal>> &groups);
395 boost::uuids::detail::sha1::digest_type getHashDigest()
const;
401 generateRunnerBase(backend, definitionsInternal, definitionsInternalFunc, definitionsInternalVar,
402 runnerVarDecl, runnerMergedStructAlloc, name);
void genKernelIndex(std::ostream &os, const CodeGenerator::Substitutions &subs) const
Generate an index into a kernel based on the id_kernel_XXX variables in subs.
Definition: initGroupMerged.h:363
void generateRunner(const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc) const
Definition: initGroupMerged.h:177
bool isKernelSizeHeterogeneous(size_t dimensionIndex) const
Is kernel size heterogeneous in this dimension?
Definition: initGroupMerged.h:351
static const std::string name
Definition: initGroupMerged.h:371
Definition: initGroupMerged.h:298
boost::uuids::detail::sha1::digest_type getHashDigest(Role role) const
Definition: groupMerged.cc:1188
std::vector< Var > VarVec
Definition: models.h:115
Definition: groupMerged.h:1021
std::string getKernelSize(size_t dimensionIndex) const
Get expression for kernel size in dimension (may be literal or group->kernelSizeXXX) ...
Definition: initGroupMerged.h:357
Definition: initGroupMerged.h:206
static const std::string name
Definition: initGroupMerged.h:192
void genKernelIndex(const G *group, std::ostream &os, const CodeGenerator::Substitutions &subs, K getKernelSizeFn)
Definition: codeGenUtils.h:180
#define GENN_EXPORT
Definition: gennExport.h:13
void generateRunner(const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc) const
Definition: initGroupMerged.h:113
boost::uuids::detail::sha1::digest_type getHashDigest() const
Definition: initGroupMerged.h:108
bool isVarInitDerivedParamHeterogeneous(size_t varIndex, size_t paramIndex) const
Should the var init derived parameter be implemented heterogeneously?
Definition: initGroupMerged.h:220
void generateRunner(const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc) const
Definition: initGroupMerged.h:41
GENN_EXPORT void generateInit(const filesystem::path &outputPath, const ModelSpecMerged &modelMerged, const BackendBase &backend, const std::string &suffix="")
Definition: generateModules.cc:268
Definition: modelSpecMerged.h:31
Helper class for generating code - automatically inserts brackets, indents etc.
Definition: backendBase.h:30
Definition: initGroupMerged.h:386
Base class for all current source models.
Definition: customUpdateModels.h:31
boost::uuids::detail::sha1::digest_type getHashDigest() const
Definition: initGroupMerged.h:172
Definition: groupMerged.h:33
Definition: synapseGroupInternal.h:9
Definition: codeStream.h:21
const SynapseGroupInternal * getSynapseGroup() const
Definition: customUpdate.h:278
Definition: substitutions.h:21
Base class for all weight update models.
Definition: weightUpdateModels.h:46
static const std::string name
Definition: initGroupMerged.h:126
Definition: initGroupMerged.h:132
const std::vector< unsigned int > & getKernelSize() const
Definition: synapseGroup.h:130
void updateHash(const T &value, boost::uuids::detail::sha1 &hash)
Hash arithmetic types and enums.
Definition: gennUtils.h:128
Definition: initGroupMerged.h:11
Definition: backendBase.h:176
void updateBaseHash(boost::uuids::detail::sha1 &hash) const
Definition: initGroupMerged.h:259
boost::uuids::detail::sha1::digest_type getHashDigest() const
Definition: initGroupMerged.h:140
static const std::string name
Definition: initGroupMerged.h:410
Definition: initGroupMerged.h:329
static const std::string name
Definition: initGroupMerged.h:54
bool isVarInitParamHeterogeneous(size_t varIndex, size_t paramIndex) const
Should the var init parameter be implemented heterogeneously?
Definition: initGroupMerged.h:213
bool isKernelSizeHeterogeneous(const G *group, size_t dimensionIndex, K getKernelSizeFn)
Definition: codeGenUtils.h:152
const std::vector< SynapseGroupInternal * > & getSortedArchetypeInSynWithPostVars() const
Get sorted vectors of incoming synapse groups with postsynaptic variables belonging to archetype grou...
Definition: initGroupMerged.h:33
Definition: groupMerged.h:583
virtual VarVec getVars() const
Gets names and types (as strings) of model variables.
Definition: models.h:123
Definition: customUpdateInternal.h:41
Role
Definition: groupMerged.h:1132
Definition: initGroupMerged.h:164
Definition: initGroupMerged.h:100
const std::vector< SynapseGroupInternal * > & getSortedArchetypeOutSynWithPreVars() const
Get sorted vectors of outgoing synapse groups with presynaptic variables belonging to archetype group...
Definition: initGroupMerged.h:36
std::string getKernelSize(const G *group, size_t dimensionIndex, K getKernelSizeFn)
Definition: codeGenUtils.h:167
static const std::string name
Definition: initGroupMerged.h:322
void generateRunner(const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc) const
Definition: initGroupMerged.h:145
void generateRunner(const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc) const
Definition: initGroupMerged.h:397
void generateRunner(const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc) const
Definition: initGroupMerged.h:340
SynapseSparseInitGroupMerged(size_t index, const std::string &precision, const std::string &timePrecision, const BackendBase &backend, const std::vector< std::reference_wrapper< const SynapseGroupInternal >> &groups)
Definition: initGroupMerged.h:135
SynapseInitGroupMerged(size_t index, const std::string &precision, const std::string &timePrecision, const BackendBase &backend, const std::vector< std::reference_wrapper< const SynapseGroupInternal >> &groups)
Definition: initGroupMerged.h:103
void generateRunner(const BackendBase &backend, CodeStream &definitionsInternal, CodeStream &definitionsInternalFunc, CodeStream &definitionsInternalVar, CodeStream &runnerVarDecl, CodeStream &runnerMergedStructAlloc) const
Definition: initGroupMerged.h:309
SynapseConnectivityInitGroupMerged(size_t index, const std::string &precision, const std::string &timePrecision, const BackendBase &backend, const std::vector< std::reference_wrapper< const SynapseGroupInternal >> &groups)
Definition: initGroupMerged.h:167
virtual std::string getDeviceVarPrefix() const
Definition: backendBase.h:362
CustomUpdateInitGroupMergedBase(size_t index, const std::string &precision, const BackendBase &backend, const std::vector< std::reference_wrapper< const G >> &groups)
Definition: initGroupMerged.h:227
static const std::string name
Definition: initGroupMerged.h:158