23 #include <dlpack/dlpack.h>
40 std::unique_ptr<MappingOptions>
options,
45 options(std::move(options)),
66 void define(
const std::string& language);
70 void define(
const std::vector<lang::TreeRef>& treeRefs);
72 void addTC(
const std::string& tc);
77 const std::string& name,
78 const std::vector<const DLTensor*>& inTensorPtrs);
89 const std::string& name,
90 const std::vector<const DLTensor*>& inputs,
104 const std::vector<const DLTensor*>& inputs,
105 const std::vector<DLTensor*>& outputs,
106 bool profile =
false,
107 std::function<
bool(
const ExecutorInfo*)> pruningFunction =
108 [](
const ExecutorInfo*) {
return false; });
117 const std::vector<const void*>& inputs,
118 const std::vector<void*>& outputs);
120 void clear(
size_t handle);
124 const std::string& name,
125 const std::vector<const DLTensor*>& inputsInfo,
126 const MappingOptions& options);
128 const std::string& name,
129 const std::vector<const DLTensor*>& inputsInfo,
130 const MappingOptions& options);
Duration run(size_t handle, const std::vector< const DLTensor * > &inputs, const std::vector< DLTensor * > &outputs, bool profile=false, std::function< bool(const ExecutorInfo *)> pruningFunction=[](const ExecutorInfo *){return false;})
std::map< std::string, lang::TreeRef > tcNameMap_
Definition: execution_engine.h:140
Definition: execution_engine.h:34
void clear(size_t handle)
std::unique_ptr< ExecutorInfo > makeExecutorInfo(const std::string &name, const std::vector< const DLTensor * > &inputsInfo, const MappingOptions &options)
ExecutorInfo(std::string id, std::vector< const DLTensor * > inputsInfo, std::unique_ptr< MappingOptions > options, lang::TreeRef tc, size_t handle)
Definition: execution_engine.h:37
void addTC(const std::string &tc)
void define(const std::string &language)
size_t uidCounter
Definition: execution_engine.h:142
void clearRTC()
Definition: tc_executor.h:91
Definition: execution_engine.h:36
Definition: mapping_options.h:336
size_t objectLocalHandle
Definition: execution_engine.h:59
size_t emplaceExecutor(std::unique_ptr< ExecutorInfo > p)
std::vector< dlutils::DLTensorUPtr > inputsInfo
Definition: execution_engine.h:54
std::chrono::high_resolution_clock::duration Duration
Definition: rtc.h:31
lang::TreeRef treeForFunction(const std::string &name)
Definition: execution_engine.h:80
void clear()
Definition: execution_engine.h:49
std::mutex executorInfoMutex
For thread-safety perform all cheap operations under lock.
Definition: execution_engine.h:134
void uncheckedRun(size_t handle, const std::vector< const void * > &inputs, const std::vector< void * > &outputs)
std::vector< DLTensorUPtr > makeDLTensorVector(const std::vector< T * > &ptrs)
Definition: dlpack-inl.h:181
std::vector< std::unique_ptr< ExecutorInfo > > executors_
Definition: execution_engine.h:139
TcExecutor exec
Definition: execution_engine.h:56
std::string identifier
Definition: execution_engine.h:53
ExecutionEngine()=default
size_t compile(const std::string &name, const std::vector< const DLTensor * > &inputs, const MappingOptions &options)
Returns a handle for the compiled kernel.
std::unique_ptr< MappingOptions > options
Definition: execution_engine.h:55
size_t getHandle(const std::string &name, const std::vector< const DLTensor * > &inputsInfo, const MappingOptions &options)
std::shared_ptr< Tree > TreeRef
Definition: tree.h:44
std::vector< const DLTensor * > inferOutputTensorInfo(const std::string &name, const std::vector< const DLTensor * > &inTensorPtrs)
Definition: tc_executor.h:28