-
Notifications
You must be signed in to change notification settings - Fork 57
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #629 +/- ##
==========================================
+ Coverage 88.27% 88.33% +0.06%
==========================================
Files 106 106
Lines 14546 14675 +129
==========================================
+ Hits 12840 12963 +123
- Misses 1706 1712 +6 ☔ View full report in Codecov by Sentry. |
…c delay ring-buffer
…g to be used for standard quantifiers replaced with simple isConst boolean
…pdate model uses addToPostDelay
…c delay to correctly set max dendritic delay
…th or without delayed [] syntax and unit test
…mesteps if any delayed accesses occur
* Helper in weight update init to determine if variable is accessed with a heterogeneous delay in synapse code * Added methods to relevant adaptors to call helper * Use addVarRefsHet in SynapseGroupMerged to generate appropriate index code
…ptic weight update model variables
… SynapseGroup::isDendriticOutputDelayRequired
* Track which variables are heterogeneously delayed (like m_VarQueued in neuron group) * Include this in appropriate postsynaptic hashes * Use this to determine when postsyanptic WUM variables need manually copying between slots
…and use to correctly size view of postsynaptic weight update model variables
…ight update variables with delay
02f4e3c
to
fb4b3ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it all makes sense. For a moment I thought the test for the continuous reverse delay synapse was a bit weak in that it did not test that reverse add could happen at different times and not test from which synapse/post neuron the reverse input was coming, but on reflection, it seems unlikely one can pass the current test if there was a bug.
This PR enables you to access postsynaptic neuron variable references and postsynaptic weight update model variables in synapse code (pre, post spike/spike-like event triggered or synapse dynamics) using an array subscript expression to specify a potentially heterogeneous delay slot e.g.
x_post[d]
. This interacts with the existing delay system as follows:[]
syntax[]
syntaxOne side effect of this change is that neuron groups might now have some variables which require queueing but no axonal/backpropagation delays applied to their spikes. This resulted in unnecessarily complex code being generated for spike handling so I have extended the existing tracking of which variables are queued to also track whether spikes or spike events are queued.
The handling of the actual
[d]
syntax is implemented by addingx_post
to the type system as a special sort of function (with signaturescalar x_post(int index)
(assuming the type ofx_post
isscalar
). These functions are tagged with theType::FunctionFlags::ARRAY_SUBSCRIPT_OVERRIDE
flag. The type checker and pretty printer then treat,[]
as a special sort of function call which enables all the existing substitution magic used to stick code behind functions to be used.In the process of making this change, I tidied up a few things:
addToPostDelay
is called or the new[]
syntax is used in synapse code but no maximum number of dendritic delay steps has been specified.const
so I have simplified a bunch of code by replacing this with a simple bool. Conversely, function types do need some more flags so replacedvariadic
boolean with some flags (now includingType::FunctionFlags::ARRAY_SUBSCRIPT_OVERRIDE
)addToPre
functions etc actually vary depending on what typescalar
is so constants likeType::AddToPre
have been replaced by functions likeType::getAddToPre(Type::Float)
which generate the right function type.EnvironmentLocalVarCache
was unnecessarily complex - the adaptor type being passed in already provides the required information about delay an 99% of the time this is what determines whether variables should be copied between delay slots every timestep.