Skip to content

Commit

Permalink
Setting delay_dendritic to zero is unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgait committed Sep 18, 2023
1 parent b570da6 commit 2451f72
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ struct synapse_row_plastic_data_t {
plastic_synapse_t synapses[];
};

//void _print_pre_event_history(pre_event_history_t pre_eve_hist){
//
// io_printf(IO_BUF, "\n\n************************\n\n");
// io_printf(IO_BUF, "Number recorded MF spikes: %u\n",
// pre_eve_hist.num_recorded_mf_spikes_minus_one);
// io_printf(IO_BUF, "Prev time: %u\n",
// pre_eve_hist.mf_times[pre_eve_hist.num_recorded_mf_spikes_minus_one]);
//
// for (int i = 0; i < NUM_MF_SPIKES_TO_RECORD; i++){
// io_printf(IO_BUF, " Entry %u: %u\n", i, pre_eve_hist.mf_times[i]);
// }
//}

//---------------------------------------
// Synapse update loop
//---------------------------------------
Expand All @@ -78,59 +65,30 @@ static inline final_state_t plasticity_update_synapse(
window_begin_time, window_end_time, post_window.prev_time,
post_window.num_events);

// if (print_plasticity){
// io_printf(IO_BUF, " Printing PC history\n");
// print_event_history(post_event_history);
// }
//
// if (print_plasticity){
// io_printf(IO_BUF, "\n############ Phase 1 #############\n");
// io_printf(IO_BUF, "\n Looping over PC spikes:\n");
// }

delay_dendritic = 0;

