-
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
Step 5 - Dynamic and typed parameters #607
Merged
Merged
Conversation
This file contains 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
…ype::NumericType``
…load if there's only one visitor i.e. no overload!
…ariables require queues and of variable locations. Encapsulated variable location logic in little class and tidied various bits
* added simple DynamicParameterContainer class
… and rethrow runtime error
…untime implementation * Moved data structures into GeNN::Runtime::MergedDynamicFieldDestinations (as much to make it possible to forward declare as anything else) * Made reference to runtime passed through to GroupMerged::GetFieldValueFunc non-const * Added a third variant of GroupMerged::FieldValue which returns a value AND an associated MergedDynamicFieldDestinations * Used to implement parameters in environment
…pdate and weight update
…esult in exception on test_pre_post_neuron_vars
neworderofjamie
changed the title
Dynamic and typed parameters
Step 5 -Dynamic and typed parameters
Nov 24, 2023
* reinstated logic to ignore READWRITE access to non-batched variables if custom update is batched but batch size = 1 * fixed bug in preoutput update
neworderofjamie
changed the title
Step 5 -Dynamic and typed parameters
Step 5 - Dynamic and typed parameters
Dec 6, 2023
tnowotny
approved these changes
Jan 8, 2024
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.
Approving based on our general discussion of the aims and design decisions.
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.
'Traditionally', in GeNN if you wanted to make parameters changable at runtime you had to change them to extra global parameters. Before GeNN 4.3.0, this used to be pretty efficient as they were all passed through to the device using kernel parameters (which are effectively implemented as a big block of constant cache). However, since adding the whole merging system way back in GeNN 4.3.0, this hasn't been possible so, for backward compatibility, they have been manually copied every timestep as there's no way to know when they change. Because they're very small and there are potentially lots of them this can be very inefficient. This functionality was totally removed in this trail of PRs but here we implement its replacement - dynamic parameters! Key things are:
pop.set_param_dynamic("r0")
pop.set_dynamic_param_value("r0", current_r0)
Another issue with parameters is that they didn't previously have a type. This meant in extreme cases where you have a model with lots of heterogeneous integer parameters (so the conversion couldn't be done at compile time) e.g. a big convnet with different types of convolution implemented as Toeplitz connectivity init snippets, you could actually overload the GPU special function unit just through converting all the parameters passed as
scalar
toint
. Also,scalar
is typically a 32-bit float so cannot represent the full range of a 32-bit integer. Fixing this wasn't particularly difficult, just required passing types through from theParamValues
to the parameters. However you need to be able to specify parameters in some way and, back in #595, I addedNumericValue
which is now exposed to python and, in this PR, used for just this.Fear not, there is only one step to go until we have something resembling a release candidate!