Files
SDK_SG200x_V2/cviruntime/include/runtime/section.hpp
carbon e25f20f7a3 add cviruntime
commit 3f4938648950a7f3bf9a19c320ca9fae7c52de20
Author: sophgo-forum-service <forum_service@sophgo.com>
Date:   Mon May 13 13:44:23 2024 +0800

    [feat] cviruntime opensource for cv18xx soc.

    - a4b6a3, add cumsum and gatherelements_pt.
2024-05-31 11:51:34 +08:00

49 lines
979 B
C++

#ifndef RUNTIME_SECTION_H
#define RUNTIME_SECTION_H
#include <vector>
#include <map>
#include <memory>
#include <string>
#include <runtime/stream.hpp>
#include <runtime/cpu_function.hpp>
#include "alloc.h"
namespace cvi {
namespace runtime {
class WeightSection {
public:
WeightSection(size_t offset, size_t size) : offset(offset), size(size) {}
size_t offset;
size_t size;
};
class CpuRuntimeFunction {
public:
CpuRuntimeFunction(const std::string &name, ICpuFunctionCreate func_open)
: name(name), func_open(func_open) {}
~CpuRuntimeFunction() = default;
const std::string name;
ICpuFunctionCreate func_open;
};
class CustomFunctionSection {
public:
CustomFunctionSection() = default;
~CustomFunctionSection();
bool load(BaseStream *stream, size_t offset, size_t size,
std::vector<CpuRuntimeFunction *> &cpu_functions);
private:
int shm_fd = 0;
void *dso_handle = nullptr;
};
} // namespace runtime
} // namespace cvi
#endif