-
Notifications
You must be signed in to change notification settings - Fork 64
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
Kernel merging #286
Kernel merging #286
Conversation
…ormally have to hand
… i.e. snippets bound to parameters
…ble to run simple neuron-only models
…in NeuronGroup::addOutSyn
…o 2019 - correct fix will be to upgrade gtest
…- derived parameters can only be substituted in ``ModelSpec::finalize``
Codecov Report
@@ Coverage Diff @@
## master #286 +/- ##
==========================================
+ Coverage 84.27% 87.74% +3.46%
==========================================
Files 47 60 +13
Lines 7150 8331 +1181
==========================================
+ Hits 6026 7310 +1284
+ Misses 1124 1021 -103
Continue to review full report at Codecov.
|
…only appears on mac * Forgot to remove hack in cudaMemsetting of bitmask connectivity * Fixed copy-and-paste bug in allocation of bitmask
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.
I think I understand the rough design and it seems sensible albeit the entire effort makes me feel ever so slightly uneasy because of the growing complexity of things. That been said, the results support your thinking and maybe it is simply unavoidable.
So, I will approve the pull request and hopefully we won't regret it later ;-)
Glad you approve! I totally share your slight unease about the added complexity but it does seem necessary going forwards |
# Conflicts: # src/genn/backends/cuda/backend.cc # src/genn/backends/single_threaded_cpu/backend.cc # src/genn/genn/code_generator/generateRunner.cc
So here it is - as forewarned - it's a bit of a beast, but I think a necessary one! I'm going to attempt to explain the logic with pointers into the code and samples of generated code here:
ModelSpecMerged
is created from theModelSpec
in https://github.com/genn-team/genn/blob/kernel_merging/src/genn/genn/code_generator/generateAll.cc#L54. This calls methods likeNeuronGroup::canBeMerged
which in turn call methods likeNeuronModels::Base::canBeMerged
to determine which groups can be merged. There's a lot of nuance here so I've added quite a few unit tests at both levels (hence the increse in test coverage). TheModelSpecMerged
contains vectors ofNeuronGroupMerged
andSynapseGroupMerged
for each kernel, each of which is a simple class containing an archetypeNeuronGroup
/SynapseGroup
used as the basis for code generation and a vector containingNeuronGroup
/SynapseGroup
which can be simulated with the same code.MergedStructGenerator
class also builds an array of these structs, pointing to existing allocated arrays etc, something like:__device__ __constant__
) and push functions (in CUDA usingcudaMemcpyToSymbol
) to copy these to device.dd_
device symbols) e.g. in the start of a neuron kernel:There is additional complexity around extra global parameters as they need updating within the structure but, more or less, the same basic system is used for all kernel types (including initialization).
I don't think the result is perfect yet but, I think getting it merged and fixing small things in seperate pull requests is the answer rather than making this even more complex:
Fixes #260