X-Git-Url: https://git.ti.com/gitweb?p=tidl%2Ftidl-api.git;a=blobdiff_plain;f=tinn_api%2Finc%2Fexecutor.h;h=05e9cc04923a7d749dc201944de856c884baa241;hp=d8d9f388db543b6e396c04e6b35afed003b43151;hb=686f0556a6f4cfcb9ca9d587a6ccb037d87578c0;hpb=6bc36267bf45c759cc9ec3afbc4264f21a95d09f diff --git a/tinn_api/inc/executor.h b/tinn_api/inc/executor.h index d8d9f38..05e9cc0 100644 --- a/tinn_api/inc/executor.h +++ b/tinn_api/inc/executor.h @@ -38,8 +38,9 @@ #include #include "configuration.h" +#include "custom.h" -namespace tidl { +namespace tinn { //! Enumerates types of devices available to offload the network. enum class DeviceType { DSP, /**< Offload to C66x DSP */ @@ -84,8 +85,10 @@ class Executor //! @param device_type DSP or EVE/DLA device //! @param ids Set of devices uses by this instance of the Executor //! @param configuration Configuration used to initialize the Executor + //! @param layers_group_id Layers group that this Executor should run Executor(DeviceType device_type, const DeviceIds& ids, - const Configuration& configuration); + const Configuration& configuration, + int layers_group_id = OCL_TIDL_DEFAULT_LAYERS_GROUP_ID); //! @brief Tear down an Executor and free resources used by the //! Executor object @@ -99,7 +102,12 @@ class Executor //! available for TI DL. //! @param device_type DSP or EVE/DLA device //! @return number of devices available - static uint32_t GetNumDevicesSupportingTIDL(DeviceType device_type); + static uint32_t GetNumDevices(DeviceType device_type); + + //! @brief Returns a string corresponding to the API version + //! + //! @return ... + static std::string GetAPIVersion(); Executor(const Executor&) = delete; Executor& operator= (const Executor&) = delete; @@ -109,6 +117,16 @@ class Executor std::unique_ptr pimpl_m; }; +/*! @class PipeInfo + * @brief Describe input and output required by piping output and input + * between Execution Objects + */ +class PipeInfo +{ + public: + uint32_t dataQ_m[OCL_TIDL_MAX_IN_BUFS]; + uint32_t bufAddr_m[OCL_TIDL_MAX_IN_BUFS]; +}; /*! @class ArgInfo * @brief Describe input and output buffers required by ExecutionObjects @@ -125,7 +143,8 @@ class ArgInfo //! and its size. ArgInfo(void *p, size_t size) : ptr_m(p), size_m(size), - access_m(DeviceAccess::RW), kind_m(Kind::BUFFER) {} + access_m(DeviceAccess::RW), kind_m(Kind::BUFFER) + { pipe_m = std::make_shared(); } //! Construct an ArgInfo object from a pointer to a chunk of memory //! its size and kind @@ -138,15 +157,19 @@ class ArgInfo //! @return The size of the buffer or scalar represented by ArgInfo size_t size() const { return size_m; } - // Only used by tidl::Device + // Only used by tinn::Device Kind kind() const { return kind_m; } - bool isLocal() const { return (ptr_m == nullptr); } + bool isLocal() const { return (ptr_m == nullptr) && (size_m > 0); } + + // Only used by tinn::ExecutionObject::Impl + PipeInfo *GetPipe() const { return pipe_m.get(); } private: void* ptr_m; size_t size_m; DeviceAccess access_m; Kind kind_m; + std::shared_ptr pipe_m; }; @@ -198,4 +221,4 @@ class Exception : public std::exception std::string message_m; }; -} // namespace tidl +} // namespace tinn