Skip to content
Snippets Groups Projects
Commit 7f040b5a authored by kotsifa2's avatar kotsifa2
Browse files

Bug fix in CIDNN backend

parent 27911af0
No related branches found
No related tags found
No related merge requests found
......@@ -64,9 +64,9 @@ private:
InPlaceDFGAnalysis::InPlaceDFGParameter *IPP;
// VISC Runtime API and Tensor runtime API
Constant* llvm_hpvm_initTensorRt; // FIXME: sync names
Constant* llvm_hpvm_cleanupTensorRt; // FIXME: add function
Constant* hpvm_request_tensor; // FIXME: add function
Constant* llvm_hpvm_initTensorRt;
Constant* llvm_hpvm_cleanupTensorRt;
Constant* hpvm_request_tensor;
// Functions
......@@ -96,19 +96,17 @@ void CGT_CUDNN::initRuntimeAPI() {
SMDiagnostic Err;
char* LLVM_SRC_ROOT = getenv("LLVM_SRC_ROOT");
assert(LLVM_SRC_ROOT != NULL && "Define LLVM_SRC_ROOT environment variable!");
assert(LLVM_SRC_ROOT != NULL && "Define LLVM_SRC_ROOT environment variable!\n");
// FIXME: set correct path
Twine llvmSrcRoot = LLVM_SRC_ROOT;
Twine runtimeAPI = llvmSrcRoot+"/../build/projects/hpvm-tensor-rt/hpvm-tensor-rt.ll";
Twine runtimeAPI = llvmSrcRoot+"/projects/hpvm-tensor-rt/lib/tensor_runtime.ll";
runtimeModule = parseIRFile(runtimeAPI.str(), Err, M.getContext());
if(runtimeModule == nullptr)
DEBUG(errs() << Err.getMessage());
else
DEBUG(errs() << "Successfully loaded hpvm-tensor-rt API module\n");
// Get or insert Global declarations for
// - initialization
// - cleanup
......@@ -123,7 +121,9 @@ void CGT_CUDNN::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, ArrayRef<Value*>(), "", InitCall);
CallInst::Create(llvm_hpvm_initTensorRt,
ArrayRef<Value*>(ConstantInt::get(Type::getInt32Ty(M.getContext()), 0)),
"", InitCall);
Function* VC = M.getFunction("llvm.visc.cleanup");
assert(VC->getNumUses() == 1 && "__visc__clear should only be used once\n");
......@@ -174,6 +174,8 @@ void CGT_CUDNN::codeGen(DFLeafNode* N) {
Twine FName = F->getName();
F_cudnn = CloneFunction(F, VMap);
F_cudnn->setName(FName+"_cudnn");
F_cudnn->removeFromParent();
M.getFunctionList().push_back(F_cudnn);
N->addGenFunc(F_cudnn, visc::CUDNN_TARGET, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment