diff --git a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp index dc3493a87bb9bd10452ea8e9da7a416367656e8c..2c2a23d36c29af6ec308dbbfeda20011b6691c55 100644 --- a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp +++ b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp @@ -1064,6 +1064,11 @@ void RuntimeController::findTargetConfiguration(float goal, configurationIdx); } +/*** This routine takes as input goal (target speedup) and computes the probabilty of selecting the higher configuration + (one with higher than target speedup) and probability of lower configuration (config with lower than target speedup). + + Motivation: The Pareto curve often does not have a configuration providing the exact req speedup +***/ void RuntimeController::adjustTargetConfiguration(float goal) { DEBUG("adjustTargetConfiguration: goalVal: %f.\n\n", goal); @@ -1077,53 +1082,22 @@ void RuntimeController::adjustTargetConfiguration(float goal) { // Get the two configurations' speedup, and compute the appropriate ranges float curr_conf_speedup = (*Configurations)[configurationIdx]->speedup; float prev_conf_speedup = (*Configurations)[prev_conf_idx]->speedup; - float sp_diff = curr_conf_speedup - prev_conf_speedup; + // Computation of how far the target speedup is for lower and higher speedup config + float sp_diff = curr_conf_speedup - prev_conf_speedup; float high_range = curr_conf_speedup - goal; float low_range = goal - prev_conf_speedup; // These represent how likely we are to pick the upper or lower configuration float high_pb = 0.0, low_pb = 0.0; + if (configurationIdx == prev_conf_idx) { high_pb = low_pb = 1.0; - } else { + } + else { + // Compute the probabitly of selection for higher config and lower config high_pb = low_range / sp_diff; low_pb = high_range / sp_diff; - - //***--- Probability adjustment strategy 1 ---***// - // No big adjustments at edges of probability range - // float adjust_val = 0.0; - // if (low_pb < high_pb) { - // adjust_val = low_pb * 0.2; - // } else { - // adjust_val = high_pb * 0.2; - // } - // low_pb -= adjust_val; - // high_pb += adjust_val; - //***--- ---***// - - //***--- Probability adjustment strategy 2 ---***// - // No big adjustment at high edge of probability range - // float adjust_val = high_pb * 0.2 > 0.1 ? 0.1 : high_pb * 0.2; - // low_pb -= adjust_val; - // high_pb += adjust_val; - //***--- ---***// - - //***--- Probability adjustment strategy 3 ---***// - // Similar to 2, but higher always increases, more significantly - // float adjust_val = low_pb * 0.5 > 0.1 ? 0.1 : low_pb * 0.5; - // low_pb -= adjust_val; - // high_pb += adjust_val; - //***--- ---***// - - //***--- Probability adjustment strategy 4 ---***// - // Similar to 2, but higher always increases, more significantly - // Low end, high end a bit less aggressive than total range - float adjust_val = low_pb * 0.6 > 0.2 ? 0.2 : low_pb * 0.6; - adjust_val = adjust_val > high_pb ? high_pb : adjust_val; - low_pb -= adjust_val; - high_pb += adjust_val; - //***--- ---***// } DEBUG("**---- adjustTargetConfiguration: upper conf = %s with probability: " @@ -1212,7 +1186,7 @@ uint32_t *hpvm_rt_readLabelsBatch_cached(const char *labels_file, int start, static float average_accuracy = 0.0; static int num_executations = 0; -//*** Copied from dnn_sources/include/utils.h ***// + float hpvm_rt_computeAccuracy3(uint32_t *labels, void *result_ptr) { struct Tensor *result = (struct Tensor *)result_ptr;