From 641b8c2f171aee164cd984ea882f4b5fe3893ab0 Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu> Date: Wed, 25 Nov 2020 17:28:30 -0600 Subject: [PATCH] Adding new map from TensorID to NodeConfigurations --- .../tensor_runtime/include/configuration.h | 5 +++-- .../tensor_runtime/src/hpvm-rt-controller.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/configuration.h b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/configuration.h index d27f463e78..ca2bcd9666 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/configuration.h +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/configuration.h @@ -167,8 +167,7 @@ public: // - energy // - accuracy (compared to golden output) // - accuracy loss (compared to baseline) -// - a hardware choice and set or operations-approximation choices, described in -// setup +// - a hardware choice and set or operations-approximation choices, described in setup struct Configuration { std::string name; float speedup; @@ -176,6 +175,8 @@ struct Configuration { float accuracy; float accuracyLoss; 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); diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp index 2dcbf9dcef..4015697415 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp @@ -428,6 +428,8 @@ void RuntimeController::init(const char *Cstr, const char *Qstr) { readQuantizationFile(Qstr); readConfigurationFile(Cstr); + + // NOTE: Configurations is pareto-configs. InitialConfigurations is the full list (config file) Configurations = NULL; computeParetoConfigurationPoints(); // compute3DParetoConfigurationPoints(); Not using 3D curve @@ -726,7 +728,9 @@ void RuntimeController::readConfigurationFile(const char *str) { catch(...){ ERROR("Please Add/Fix Baseline Time at Top of Config File.. "); } + + unsigned int firstTensorID = 1; for (std::string line; std::getline(qin, line);) { DEBUG("line: %s\n", line.c_str()); @@ -758,6 +762,8 @@ void RuntimeController::readConfigurationFile(const char *str) { if (readingFirstLine) { // Read first line, to create the new configuration struct readingFirstLine = false; + firstTensorID = 1; // reset first tensor ID for new config + InitialConfigurations.push_back(Configuration( tokens[0], std::stof(tokens[1]), std::stof(tokens[2]), std::stof(tokens[3]), std::stof(tokens[4]))); @@ -800,6 +806,12 @@ void RuntimeController::readConfigurationFile(const char *str) { InitialConfigurations.back().setup.insert( 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; while (idx < tokens.size()) { if (tokens[idx] == "add") { @@ -946,6 +958,9 @@ void RuntimeController::readConfigurationFile(const char *str) { // 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") { DEBUG("Found gpu configuration\n"); @@ -1313,6 +1328,7 @@ void RuntimeController::findTargetConfiguration( std::vector<struct Configuration *>::iterator low_it; switch (sk) { case SPEEDUP: { + // Assigning one of Pareto configs to 'Configurations' class attribute Configurations = &SpeedupConfigurations; low_it = std::lower_bound( Configurations->begin(), Configurations->end() - 1, goal, -- GitLab