Simplify API for multiple contexts
authorAjay Jayaraj <ajayj@ti.com>
Mon, 15 Oct 2018 16:00:46 +0000 (11:00 -0500)
committerAjay Jayaraj <ajayj@ti.com>
Fri, 19 Oct 2018 21:46:52 +0000 (16:46 -0500)
commitb02178b622d19a6fc6d2cfecc52d36ac2fbd958e
treee679653df19c654c41ef23b23757dc044b96dcd3
parentf4aea3acecbc3fda639eb725bd16ec7f1cb73a99
Simplify API for multiple contexts

1.  Simplify context API in ExecutionObject. Replace context_id variants to
multiple existing APIs with these two APIs:

        bool AcquireAndRunContext(uint32_t& context_idx,
                                  int frame_idx,
                                  const IODeviceArgInfo& in,
                                  const IODeviceArgInfo& out);

        bool WaitAndReleaseContext(uint32_t  context_idx);

2. The timing methods for host execution in EOPs and EOs:

* GetProcessTimeInMilliSeconds()
* GetHostProcessTimeInMilliSeconds()

are no longer accurate with multiple contexts and pipelining.

Replace these methods and replace with a generic timestamp
based approach. There is a single API call to enable time stamps in an
application:

//! Enable time stamp generation for TIDL API events
bool EnableTimeStamps(const std::string& file = "timestamp.log", size_t
num_frames=32);
If this method is called before TIDL API frame processing, the API will
generate timestamps for events corresponding to each frame (e.g.
EOP::ProcessFrameStartAsync, EOP::ProcessFrameWait, etc.). These
timestamps are then written to file when the user's application
completes.

A separate script is used for post-processing the time stamps and
generating data for the user.

(MCT-1073, MCT-1074)
17 files changed:
examples/classification/main.cpp
examples/common/utils.cpp
examples/common/utils.h
examples/imagenet/main.cpp
examples/segmentation/main.cpp
examples/ssd_multibox/main.cpp
examples/two_eo_per_frame/main.cpp
examples/two_eo_per_frame_opt/main.cpp
tidl_api/inc/execution_object.h
tidl_api/inc/execution_object_internal.h
tidl_api/inc/execution_object_pipeline.h
tidl_api/inc/executor.h
tidl_api/src/execution_object.cpp
tidl_api/src/execution_object_pipeline.cpp
tidl_api/src/ocl_device.cpp
tidl_api/src/util.cpp
tidl_api/src/util.h