genn
genn copied to clipboard
Avoiding creating unused variables
I'm renaming this thread as we have other instances of unused variable type of problems and it would be nice to take care of this in a more systematic way during code generation.
The previous thread consisted of the warnings on: Unused variable warning for ipost, ipre for GLOBALG used with NSYNAPSE model
This happens in the SynDelay project. It is not as straightforward as it seems; indexing is not necessary when we use GLOBAL, but if we had a synapse model with a variable that uses these indices they would be needed. These are just warnings at the moment, but it would be more elegant to make a proper check.
Another example of this kind of problem is unnecessary post-to-pre arrays for sparse connectivity. They are (presumably) not needed unless the learning kernel is used.
Creating unnecessary variables would fill the memory unnecessarily and we should avoid this.
Hi @esinyavuz: Can I work on the ticket?
Hi @tapaswenipathak,
I'm afraid @esinyavuz has left the project, but you're more than welcome to work on this ticket! GeNN's code generator has been somewhat refactored since this issue was created so there are less of these issues but, looking through our build server's output, the following two unused variables are definitely still being created by GeNN's CUDA backend:
-
shSpk
created here - as well as the existing tests, this should only be created if any of the synapse groups have theirm_SpanType
set toSynapseGroup::SpanType::POSTSYNAPTIC
-
synAddress
created here - this is rather more tricky as it depends upon whether$(id_syn)
is referenced in the subsequently generated code. -
synAddress
(a difference one!) created here - again a little more tricky as it depends upon whether$(id_syn)
is referenced in the subsequently generated code.
Thanks for the notes @neworderofjamie.
@neworderofjamie: No synAddress
can be removed as per me, can you take a look?