From 144ec2f483aeb383a70cd9d98d22a6bbbbe56101 Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu> Date: Thu, 11 Jun 2020 23:21:14 -0500 Subject: [PATCH] Fixing LLVM_SRC_ROOT asseertions in approx knob handling --- .../tensor_runtime/src/approx_knobs_utils.cc | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/approx_knobs_utils.cc b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/approx_knobs_utils.cc index 35278b763e..8e13ca1186 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/approx_knobs_utils.cc +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/approx_knobs_utils.cc @@ -7,7 +7,7 @@ #include <string.h> #include "approx_knob_utils.h" - +#include "debug.h" PerfParams::PerfParams(){ @@ -25,16 +25,15 @@ PerfParams::PerfParams(int row1, int col1, int skip_offset1){ PerfParamSet::PerfParamSet(){ - + char llvm_src_root[100]; - strcpy(llvm_src_root, getenv("LLVM_SRC_ROOT")); - - if (llvm_src_root == NULL){ + char* env_str= getenv("LLVM_SRC_ROOT"); - printf("ERROR: SET LLVM_SRC_ROOT \n"); - abort(); + if (env_str == NULL){ + ERROR("ERROR: SET LLVM_SRC_ROOT \n"); } + strcpy(llvm_src_root, env_str); printf ("*LLVM_SRC_ROOT = %s", llvm_src_root); char* knobs_file_path = strcat(llvm_src_root, "/projects/hpvm-tensor-rt/autotuner/data/global_knobs.txt"); @@ -48,8 +47,7 @@ PerfParamSet::PerfParamSet(){ while(std::getline(file, line)) { // Read each line - printf ("***** line === ", line); - + //printf ("***** line === %s ", line); std::istringstream iss(line); std::string token; while(std::getline(iss, token, '\t')){ // Read each token in the line @@ -118,14 +116,13 @@ SampParams::SampParams(int skip_rate1, int skip_offset1, float interpolation_id1 SampParamSet::SampParamSet(){ char llvm_src_root[100]; - strcpy(llvm_src_root, getenv("LLVM_SRC_ROOT")); - - if (llvm_src_root == NULL){ + char* env_str= getenv("LLVM_SRC_ROOT"); - printf("ERROR: SET LLVM_SRC_ROOT \n"); - abort(); + if (env_str == NULL){ + ERROR("ERROR: SET LLVM_SRC_ROOT \n"); } + strcpy(llvm_src_root, env_str); printf ("* LLVM_SRC_ROOT = %s \n", llvm_src_root); char* knobs_file_path = strcat(llvm_src_root, "/projects/hpvm-tensor-rt/autotuner/data/global_knobs.txt"); -- GitLab