Automate detection of homogeneous parameters#646
Merged
neworderofjamie merged 8 commits intomasterfrom Jan 6, 2025
Merged
Conversation
…o split code path for Numeric and non-numeric fields
…oupMergedField::addField``
…eld::addParams`` and ``EnvironmentGroupMergedField::addDerivedParams``
* Don't generate functions to populate it * Don't try and call these functions at runtime
1b301d2 to
f4ef186
Compare
* Added helper to check for existence of fields rather than using old heterogeneity-testing boilerplate * Requires generating code so call code generator (with neverRebuild=true so no files get written) * Fixed various models that don't actually compile
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #646 +/- ##
==========================================
+ Coverage 87.83% 88.94% +1.11%
==========================================
Files 104 106 +2
Lines 14104 14786 +682
==========================================
+ Hits 12388 13152 +764
+ Misses 1716 1634 -82 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of the really awkward things with the initial implementation of merging groups was that we had to add a manual mechanism for detecting whether parameters (and derived parameters) were heterogeneous across the merged group or not and handle them separately. With the improved type information present in GeNN 5, it was always on my todo list to simplify and automate it so it could be applied to 'internal' parameters like number of neurons etc.
In
EnvironmentGroupMergedField::addField, we now just check that the type is const, numeric and the values match (this is the key thing as, in GeNN 4, all fields basically were just strings) and if their value is the same for all groups that are being merged together, we just substitute a constant. This means for models which don't really benefit from merging i.e. ones with a small number of populations, the code will be as efficient as it was before merging was added and this removes a load of ugly boilerplate.For example, after this change, generated code for a merged neuron update group with one 256 neuron group in looks like:
rather than: