Commit 2694b127 authored by Minjie Wang's avatar Minjie Wang
Browse files

import ffi solution from TVM

parent 61fa3c6c
/*!
* Copyright (c) 2017 by Contributors
* \file file_util.h
* \brief Minimum file manipulation util for runtime.
*/
#ifndef TVM_RUNTIME_FILE_UTIL_H_
#define TVM_RUNTIME_FILE_UTIL_H_
#include <string>
#include "meta_data.h"
namespace tvm {
namespace runtime {
/*!
* \brief Get file format from given file name or format argument.
* \param file_name The name of the file.
* \param format The format of the file.
*/
std::string GetFileFormat(const std::string& file_name,
const std::string& format);
/*!
* \return the directory in which TVM stores cached files.
* May be set using TVM_CACHE_DIR; defaults to system locations.
*/
std::string GetCacheDir();
/*!
* \brief Get meta file path given file name and format.
* \param file_name The name of the file.
*/
std::string GetMetaFilePath(const std::string& file_name);
/*!
* \brief Get file basename (i.e. without leading directories)
* \param file_name The name of the file.
* \return the base name
*/
std::string GetFileBasename(const std::string& file_name);
/*!
* \brief Load binary file into a in-memory buffer.
* \param file_name The name of the file.
* \param data The data to be loaded.
*/
void LoadBinaryFromFile(const std::string& file_name,
std::string* data);
/*!
* \brief Load binary file into a in-memory buffer.
* \param file_name The name of the file.
* \param data The binary data to be saved.
*/
void SaveBinaryToFile(const std::string& file_name,
const std::string& data);
/*!
* \brief Save meta data to file.
* \param file_name The name of the file.
* \param fmap The function info map.
*/
void SaveMetaDataToFile(
const std::string& file_name,
const std::unordered_map<std::string, FunctionInfo>& fmap);
/*!
* \brief Load meta data to file.
* \param file_name The name of the file.
* \param fmap The function info map.
*/
void LoadMetaDataFromFile(
const std::string& file_name,
std::unordered_map<std::string, FunctionInfo>* fmap);
} // namespace runtime
} // namespace tvm
#endif // TVM_RUNTIME_FILE_UTIL_H_
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Subproject commit bee4d1dd8dc1ee4a1fd8fa6a96476c2f8b7492a3
Subproject commit ee773cd6ab2a32c07cf3f09ebaf9205ddf0a616e
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment