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

Custom update merge fix #557

Merged
merged 7 commits into from
Nov 23, 2022
Merged

Custom update merge fix #557

merged 7 commits into from
Nov 23, 2022

Conversation

neworderofjamie
Copy link
Contributor

@neworderofjamie neworderofjamie commented Nov 10, 2022

In the course of my structural plasticity implementing, I found not one but two bugs in the variable reference/custom update stuff!

Merging

In general, when merging together custom updates, what the variable references target doesn't really matter - they're just pointers. However, whether variable references point to variables with VarAccessDuplication::DUPLICATE, VarAccessDuplication::SHARED etc changes the required index calculating code so this needs to be considered. This PR includes the variable duplication mode in the hashes used for merging groups and extends the unit tests to better cover corner cases in this area.

References to custom update variables

Unlike synapses and neurons which are always batched if the model is, if custom updates are batched or not depends on whether they are attached to VarAccessDuplication::DUPLICATE variables (and whether the model is batched). This means if you make references to these variables from other custom updates whether these 'downstream' custom updates should be batched should depend on whether the upstream custom update was batched as well as the mode of the variables. This PR adds a isBatched method to each variable reference and extends the unit tests to cover this.

@neworderofjamie neworderofjamie added this to the GeNN 4.9.0 milestone Nov 10, 2022
@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Base: 88.80% // Head: 88.81% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (58a8801) compared to base (0312dc5).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #557   +/-   ##
=======================================
  Coverage   88.80%   88.81%           
=======================================
  Files          76       76           
  Lines       12344    12354   +10     
=======================================
+ Hits        10962    10972   +10     
  Misses       1382     1382           
Impacted Files Coverage Δ
include/genn/genn/customUpdate.h 95.31% <100.00%> (+0.15%) ⬆️
include/genn/genn/models.h 66.66% <100.00%> (+1.44%) ⬆️
src/genn/genn/customUpdate.cc 93.65% <100.00%> (+0.10%) ⬆️
src/genn/genn/models.cc 96.39% <100.00%> (+0.16%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@neworderofjamie neworderofjamie removed the request for review from tnowotny November 10, 2022 12:19
…chedness of the variable references (overriding ``VarAccessDuplication``)
Copy link
Member

@tnowotny tnowotny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, it does get complicated with merging/ hashing/ custom updates ... but it looks like a sensible solution.

@neworderofjamie
Copy link
Contributor Author

Yeah - I feel maybe there might be some extra constraints that could be added which would simplify the whole system somewhat e.g. I'm pretty sure I haven't yet had a use-case for a custom update that simultaneously references variables in different populations of the size (although this is supported)

@neworderofjamie neworderofjamie merged commit dc50d25 into master Nov 23, 2022
@neworderofjamie neworderofjamie deleted the custom_update_merge_fix branch November 23, 2022 12:57
@neworderofjamie neworderofjamie modified the milestones: GeNN 4.9.0, GeNN 4.8.1 Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants