[ISSUE-7, 10] Moved all model-specific defaults from Global.h to appropriate model classes#928
Open
CodersRepo wants to merge 11 commits intoSharedDevelopmentfrom
Open
[ISSUE-7, 10] Moved all model-specific defaults from Global.h to appropriate model classes#928CodersRepo wants to merge 11 commits intoSharedDevelopmentfrom
CodersRepo wants to merge 11 commits intoSharedDevelopmentfrom
Conversation
Issue 907 add contributor
…fault-cleanup [ISSUE-7] Moved all model-specific defaults from Global.h to appropriate model classes
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the simulator’s neuroscience models to remove model-specific default constants from Simulator/Utils/Global.h and place them into the owning neuron/synapse classes, improving encapsulation and addressing inconsistencies noted in #7 and #10.
Changes:
- Moved IF neuron default parameters from
Global.hintoAllIFNeurons(static constexpr). - Moved spiking synapse defaults (
tau,U, delay weight) intoAllSpikingSynapsesand updated host/GPU code paths to reference them. - Removed the corresponding
#define DEFAULT_*macros fromGlobal.h.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Simulator/Vertices/Neuro/AllIFNeurons.h | Adds static constexpr IF neuron defaults to the model class. |
| Simulator/Vertices/Neuro/AllIFNeurons.cpp | Switches neuron initialization to use AllIFNeurons::DEFAULT_* values. |
| Simulator/Utils/Global.h | Removes model-specific default macros from the global header. |
| Simulator/Edges/Neuro/AllSynapsesDeviceFuncs_d.cpp | Updates CUDA device-side synapse creation defaults to use AllSpikingSynapses::DEFAULT_* and adds required include. |
| Simulator/Edges/Neuro/AllSpikingSynapses.h | Introduces static constexpr defaults for spiking synapses. |
| Simulator/Edges/Neuro/AllSpikingSynapses.cpp | Uses the new AllSpikingSynapses::DEFAULT_tau in edge creation. |
| Simulator/Edges/Neuro/AllDynamicSTDPSynapses.cpp | Replaces DEFAULT_U usage with AllSpikingSynapses::DEFAULT_U. |
| Simulator/Edges/Neuro/AllDSSynapses.cpp | Replaces DEFAULT_U usage with AllSpikingSynapses::DEFAULT_U. |
| Contributors.md | Adds a 2026 entry. |
Comments suppressed due to low confidence (2)
Simulator/Edges/Neuro/AllSynapsesDeviceFuncs_d.cpp:120
- In createSpikingSynapse(), the switch(type) has a
default: break;and thentau/delayare used to compute decay/totalDelay. If an unexpected edgeType reaches here, this will use uninitialized values (UB) on the device. Consider asserting in the default case (like the CPU path does) or initializingtau/delayto safe defaults before the switch.
allEdgesDevice->tau_[iEdg] = AllSpikingSynapses::DEFAULT_tau;
BGFLOAT tau;
switch (type) {
case edgeType::II:
Simulator/Edges/Neuro/AllSynapsesDeviceFuncs_d.cpp:267
- In createSTDPSynapse(), the switch(type) has a
default: break;buttau/delayare used immediately afterwards to compute decay/totalDelay. If type is outside {II, IE, EI, EE}, this will use uninitialized values on the device. Recommend asserting in the default branch or settingtau/delaydefaults before the switch.
allEdgesDevice->tau_[iEdg] = AllSpikingSynapses::DEFAULT_tau;
BGFLOAT tau;
switch (type) {
case edgeType::II:
| static constexpr BGFLOAT DEFAULT_InhibTrefract | ||
| = 2.0e-3; // The default absolute refractory period for inhibitory neurons | ||
| static constexpr BGFLOAT DEFAULT_ExcitTrefract | ||
| = 3.0e-3; // The default absolute refractory period for excitory neurons |
Comment on lines
+181
to
185
| allEdgesDevice->U_[iEdg] = AllSpikingSynapses::DEFAULT_U; | ||
| allEdgesDevice->tau_[iEdg] = AllSpikingSynapses::DEFAULT_tau; | ||
|
|
||
| BGFLOAT U; | ||
| BGFLOAT D; |
Comment on lines
346
to
+350
| allEdgesDevice->lastSpike_[iEdg] = ULONG_MAX; | ||
| allEdgesDevice->type_[iEdg] = type; | ||
|
|
||
| allEdgesDevice->U_[iEdg] = DEFAULT_U; | ||
| allEdgesDevice->tau_[iEdg] = DEFAULT_tau; | ||
| allEdgesDevice->U_[iEdg] = AllSpikingSynapses::DEFAULT_U; | ||
| allEdgesDevice->tau_[iEdg] = AllSpikingSynapses::DEFAULT_tau; |
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.
Closes #7 #10
Description
Checklist (Mandatory for new features)
Testing (Mandatory for all changes)
test-medium-connected.xmlPassedtest-large-long.xmlPassed