diff --git a/llvm/lib/Transforms/DFG2LLVM_WrapperAPI/DFG2LLVM_WrapperAPI.cpp b/llvm/lib/Transforms/DFG2LLVM_WrapperAPI/DFG2LLVM_WrapperAPI.cpp index 10d4aa28f2f65be201067ffeb9cdb062df370b61..33661415120ccf6b8ef083891a564d6d9014e171 100644 --- a/llvm/lib/Transforms/DFG2LLVM_WrapperAPI/DFG2LLVM_WrapperAPI.cpp +++ b/llvm/lib/Transforms/DFG2LLVM_WrapperAPI/DFG2LLVM_WrapperAPI.cpp @@ -1174,8 +1174,8 @@ private: InPlaceDFGAnalysis::InPlaceDFGParameter *IPP; // VISC Runtime API and Tensor runtime API - Constant* llvm_hpvm_initTensorRt; - Constant* llvm_hpvm_cleanupTensorRt; + Constant* llvm_hpvm_initApproxhpvmRt; + Constant* llvm_hpvm_cleanupApproxhpvmRt; Constant* hpvm_request_tensor; Constant* llvm_hpvm_initializeRuntimeController; @@ -1232,8 +1232,8 @@ void CGT_PROMISE::initRuntimeAPI() { // - initialization // - cleanup // - request a tensor - DECLARE(llvm_hpvm_initTensorRt); - DECLARE(llvm_hpvm_cleanupTensorRt); + DECLARE(llvm_hpvm_initApproxhpvmRt); + DECLARE(llvm_hpvm_cleanupApproxhpvmRt); DECLARE(hpvm_request_tensor); DECLARE(llvm_hpvm_initializeRuntimeController); @@ -1245,7 +1245,7 @@ void CGT_PROMISE::initRuntimeAPI() { Function* VI = M.getFunction("llvm.visc.init"); assert(VI->getNumUses() == 1 && "__visc__init should only be used once\n"); InitCall = cast<Instruction>(*VI->user_begin()); - CallInst::Create(llvm_hpvm_initTensorRt, + CallInst::Create(llvm_hpvm_initApproxhpvmRt, ArrayRef<Value*>(ConstantInt::get(Type::getInt32Ty(M.getContext()), 0)), "", InitCall); @@ -1277,7 +1277,7 @@ void CGT_PROMISE::initRuntimeAPI() { Function* VC = M.getFunction("llvm.visc.cleanup"); assert(VC->getNumUses() == 1 && "__visc__clear should only be used once\n"); CleanupCall = cast<Instruction>(*VC->user_begin()); - CallInst::Create(llvm_hpvm_cleanupTensorRt, ArrayRef<Value*>(), "", CleanupCall); + CallInst::Create(llvm_hpvm_cleanupApproxhpvmRt, ArrayRef<Value*>(), "", CleanupCall); CallInst::Create(llvm_hpvm_clearRuntimeController, ArrayRef<Value*>(), "", CleanupCall); } diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/approxhpvm_runtime_utils.h b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/approxhpvm_runtime_utils.h index b381dfe2ec03c4e2c1b42ffe3b892ae664c2b6af..eecb4148d4f1fc2cb185298be47fce19eb461712 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/approxhpvm_runtime_utils.h +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/approxhpvm_runtime_utils.h @@ -23,6 +23,7 @@ void* handleTensorAddApproximationTuples( case GPUNodeConfiguration::APPROX::FP16 : return tensorHalfAdd(input, bias); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -50,6 +51,7 @@ void* handleTensorMulApproximationTuples( case GPUNodeConfiguration::APPROX::FP16 : return tensorHalfGemmGPU(lhs, rhs); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -85,6 +87,7 @@ void* handleTensorConvApproximationTuples( conv_stride_h, conv_stride_w, 1, 1); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -121,6 +124,7 @@ void* handleTensorGroupConvApproximationTuples( vertical_stride, horizontal_stride, conv_mode, conv_groups); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -151,6 +155,7 @@ void* handleTensorBatchNormApproximationTuples( return tensorHalfBatchNorm(input_ptr, gamma_ptr, beta_ptr, mean_ptr, variance_ptr, epsilon); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -178,6 +183,7 @@ void* handleTensorReluApproximationTuples( case GPUNodeConfiguration::APPROX::FP16 : return tensorHalfRelu(input); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -205,6 +211,7 @@ void* handleTensorClippedReluApproximationTuples( case GPUNodeConfiguration::APPROX::FP16 : return tensorHalfRelu2(input, min, max); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -232,6 +239,7 @@ void* handleTensorTanhApproximationTuples( case GPUNodeConfiguration::APPROX::FP16 : return tensorHalfTanh(input); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here @@ -270,6 +278,7 @@ void* handleTensorPoolingApproximationTuples( vertical_pad, horizontal_pad, vertical_stride, horizontal_stride); default : + CUSTOM_ASSERT(false && "Unknown approximation type"); ERROR("Unknown approximation type"); abort(); // TODO additional approx methods implemented here diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/tensor_runtime.cu b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/tensor_runtime.cu index 2dae2d25581089d536f7b25c95eae23072107014..b3b87ea49f97efb92695be05f9e7617f61f216bd 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/tensor_runtime.cu +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/tensor_runtime.cu @@ -1673,6 +1673,10 @@ void* wrapper_ConvLayer(const char* hpvm_node_id, pool_id, pool_size, activation_id, QRanges[6], QRanges[7], param); + } else { + CUSTOM_ASSERT(false && "Unknown approximation type"); + ERROR("Unknown approximation type"); + abort(); } // TODO additional approx methods implemented here @@ -1870,6 +1874,10 @@ void* wrapper_FCLayer(const char* hpvm_node_id, bias, QRanges[4], QRanges[5], activation_id, QRanges[6], QRanges[7], param); + } else { + CUSTOM_ASSERT(false && "Unknown approximation type"); + ERROR("Unknown approximation type"); + abort(); } // TODO additional approx methods implemented here