From 922ca517c666b00737f3ee21c37185674541dbe2 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Thu, 15 Dec 2022 12:14:49 +0000 Subject: [PATCH 1/2] Apply delay check correctly and increment skipped in mad impl --- .../synapse_dynamics_stdp_izhikevich_neuromodulation.c | 2 +- .../plasticity/stdp/synapse_dynamics_stdp_mad_impl.c | 8 ++++++-- neural_modelling/src/neuron/synapses.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_izhikevich_neuromodulation.c b/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_izhikevich_neuromodulation.c index 04be151774..e2b4181112 100644 --- a/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_izhikevich_neuromodulation.c +++ b/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_izhikevich_neuromodulation.c @@ -411,7 +411,7 @@ static inline neuromodulated_synapse_t process_plastic_synapse( &post_event_history[s.index]); // Add weight to ring-buffer entry, but only if not too late - if (s.delay_dendritic + s.delay_axonal >= colour_delay) { + if (s.delay_dendritic + s.delay_axonal > colour_delay) { synapse_dynamics_stdp_update_ring_buffers(ring_buffers, s, final_state.weight); } else { diff --git a/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_impl.c b/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_impl.c index bb690f1d99..f4c792adf6 100644 --- a/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_impl.c +++ b/neural_modelling/src/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_impl.c @@ -28,6 +28,8 @@ struct synapse_row_plastic_data_t { plastic_synapse_t synapses[]; }; +extern uint32_t skipped_synapses; + //--------------------------------------- //! \brief Synapse update loop core //! \param[in] time: The current time @@ -214,10 +216,12 @@ static inline plastic_synapse_t process_plastic_synapse( &post_event_history[s.index]); // Add weight to ring-buffer entry, but only if not too late - if (s.delay_axonal + s.delay_dendritic >= colour_delay) { + if (s.delay_axonal + s.delay_dendritic > colour_delay) { int32_t weight = synapse_structure_get_final_weight(final_state); synapse_dynamics_stdp_update_ring_buffers(ring_buffers, s, weight); - } + } else { + skipped_synapses++; + } return synapse_structure_get_final_synaptic_word(final_state); } diff --git a/neural_modelling/src/neuron/synapses.c b/neural_modelling/src/neuron/synapses.c index 92f64942c0..cfc7a6ccbd 100644 --- a/neural_modelling/src/neuron/synapses.c +++ b/neural_modelling/src/neuron/synapses.c @@ -222,7 +222,7 @@ static inline bool process_fixed_synapses( uint32_t synaptic_word = *synaptic_words++; // If the delay is too small, skip - if ((synaptic_word & synapse_delay_mask_shifted) < colour_delay_shifted) { + if ((synaptic_word & synapse_delay_mask_shifted) <= colour_delay_shifted) { skipped_synapses++; continue; } From a5006208133c1678a84dad918a6e96c92dc67fb5 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Thu, 15 Dec 2022 14:55:40 +0000 Subject: [PATCH 2/2] Don't skip if the (shifted) value is zero --- neural_modelling/src/neuron/synapses.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neural_modelling/src/neuron/synapses.c b/neural_modelling/src/neuron/synapses.c index cfc7a6ccbd..2d020c8b10 100644 --- a/neural_modelling/src/neuron/synapses.c +++ b/neural_modelling/src/neuron/synapses.c @@ -221,8 +221,9 @@ static inline bool process_fixed_synapses( // (should auto increment pointer in single instruction) uint32_t synaptic_word = *synaptic_words++; - // If the delay is too small, skip - if ((synaptic_word & synapse_delay_mask_shifted) <= colour_delay_shifted) { + // If the (shifted) delay is non zero and too small, skip + if (((synaptic_word & synapse_delay_mask_shifted) != 0) && + ((synaptic_word & synapse_delay_mask_shifted) <= colour_delay_shifted)) { skipped_synapses++; continue; }