// Process events in post-synaptic window
while (post_window.num_events > 0) {
const uint32_t delayed_post_time = *post_window.next_time
+ delay_dendritic;

uint32_t mf_begin_time = (delayed_post_time < 255) ? 0 : (delayed_post_time - 255);


post_event_window_t pre_window = post_events_get_window_delayed(
pre_event_history, mf_begin_time, delayed_post_time);

// if (print_plasticity){
// io_printf(IO_BUF, " Looping over MF window for this PC spike: %u \n",
// delayed_post_time);
// }

while (pre_window.num_events > 0) {

const uint32_t delayed_pre_time = *pre_window.next_time
+ delay_dendritic;

// if (print_plasticity){
// io_printf(IO_BUF, " MF Spike: %u \n", delayed_pre_time);
//
// io_printf(IO_BUF, " delta t = %u (delayed MF = %u, delayed PC = %u)\n",
// delayed_post_time - delayed_pre_time,
// delayed_pre_time,
// delayed_post_time);
// }

current_state = timing_apply_post_spike(
delayed_post_time, *post_window.next_trace,
(delayed_post_time - delayed_pre_time),
last_pre_trace, post_window.prev_time, post_window.prev_trace,
current_state);

pre_window = post_events_next(pre_window);

}


// Go onto next event
post_window = post_events_next(post_window);
}
Expand All @@ -143,24 +101,9 @@ static inline final_state_t plasticity_update_synapse(
post_event_window_t fwd_post_window = post_events_get_window_delayed(
post_event_history, fwd_window_begin_time, window_end_time);


// if (print_plasticity){
// io_printf(IO_BUF, "\n############ Phase 2 #############\n");
// io_printf(IO_BUF,
// " Looping over all PC spikes and comparing to latest MF spike at: %u\n",
// time+delay_dendritic);
// }

while (fwd_post_window.num_events > 0) {
const uint32_t delayed_mf_time = *fwd_post_window.next_time + delay_dendritic;

// if (print_plasticity){
// io_printf(IO_BUF, " PC spike: %u, dt: %u\n",
// delayed_mf_time,
// (time+delay_dendritic - delayed_mf_time)
// );
// }

// Some of these variables aren't used
current_state = timing_apply_post_spike(
delayed_mf_time, *fwd_post_window.next_trace,
Expand All @@ -171,17 +114,10 @@ static inline final_state_t plasticity_update_synapse(
fwd_post_window = post_events_next(fwd_post_window);
}

// **************

const uint32_t delayed_pre_time = time + delay_axonal;

// if (print_plasticity){
// log_debug("\t\tApplying pre-synaptic event at time:%u last post time:%u\n",
// delayed_pre_time, post_window.prev_time);
// }

// Apply spike to state
// **NOTE** dendritic delay is subtracted
// **NOTE** dendritic delay is subtracted already
current_state = timing_apply_pre_spike(
delayed_pre_time, new_pre_trace, delayed_last_pre_time, last_pre_trace,
post_window.prev_time, post_window.prev_trace, current_state);
Expand All @@ -190,29 +126,6 @@ static inline final_state_t plasticity_update_synapse(
return synapse_structure_get_final_state(current_state);
}

//---------------------------------------
// Synaptic row plastic-region implementation
//---------------------------------------
//static inline plastic_synapse_t* _plastic_synapses(
// address_t plastic_region_address) {
// const uint32_t pre_event_history_size_words =
// sizeof(pre_event_history_t) / sizeof(uint32_t);
// static_assert(pre_event_history_size_words * sizeof(uint32_t)
// == sizeof(pre_event_history_t),
// "Size of pre_event_history_t structure should be a multiple"
// " of 32-bit words");
//
// return (plastic_synapse_t*)
// (&plastic_region_address[pre_event_history_size_words]);
//}
//
////---------------------------------------
//static inline pre_event_history_t *_plastic_event_history(
// address_t plastic_region_address) {
// return (pre_event_history_t*) (&plastic_region_address[0]);
//}


//---------------------------------------
static inline index_t sparse_axonal_delay(uint32_t x) {
#if 1
Expand Down Expand Up @@ -277,10 +190,6 @@ bool synapse_dynamics_process_plastic_synapses(
weight_t *ring_buffers, uint32_t time, uint32_t colour_delay,
bool *write_back) {

// if (print_plasticity){
// io_printf(IO_BUF, "\n############ New Plasticity Update #############\n");
// }

// Extract separate arrays of plastic synapses (from plastic region),
// Control words (from fixed region) and number of plastic synapses
plastic_synapse_t *plastic_words = plastic_region_address->synapses;
Expand All @@ -303,12 +212,7 @@ bool synapse_dynamics_process_plastic_synapses(
post_events_add(time - colour_delay, &plastic_region_address->history, 0);

// Update pre-synaptic trace
// if (print_plasticity){
// io_printf(IO_BUF,
// "\nAdding pre-synaptic event (mossy fibre spike) at time: %u\n\n", time);
// }

timing_add_pre_spike(time - colour_delay, last_pre_time, 0); // last_pre_trace);
timing_add_pre_spike(time - colour_delay, last_pre_time, last_pre_trace);

// Loop through plastic synapses
for (; n_plastic_synapses > 0; n_plastic_synapses--) {
Expand All @@ -323,21 +227,12 @@ bool synapse_dynamics_process_plastic_synapses(
plastic_words++;
}

// if (print_plasticity){
// io_printf(IO_BUF, "\n############ Completed Plasticity Update #############\n");
// }

*write_back = true;
return true;
}

void synapse_dynamics_process_post_synaptic_event(
uint32_t time, index_t neuron_index) {

// if (print_plasticity){
// log_debug("Adding post-synaptic event (PC spike)to history at time:%u", time);
// }

// Add post-event
post_event_history_t *history = &post_event_history[neuron_index];
const uint32_t last_post_time = history->times[history->count_minus_one];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ struct synapse_row_plastic_data_t {
plastic_synapse_t synapses[];
};

void _print_pre_event_history(pre_event_history_t pre_eve_hist){

io_printf(IO_BUF, "\n\n************************\n\n");
io_printf(IO_BUF, "Number recorded spikes: %u\n", pre_eve_hist.num_recorded_pf_spikes_minus_one);
io_printf(IO_BUF, "Prev time: %u\n",
pre_eve_hist.pf_times[pre_eve_hist.num_recorded_pf_spikes_minus_one]);

for (int i = 0; i < NUM_PF_SPIKES_TO_RECORD; i ++){
io_printf(IO_BUF, " Entry %u: %u\n", i, pre_eve_hist.pf_times[i]);
}

}

//---------------------------------------
// Synapse update loop
//---------------------------------------
Expand All @@ -75,56 +62,21 @@ static inline final_state_t plasticity_update_synapse(
post_event_window_t post_window = post_events_get_window_delayed(
post_event_history, window_begin_time, window_end_time);


// if (print_plasticity){
// log_info("\tPerforming deferred synapse update at time:%u", time);
// log_info("\t\tbegin_time:%u, end_time:%u - prev_time:%u, num_events:%u",
// window_begin_time, window_end_time, post_window.prev_time,
// post_window.num_events);
// io_printf(IO_BUF, " Printing CF history\n");
// print_event_history(post_event_history);
// }

// if (print_plasticity){
// io_printf(IO_BUF, "\n Looping over climbing fibre spikes:\n");
// }

delay_dendritic = 0;

// Process events in post-synaptic window
while (post_window.num_events > 0) {
const uint32_t delayed_post_time = *post_window.next_time
+ delay_dendritic;

uint32_t pf_begin_time = (delayed_post_time < 255) ? 0 : (delayed_post_time - 255);

// if (print_plasticity){
// io_printf(IO_BUF, " Applying post-synaptic event at delayed time:%u\n",
// delayed_post_time);
// }

post_event_window_t pre_window = post_events_get_window_delayed(
pre_event_history, pf_begin_time, delayed_post_time);

// if (print_plasticity){
// io_printf(IO_BUF, " Looping over PF window for this CF spike\n",
// delayed_post_time);
// }

while (pre_window.num_events > 0) {

const uint32_t delayed_pre_time = *pre_window.next_time
+ delay_dendritic;

// if (print_plasticity){
// io_printf(IO_BUF, " PF Spike: %u \n", delayed_pre_time);
//
// io_printf(IO_BUF, " delta t = %u (delayed PF = %u, delayed CF = %u)\n",
// delayed_post_time - delayed_pre_time,
// delayed_pre_time,
// delayed_post_time);
// }

current_state = timing_apply_post_spike(
delayed_post_time, *post_window.next_trace,
(delayed_post_time - delayed_pre_time),
Expand All @@ -141,13 +93,8 @@ static inline final_state_t plasticity_update_synapse(

const uint32_t delayed_pre_time = time + delay_axonal;

// if (print_plasticity){
// log_debug("\t\tApplying pre-synaptic event at time:%u last post time:%u\n",
// delayed_pre_time, post_window.prev_time);
// }

// Apply spike to state
// **NOTE** dendritic delay is subtracted
// **NOTE** dendritic delay is subtracted already
current_state = timing_apply_pre_spike(
delayed_pre_time, new_pre_trace, delayed_last_pre_time, last_pre_trace,
post_window.prev_time, post_window.prev_trace, current_state);
Expand Down Expand Up @@ -265,11 +212,6 @@ bool synapse_dynamics_process_plastic_synapses(
post_events_add(time - colour_delay, &plastic_region_address->history, 0);

// Update pre-synaptic trace
// if (print_plasticity){
// io_printf(IO_BUF,
// "\nAdding pre-synaptic event (parallel fibre spike) at time: %u\n\n", time);
// }

timing_add_pre_spike(time - colour_delay, last_pre_time, last_pre_trace);

// Loop through plastic synapses
Expand All @@ -291,11 +233,6 @@ bool synapse_dynamics_process_plastic_synapses(

void synapse_dynamics_process_post_synaptic_event(
uint32_t time, index_t neuron_index) {

// if (print_plasticity){
// log_debug("Adding post-synaptic event to trace at time:%u", time);
// }

// Add post-event
post_event_history_t *history = &post_event_history[neuron_index];
const uint32_t last_post_time = history->times[history->count_minus_one];
Expand Down

0 comments on commit 2451f72

Please sign in to comment.