genn icon indicating copy to clipboard operation
genn copied to clipboard

Avoiding creating unused variables

Open esinyavuz opened this issue 10 years ago • 4 comments

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.

esinyavuz avatar Jan 29 '15 17:01 esinyavuz

Hi @esinyavuz: Can I work on the ticket?

tapaswenipathak avatar Jul 24 '19 19:07 tapaswenipathak

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:

  1. shSpk created here - as well as the existing tests, this should only be created if any of the synapse groups have their m_SpanType set to SynapseGroup::SpanType::POSTSYNAPTIC
  2. synAddress created here - this is rather more tricky as it depends upon whether $(id_syn) is referenced in the subsequently generated code.
  3. 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.

neworderofjamie avatar Jul 25 '19 08:07 neworderofjamie

Thanks for the notes @neworderofjamie.

tapaswenipathak avatar Jul 27 '19 11:07 tapaswenipathak

@neworderofjamie: No synAddress can be removed as per me, can you take a look?

tapaswenipathak avatar Aug 24 '19 10:08 tapaswenipathak