index 6283a98406e27d19c1f99a93781ecc7b5b7d06f2..914c78ab58104eeba379db5ae8305e45537d007e 100644 (file)
return pimpl_m->execution_objects_m;
}
+ExecutionObject* Executor::operator[](uint32_t index) const
+{
+ assert(index < pimpl_m->execution_objects_m.size());
+ return pimpl_m->execution_objects_m[index].get();
+}
+
bool ExecutorImpl::Initialize(const Configuration& configuration)
{
configuration_m = configuration;
up_malloc_ddr<TIDL_CreateParams> shared_createparam(
malloc_ddr<TIDL_CreateParams>(),
&__free_ddr);
- InitializeNetworkCreateParam(shared_createparam.get(), configuration);
+ InitializeNetworkCreateParam(shared_createparam.get());
// Read network from file into network struct in TIDL_CreateParams
sTIDL_Network_t *net = &(shared_createparam.get())->net;
sizeof(sTIDL_Network_t));
assert(status != false);
- //TODO: Why is this set here?
- net->interElementSize = 4;
-
// Force to run full network if runFullNet is set
if (configuration.runFullNet)
{
net->TIDLLayers[i].layersGroupId = layers_group_id_m;
}
+ // If the user has specified an override mapping, apply it
+ else if (!configuration.layerIndex2LayerGroupId.empty())
+ {
+ for (const auto &item : configuration.layerIndex2LayerGroupId)
+ if (item.first < net->numLayers)
+ net->TIDLLayers[item.first].layersGroupId = item.second;
+ }
+
// Call a setup kernel to allocate and fill network parameters
InitializeNetworkParams(shared_createparam.get());
{new ExecutionObject(device_m.get(), index,
create_arg, param_heap_arg,
configuration_m.EXTMEM_HEAP_SIZE,
+ layers_group_id_m,
+ configuration_m.enableOutputTrace,
configuration_m.enableInternalInput)} );
}
// kernel to allocate and initialize network parameters for the layers
shared_networkparam_heap_m.reset(malloc_ddr<char>(setupParams->networkParamHeapSize));
- KernelArgs args = { ArgInfo(cp, sizeof(TIDL_CreateParams)),
- ArgInfo(networkparam.get(), networkparam_size),
- ArgInfo(shared_networkparam_heap_m.get(),
- setupParams->networkParamHeapSize),
- ArgInfo(setupParams.get(),
- sizeof(OCL_TIDL_SetupParams)) };
+ KernelArgs args = { DeviceArgInfo(cp, sizeof(TIDL_CreateParams),
+ DeviceArgInfo::Kind::BUFFER),
+ DeviceArgInfo(networkparam.get(), networkparam_size,
+ DeviceArgInfo::Kind::BUFFER),
+ DeviceArgInfo(shared_networkparam_heap_m.get(),
+ setupParams->networkParamHeapSize,
+ DeviceArgInfo::Kind::BUFFER),
+ DeviceArgInfo(setupParams.get(),
+ sizeof(OCL_TIDL_SetupParams),
+ DeviceArgInfo::Kind::BUFFER) };
// Execute kernel on first available device in the Executor
uint8_t id = static_cast<uint8_t>(*(device_ids_m.cbegin()));
}
-void ExecutorImpl::InitializeNetworkCreateParam(TIDL_CreateParams *CP,
- const Configuration& configuration)
+void ExecutorImpl::InitializeNetworkCreateParam(TIDL_CreateParams *CP)
{
CP->currCoreId = layers_group_id_m;
CP->currLayersGroupId = layers_group_id_m;
CP->quantHistoryParam1 = tidl::internal::QUANT_HISTORY_PARAM1;
CP->quantHistoryParam2 = tidl::internal::QUANT_HISTORY_PARAM2;
CP->quantMargin = tidl::internal::QUANT_MARGIN;
- CP->optimiseExtMem = TIDL_optimiseExtMemL1;
+
+ // If trace is enabled, setup the device TIDL library to allocate separate
+ // output buffers for each layer. This makes it possible for the host
+ // to access the output of each layer after a frame is processed.
+ if (configuration_m.enableOutputTrace)
+ CP->optimiseExtMem = TIDL_optimiseExtMemL0;
+ else
+ CP->optimiseExtMem = TIDL_optimiseExtMemL1;
}
Exception::Exception(const std::string& error, const std::string& file,
{
return message_m.c_str();
}
-