Skip to content
Snippets Groups Projects
Commit 641b8c2f authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Adding new map from TensorID to NodeConfigurations

parent 71e970f4
No related branches found
No related tags found
No related merge requests found
...@@ -167,8 +167,7 @@ public: ...@@ -167,8 +167,7 @@ public:
// - energy // - energy
// - accuracy (compared to golden output) // - accuracy (compared to golden output)
// - accuracy loss (compared to baseline) // - accuracy loss (compared to baseline)
// - a hardware choice and set or operations-approximation choices, described in // - a hardware choice and set or operations-approximation choices, described in setup
// setup
struct Configuration { struct Configuration {
std::string name; std::string name;
float speedup; float speedup;
...@@ -176,6 +175,8 @@ struct Configuration { ...@@ -176,6 +175,8 @@ struct Configuration {
float accuracy; float accuracy;
float accuracyLoss; float accuracyLoss;
std::map<std::string, NodeConfiguration *> setup; std::map<std::string, NodeConfiguration *> setup;
// map for mapping visc.node.id IDs to HPVM (fused) node approx-configurations
std::map<int, NodeConfiguration *> idConfigMap;
Configuration(std::string &n, float f, float e, float a, float al); Configuration(std::string &n, float f, float e, float a, float al);
......
...@@ -428,6 +428,8 @@ void RuntimeController::init(const char *Cstr, const char *Qstr) { ...@@ -428,6 +428,8 @@ void RuntimeController::init(const char *Cstr, const char *Qstr) {
readQuantizationFile(Qstr); readQuantizationFile(Qstr);
readConfigurationFile(Cstr); readConfigurationFile(Cstr);
// NOTE: Configurations is pareto-configs. InitialConfigurations is the full list (config file)
Configurations = NULL; Configurations = NULL;
computeParetoConfigurationPoints(); computeParetoConfigurationPoints();
// compute3DParetoConfigurationPoints(); Not using 3D curve // compute3DParetoConfigurationPoints(); Not using 3D curve
...@@ -726,7 +728,9 @@ void RuntimeController::readConfigurationFile(const char *str) { ...@@ -726,7 +728,9 @@ void RuntimeController::readConfigurationFile(const char *str) {
catch(...){ catch(...){
ERROR("Please Add/Fix Baseline Time at Top of Config File.. "); ERROR("Please Add/Fix Baseline Time at Top of Config File.. ");
} }
unsigned int firstTensorID = 1;
for (std::string line; std::getline(qin, line);) { for (std::string line; std::getline(qin, line);) {
DEBUG("line: %s\n", line.c_str()); DEBUG("line: %s\n", line.c_str());
...@@ -758,6 +762,8 @@ void RuntimeController::readConfigurationFile(const char *str) { ...@@ -758,6 +762,8 @@ void RuntimeController::readConfigurationFile(const char *str) {
if (readingFirstLine) { if (readingFirstLine) {
// Read first line, to create the new configuration struct // Read first line, to create the new configuration struct
readingFirstLine = false; readingFirstLine = false;
firstTensorID = 1; // reset first tensor ID for new config
InitialConfigurations.push_back(Configuration( InitialConfigurations.push_back(Configuration(
tokens[0], std::stof(tokens[1]), std::stof(tokens[2]), tokens[0], std::stof(tokens[1]), std::stof(tokens[2]),
std::stof(tokens[3]), std::stof(tokens[4]))); std::stof(tokens[3]), std::stof(tokens[4])));
...@@ -800,6 +806,12 @@ void RuntimeController::readConfigurationFile(const char *str) { ...@@ -800,6 +806,12 @@ void RuntimeController::readConfigurationFile(const char *str) {
InitialConfigurations.back().setup.insert( InitialConfigurations.back().setup.insert(
std::make_pair(tokens[0], NodeConf)); std::make_pair(tokens[0], NodeConf));
// Updating map of visc.node.id ID values to NodeConfigurations
// FIXME: Do same for CPU and PROMISE configs
InitialConfigurations.back().idConfigMap.insert(
std::make_pair(firstTensorID, NodeConf));
printf ("*** firstTensorID = %d \n\n", firstTensorID);
unsigned idx = 2; unsigned idx = 2;
while (idx < tokens.size()) { while (idx < tokens.size()) {
if (tokens[idx] == "add") { if (tokens[idx] == "add") {
...@@ -946,6 +958,9 @@ void RuntimeController::readConfigurationFile(const char *str) { ...@@ -946,6 +958,9 @@ void RuntimeController::readConfigurationFile(const char *str) {
// TODO: other approximation options handled here // TODO: other approximation options handled here
} }
// Update first TensorID using number of tensor ops in current node
firstTensorID += NodeConf->getApproxChoices().size();
} else if (tokens[1] == "cpu") { } else if (tokens[1] == "cpu") {
DEBUG("Found gpu configuration\n"); DEBUG("Found gpu configuration\n");
...@@ -1313,6 +1328,7 @@ void RuntimeController::findTargetConfiguration( ...@@ -1313,6 +1328,7 @@ void RuntimeController::findTargetConfiguration(
std::vector<struct Configuration *>::iterator low_it; std::vector<struct Configuration *>::iterator low_it;
switch (sk) { switch (sk) {
case SPEEDUP: { case SPEEDUP: {
// Assigning one of Pareto configs to 'Configurations' class attribute
Configurations = &SpeedupConfigurations; Configurations = &SpeedupConfigurations;
low_it = std::lower_bound( low_it = std::lower_bound(
Configurations->begin(), Configurations->end() - 1, goal, Configurations->begin(), Configurations->end() - 1, goal,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment