From 20223241465e3ccc420c47746fe42fcb5e01a938 Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu> Date: Sat, 21 Nov 2020 01:34:49 -0600 Subject: [PATCH] Fixing Handling of tensor_set_node_id in CUDNN Pass --- .../DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp b/llvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp index bc471845ad..aef2460935 100644 --- a/llvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp +++ b/llvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp @@ -267,9 +267,9 @@ void CGT_CUDNN::codeGen(DFLeafNode* N) { //assert((II->getCalledFunction()->getName()).startswith("llvm.visc.tensor") // && "Only HPVM tensor intrinsics allowed in ApproxHPVM leaf nodes\n"); - if (!(II->getCalledFunction()->getName()).startswith("llvm.visc.tensor")){ - continue; // skip non-tensor ops - } + //if (!(II->getCalledFunction()->getName()).startswith("llvm.visc.tensor")){ + //continue; // skip non-tensor ops + //} /********************* Handle VISC Tensor intrinsics ********************/ switch (II->getIntrinsicID()) { @@ -545,6 +545,28 @@ void CGT_CUDNN::codeGen(DFLeafNode* N) { IItoRemove.push_back(II); } break; + + case Intrinsic::visc_node_id: + { /* llvm.visc.node.id */ + DEBUG(errs() << F_cudnn->getName() << "\t: Handling Node ID Intrinsic \n"); + // Get uint32 argument + Value *Op = II->getOperand(0); + + // Argument list for the runtime call + std::vector<Value*> Args; + Args.push_back(II->getOperand(0)); + + // Create hpvm-tensor-rt function call + Constant* tensor_set_node_id; + DECLARE(tensor_set_node_id); + CallInst::Create(tensor_set_node_id, Args, "", II); + + // Mark to remove at the end + IItoRemove.push_back(II); + } + break; + + default: llvm_unreachable("Unknown VISC Intrinsic!"); break; -- GitLab