macsim/macsim-seq.c
// compute a latency vs throughtput diagram
// by systematically incresing the injection rate
//
// possible improvements:
//   * increase accuracy by avoiding floating point math by using conf_inj_prob
//     instead of conf_inj_rate
//   * let user change conf_eval_cycles (duration of one measurement)
//   * warm up phase before actual measurement
//   * cool down: compute latency of remaining messages after end of interval
compute a latency vs throughtput diagram
by systematically incresing the injection rate

possible improvements:
increase accuracy by avoiding floating point math by using conf_inj_prob
instead of conf_inj_rate
let user change conf_eval_cycles (duration of one measurement)
warm up phase before actual measurement
cool down: compute latency of remaining messages after end of interval
compute a latency vs throughtput diagram by systematically incresing the injection rate possible improvements : increase accuracy by avoiding floating point math by using conf_inj_prob instead of conf_inj_rate let user change conf_eval_cycles ( duration of one measurement ) warm up phase before actual measurement cool down : compute latency of remaining messages after end of interval
void latency_vs_throughput()
{
    core_printf(0, "target/real injrate latency #flits total latency\n");
    double step = 1.0 / conf_max_rank; 
    double rise_ir = 0.0; 
    double lat;
    double prev_lat;
    double desired_ir = step;
    double ir = print_one_point(desired_ir, &lat);
    double zero_load_latency = lat;
    while ((ir/desired_ir)>0.95) {
        prev_lat = lat;
        desired_ir += step;
        ir = print_one_point(desired_ir, &lat);
        if (rise_ir==0.0 && (lat > 2.0*prev_lat)) rise_ir = desired_ir-step;
    }
    if (rise_ir==0.0) rise_ir = desired_ir-step;
    float saturation_ir = ir;
    step = saturation_ir - rise_ir;
    desired_ir = rise_ir;
    while (step > 0.0001) {
        step = step * 0.5;
        desired_ir += step;
        ir = print_one_point(desired_ir, &lat);
    }
    step = 1.0 / conf_max_rank; 
    while (lat < 1000.0*zero_load_latency && desired_ir<1.0) {
        desired_ir += step;
        ir = print_one_point(desired_ir, &lat);
        if (ir > saturation_ir) saturation_ir = ir;
    }
    core_printf(0, "saturation throughput: %g flits/core/cycle\n", saturation_ir);
}
void latency_vs_throughput ( ) { core_printf ( 0 , " \n " ) ; double step = 1.0 / conf_max_rank ; double rise_ir = 0.0 ; double lat ; double prev_lat ; double desired_ir = step ; double ir = print_one_point ( desired_ir , & lat ) ; double zero_load_latency = lat ; while ( ( ir / desired_ir ) > 0.95 ) { prev_lat = lat ; desired_ir += step ; ir = print_one_point ( desired_ir , & lat ) ; if ( rise_ir == 0.0 && ( lat > 2.0 * prev_lat ) ) rise_ir = desired_ir - step ; } if ( rise_ir == 0.0 ) rise_ir = desired_ir - step ; float saturation_ir = ir ; step = saturation_ir - rise_ir ; desired_ir = rise_ir ; while ( step > 0.0001 ) { step = step * 0.5 ; desired_ir += step ; ir = print_one_point ( desired_ir , & lat ) ; } step = 1.0 / conf_max_rank ; while ( lat < 1000.0 * zero_load_latency && desired_ir < 1.0 ) { desired_ir += step ; ir = print_one_point ( desired_ir , & lat ) ; if ( ir > saturation_ir ) saturation_ir = ir ; } core_printf ( 0 , " \n " , saturation_ir ) ; }
compute a latency vs throughtput diagram
by systematically incresing the injection rate
compute a latency vs throughtput diagram by systematically incresing the injection rate
// phase 1: // Start with 1 flit/NoC/cycle and compute zero-load latency. // one flit/cycle in the whole NoC // injrate before a significant rise or saturation // phase 2: // Increase injection rate in steps of 1 flit/NoC/cycle, // until the measured injrate is more than 5% below the desired value // remember the injrate, if significant rise of latency // phase 3: // We reached the saturation throughput. // Now inspect the interal between the last injrate before the raise // and the saturation injrate logarithmically // phase 4: // Further increase injrate to see if we can achieve a higher saturation // throughput. Stop when the latency is 1000x the zero load latency. // one flit/cycle in the whole NoC