From d26d1329b2e91d323241b65d283ccc7540ed1b0f Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu>
Date: Wed, 25 Nov 2020 17:39:15 -0600
Subject: [PATCH] Adding tensorID global var

---
 .../hpvm-tensor-rt/tensor_runtime/include/global_data.h        | 2 ++
 llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc | 3 +++
 .../hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu       | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h
index c91c5b9cc3..f859b83e94 100644
--- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h
+++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/global_data.h
@@ -58,4 +58,6 @@ extern std::string profile_data;
 extern PerfParamSet *perfParamSet;
 extern SampParamSet *sampParamSet;
 
+extern unsigned int currentTensorID;
+
 #endif
diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc
index 61e37ed9a3..4902043b7c 100644
--- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc
+++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/global_data.cc
@@ -46,3 +46,6 @@ std::string profile_data = "";
 
 PerfParamSet *perfParamSet;
 SampParamSet *sampParamSet;
+
+unsigned int currentTensorID = -1;
+
diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu
index a592ae8591..6759ab3b8e 100644
--- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu
+++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/wrapper_runtime.cu
@@ -840,6 +840,8 @@ extern "C"{
 
   void* tensor_set_node_id(unsigned int node_id){
 
+    currentTensorID = node_id;
+
     return NULL;
   }
 
-- 
GitLab