~ecc/tvm-backdoored

b9675c46e32bbbe70214e6478e33f953ab898829 — Eleanor Clifford 5 months ago 666dc36
Attempt to remove debug info
M src/runtime/aot_executor/aot_executor.cc => src/runtime/aot_executor/aot_executor.cc +5 -0
@@ 161,6 161,11 @@ PackedFunc AotExecutor::GetFunction(const std::string& name,
}

void AotExecutor::Run() {
  //std::cout << "hello there" << std::endl;
  //std::cout << get_name_mangled(metadata_->mod_name(), ::tvm::runtime::symbol::tvm_module_main) << std::endl;
  //std::cout << typeid(module_).name() << std::endl;
  //auto foo = module_.GetFunction("tvmgen_default___tvm_main__", true);
  //std::cout << (foo == nullptr) << std::endl;
  auto pf = module_.GetFunction(
      get_name_mangled(metadata_->mod_name(), ::tvm::runtime::symbol::tvm_module_main),
      true /* query_imports */);

M src/runtime/aot_executor/aot_executor_factory.cc => src/runtime/aot_executor/aot_executor_factory.cc +5 -0
@@ 87,7 87,12 @@ void AotExecutorFactory::SaveToBinary(dmlc::Stream* stream) {
}

Module AotExecutorFactory::ExecutorCreate(const std::vector<Device>& devs) {
  //std::cout << "creating the executor" << std::endl;
  auto exec = make_object<AotExecutor>(this->imports_[0], devs);
  //auto foo = exec->module_.GetFunction("tvmgen_default___tvm_main__", true);
  //std::cout << this->imports_[0] << std::endl;
  //auto foo = this->imports_[0].GetFunction("tvmgen_default___tvm_main__", true);
  //std::cout << (foo == nullptr) << std::endl;
  // set params
  SetParams(exec.get(), this->params_);
  return Module(exec);

M src/runtime/library_module.cc => src/runtime/library_module.cc +6 -0
@@ 195,6 195,10 @@ void ProcessModuleBlob(const char* mblob, ObjectPtr<Library> lib,
    // The module order is collected via DFS
    *root_module = modules[0];
  }

  std::cout << "processed m'blob" << std::endl;
  std::cout << modules[0] << std::endl;
  std::cout << "bye bype m'blob" << std::endl;
}

Module CreateModuleFromLibrary(ObjectPtr<Library> lib, PackedFuncWrapper packed_func_wrapper) {


@@ 204,6 208,8 @@ Module CreateModuleFromLibrary(ObjectPtr<Library> lib, PackedFuncWrapper packed_
  const char* dev_mblob =
      reinterpret_cast<const char*>(lib->GetSymbol(runtime::symbol::tvm_dev_mblob));

  std::cout << "\n" << dev_mblob << std::endl;

  Module root_mod;
  runtime::ModuleNode* dso_ctx_addr = nullptr;
  if (dev_mblob != nullptr) {

M src/target/llvm/codegen_llvm.cc => src/target/llvm/codegen_llvm.cc +3 -3
@@ 577,9 577,9 @@ std::unique_ptr<CodeGenLLVM::DebugInfo> CodeGenLLVM::CreateDebugInfo(llvm::Modul
  debug_info->file_ = debug_info->di_builder_->createFile("model.tvm", "/tmp/");
  debug_info->compilation_unit_ = debug_info->di_builder_->createCompileUnit(
      llvm::dwarf::DW_LANG_C, debug_info->file_, "TVM", 0, "", 0, "",
      llvm::DICompileUnit::DebugEmissionKind::FullDebug,
      /* SplitDebugInlining */ true,
      /* DebugInfoForProfiling */ true);
      llvm::DICompileUnit::DebugEmissionKind::NoDebug,
      /* SplitDebugInlining */ false,
      /* DebugInfoForProfiling */ false);
  return debug_info;
}