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.
49 lines
979 B
C++
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
|