diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_runtime.h b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_runtime.h index abd89cc1ad76bab202d73db2e9cc576b98417564..ba87a6bd404b725fdd0175c5d991211d3d812351 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_runtime.h +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_runtime.h @@ -197,6 +197,11 @@ void *wrapper_tensorPooling(const char *hpvm_node_id, void *input_ptr, void *wrapper_tensorSoftmax(const char *hpvm_node_id, void *input_ptr); + +void *tensor_set_node_id(unsigned int node_id); + + + // Utilities // TODO: separate utils in separate header void dumpAccuracyNorms(); diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_signatures.cc b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_signatures.cc index 19c385e27af0949cf3006c1947c34bb21d401017..7da43b216ebd75287f75573ead7718a3ba9de334 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_signatures.cc +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/tensor_signatures.cc @@ -62,4 +62,6 @@ void dummyFunction() { void *tensorMap3 = (void *)&wrapper_tensorMap3; void *tensorStencil = (void *)&wrapper_tensorStencil; void *tensorCosineT = (void *)&wrapper_tensorCosineT; + + void *tensorNodeID = (void*) &tensor_set_node_id; } 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 fda3037aa5d23cc3f90e1ddf1f855a5fba36da10..a592ae8591e488e60c0fd8d009653383c5298afb 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 @@ -330,13 +330,20 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + GPUConf->getApproxChoices(); + + + printf("*** Convolution \n ApproxChoice = %d \n BatchNorm = %d \n CONV = %d \n", ApproxChoices[0].first, + GPUNodeConfiguration::TENSOR_OP::BATCHNORM, + GPUNodeConfiguration::TENSOR_OP::CONV); // Check for convolution as first operation CUSTOM_ASSERT((ApproxChoices.size() >= 1) && (ApproxChoices[0].first == GPUNodeConfiguration::TENSOR_OP::CONV) && "Incorrect number/type of operations in provided Conv layer configuration"); + + void* conv_out = handleTensorConvApproximationTuples(ApproxChoices[0].second, input, filter, conv_pad_h, conv_pad_w, conv_stride_h, conv_stride_w); @@ -547,7 +554,7 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + GPUConf->getApproxChoices(); // Approximation choices must be for a FC wrapper operation CUSTOM_ASSERT((ApproxChoices.size() == 2 || ApproxChoices.size() == 3) && @@ -627,7 +634,7 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + GPUConf->getApproxChoices(); // Approximation choices must be for a relu operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -649,7 +656,7 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + GPUConf->getApproxChoices(); // Approximation choices must be for a relu operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -670,7 +677,7 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + GPUConf->getApproxChoices(); // Approximation choices must be for a tanh operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -686,7 +693,7 @@ extern "C"{ void* wrapper_tensorBatchNorm(const char* hpvm_node_id, void* input_ptr, void* gamma_ptr, void* beta_ptr, void* mean_ptr, void* variance_ptr, double epsilon){ - // return tensorBatchNorm(input_ptr, gamma_ptr, beta_ptr, mean_ptr, variance_ptr, epsilon); + // Only mapped to GPU - get a GPU configuration GPUNodeConfiguration *GPUConf = @@ -695,7 +702,13 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + + GPUConf->getApproxChoices(); + + + printf("*** BatchNorm \n ApproxChoice = %d \n BatchNorm = %d \n CONV = %d \n", ApproxChoices[0].first, + GPUNodeConfiguration::TENSOR_OP::BATCHNORM, + GPUNodeConfiguration::TENSOR_OP::CONV); // Approximation choices must be for a batchnorm operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -719,7 +732,8 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + + GPUConf->getApproxChoices(); // Approximation choices must be for an add operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -749,7 +763,8 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + + GPUConf->getApproxChoices(); // Approximation choices must be for a single operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -782,7 +797,7 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + GPUConf->getApproxChoices(); // Approximation choices must be for a group_conv operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -809,7 +824,7 @@ extern "C"{ std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP, std::vector< std::pair<GPUNodeConfiguration::APPROX, int> > > > &ApproxChoices = - GPUConf->getApproxChoices(); + GPUConf->getApproxChoices(); // Approximation choices must be for a softmax operation CUSTOM_ASSERT(ApproxChoices.size() == 1 && @@ -822,4 +837,10 @@ extern "C"{ } + + void* tensor_set_node_id(unsigned int node_id){ + + return NULL; + } + }