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

Access to postsynaptic variables with heterogeneous delay #629

Merged
merged 44 commits into from
Jul 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0a1a7a0
extended test_forward_den_delay to test dendritic delays *and* batching
neworderofjamie Jul 3, 2024
39e2241
fixed typos in indexing code for reading from and writing to dendriti…
neworderofjamie Jul 3, 2024
f08ed49
simplified quantifiers in type system - as this system is purely goin…
neworderofjamie Jun 12, 2024
5934360
gave function type set of flags with various attributes (currently va…
neworderofjamie Jun 14, 2024
0038502
fixed typo in CUDA backend using old Qualifiers
neworderofjamie Jun 14, 2024
e8f34f6
added support for type checking and parsing of function [ index ] exp…
neworderofjamie Jun 14, 2024
1491cdd
initial unit test of array subscript overload indexing
neworderofjamie Jun 14, 2024
5fc6903
hopefully fixed issues with [] overload
neworderofjamie Jun 18, 2024
1d9a8aa
added a couple more unit tests
neworderofjamie Jun 18, 2024
c6e224f
added error message if maximum dendritic delay isn't set but weight u…
neworderofjamie Jun 18, 2024
536892a
added test of max dendritic delay setting error
neworderofjamie Jun 18, 2024
f053c7c
updated other unit tests which use weight update groups with dendriti…
neworderofjamie Jun 18, 2024
bcb2cc2
added helper function to detect whether identifiers are referenced wi…
neworderofjamie Jun 19, 2024
f8c8e0a
extend target neuron group delays to encompass max dendritic delay ti…
neworderofjamie Jun 21, 2024
e2a49d0
tweaked error message
neworderofjamie Jun 22, 2024
48fdceb
notes and todos
neworderofjamie Jun 22, 2024
b1d8955
replace some long types with ``auto``
neworderofjamie Jun 22, 2024
ac8fb36
added parameterisable types for addToXXX and addToXXXDelay functions
neworderofjamie Jun 5, 2024
4905f45
added parameterisable type for array subscript override functions
neworderofjamie Jun 24, 2024
b749d50
initial sketch of a addVarRefsHet method in environment
neworderofjamie Jun 24, 2024
c564c3e
First attempt at code generation of heterogeneous variable indices
neworderofjamie Jun 27, 2024
7cf9007
fixed deprecated syntax in feature tests
neworderofjamie Jun 29, 2024
a268ca4
feature test for continously back-propagating heterogeneously delayed…
neworderofjamie Jun 29, 2024
79f2d45
removed one layer of unnecessary helper methods
neworderofjamie Jul 2, 2024
4ff0489
started adding support for heterogeneously delayed access to postsyna…
neworderofjamie Jul 2, 2024
388e69d
SynapseGroup::isDendriticDelayRequired is a bit ambiguous, renamed to…
neworderofjamie Jul 2, 2024
e0220de
removed duplicate logic from pre and postsynaptic wum variable alloca…
neworderofjamie Jul 2, 2024
69dd41b
saner names and included heterogeneous delay check in SynapseWUPostVa…
neworderofjamie Jul 2, 2024
79c2904
tidying
neworderofjamie Jul 2, 2024
b8494d6
no need to make this generic
neworderofjamie Jul 2, 2024
32d523d
fixed typo
neworderofjamie Jul 2, 2024
e640067
tidied delay handling in EnvironmentLocalVarCache - removed more dupl…
neworderofjamie Jul 2, 2024
4b9dbbb
Logic for heterogeneously delayed access to postsynaptic WUM variables
neworderofjamie Jul 2, 2024
f38a4de
test for accessing weight update model postsynaptic variables via het…
neworderofjamie Jul 2, 2024
d371be0
expose ``SynapseGroup::isWUPostVarHeterogeneouslyDelayed`` to python …
neworderofjamie Jul 2, 2024
0288d5d
extended test_wu_var_cont test to also test accessing postsynaptic we…
neworderofjamie Jul 2, 2024
09ac6d6
added fusion unit test
neworderofjamie Jul 2, 2024
fb4b3ac
+
neworderofjamie Jul 2, 2024
a10ac9b
track whether spikes and spike events need queuing in neuron group (l…
neworderofjamie Jul 7, 2024
11b1bb2
updated runtime to allocate correct sized event-related data structures
neworderofjamie Jul 7, 2024
809e8f1
updated code generation
neworderofjamie Jul 7, 2024
51717db
fixed typo
neworderofjamie Jul 7, 2024
31436b6
re-order
neworderofjamie Jul 8, 2024
0f4fafb
additional corner case suggested by Thomas
neworderofjamie Jul 8, 2024
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
Prev Previous commit
Next Next commit
tidying
neworderofjamie committed Jul 3, 2024

Verified

This commit was signed with the committer’s verified signature.
pradyunsg Pradyun Gedam
commit 79c2904cc894d47f5376b6fcdc47a7e0a2199195
2 changes: 1 addition & 1 deletion include/genn/genn/weightUpdateModels.h
Original file line number Diff line number Diff line change
@@ -184,7 +184,7 @@ class GENN_EXPORT Init : public Snippet::Init<Base>
const auto &getPostDynamicsCodeTokens() const{ return m_PostDynamicsCodeTokens; }

bool isVarHeterogeneouslyDelayedInSynCode(const std::string &name) const;

void finalise(double dt);

private:
38 changes: 15 additions & 23 deletions src/genn/genn/synapseGroup.cc
Original file line number Diff line number Diff line change
@@ -494,33 +494,25 @@ void SynapseGroup::finalise(double dt)
m_SparseConnectivityInitialiser.finalise(dt);
m_ToeplitzConnectivityInitialiser.finalise(dt);

// Determine whether any postsynaptic variable references are accessed with delay
// **NOTE** this isn't done lazily because Utils::isIdentifierDelayed also checks for consistency
bool dendriticVarDelay = false;
for(const auto &v : getWUInitialiser().getPostNeuronVarReferences()) {
dendriticVarDelay |= Utils::isIdentifierDelayed(v.first, getWUInitialiser().getPreSpikeSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.first, getWUInitialiser().getPreEventSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.first, getWUInitialiser().getPostEventSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.first, getWUInitialiser().getPostSpikeSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.first, getWUInitialiser().getSynapseDynamicsCodeTokens());
}
for(const auto &v : getWUInitialiser().getSnippet()->getPostVars()) {
dendriticVarDelay |= Utils::isIdentifierDelayed(v.name, getWUInitialiser().getPreSpikeSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.name, getWUInitialiser().getPreEventSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.name, getWUInitialiser().getPostEventSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.name, getWUInitialiser().getPostSpikeSynCodeTokens());
dendriticVarDelay |= Utils::isIdentifierDelayed(v.name, getWUInitialiser().getSynapseDynamicsCodeTokens());
}

// If there are any dendritically delayed variables, ensure postsynaptic neuron
// group has enough delay slots to encompass maximum dendritic delay timesteps
if(dendriticVarDelay) {
// Determine whether any postsynaptic neuron variable references or postsynaptic
// weight update model variables are accessed with heterogeneous delays in synapse code
const auto &postNeuronVarRefs = getWUInitialiser().getPostNeuronVarReferences();
const auto postWUVars = getWUInitialiser().getSnippet()->getPostVars();
const bool heterogeneousVarDelay =
(std::any_of(postNeuronVarRefs.cbegin(), postNeuronVarRefs.cend(),
[](const auto &v){ return getWUInitialiser().isVarHeterogeneouslyDelayedInSynCode(v.first); })
|| std::any_of(postWUVars.cbegin(), postWUVars.cend(),
[](const auto &v){ return getWUInitialiser().isVarHeterogeneouslyDelayedInSynCode(v.name); }));

// If there are any dendritically delayed variables, ensure postsynaptic
// neuron group has enough delay slots to encompass maximum dendritic delay timesteps
if(heterogeneousVarDelay) {
m_TrgNeuronGroup->checkNumDelaySlots(getMaxDendriticDelayTimesteps());
}

// If weight update uses dendritic delay but maximum number of delay timesteps hasn't been specified
if((dendriticVarDelay || isDendriticOutputDelayRequired()) && !m_MaxDendriticDelayTimesteps.has_value()) {
throw std::runtime_error("Synapse group '" + getName() + "' uses a weight update model with dendritic delays but maximum dendritic delay timesteps has not been set");
if((heterogeneousVarDelay || isDendriticOutputDelayRequired()) && !m_MaxDendriticDelayTimesteps.has_value()) {
throw std::runtime_error("Synapse group '" + getName() + "' uses a weight update model with heterogeneous dendritic delays but maximum dendritic delay timesteps has not been set");
}

// Loop through presynaptic variable references