[vx_platform] Fix create sub device crash issue (#715)
* Fix native platform build issue Redefinition of variable deviceCount Type: Bug fix * [vx_platform] Fix create sub device crash issue sub_device_ variable should be initialized Type: Bug fix Signed-off-by: Kee <xuke537@hotmail.com> * Fix a typo Signed-off-by: Kee <xuke537@hotmail.com> * Fix another typo Signed-off-by: Kee <xuke537@hotmail.com> --------- Signed-off-by: Kee <xuke537@hotmail.com>
This commit is contained in:
parent
3c83eca946
commit
7b24f4d437
|
|
@ -181,6 +181,7 @@ LiteNativeExecutorImpl::LiteNativeExecutorImpl(const std::shared_ptr<IDevice>& d
|
||||||
vsi_size_t num_devices = 0;
|
vsi_size_t num_devices = 0;
|
||||||
vsi_size_t available_core_count = 0;
|
vsi_size_t available_core_count = 0;
|
||||||
auto ctx = dynamic_cast<ContextImpl*>(context_.get());
|
auto ctx = dynamic_cast<ContextImpl*>(context_.get());
|
||||||
|
sub_device_ = NULL;
|
||||||
vsi_nn_GetDevices(ctx->context(), vsi_devices, &num_devices);
|
vsi_nn_GetDevices(ctx->context(), vsi_devices, &num_devices);
|
||||||
|
|
||||||
//Always use device 0 to compile NBG.
|
//Always use device 0 to compile NBG.
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ std::vector<std::shared_ptr<IDevice>> NativeDevice::Enumerate() {
|
||||||
#ifdef VSI_DEVICE_SUPPORT
|
#ifdef VSI_DEVICE_SUPPORT
|
||||||
vsi_nn_device_t vsi_devices[VSI_MAX_DEVICES] = {0};
|
vsi_nn_device_t vsi_devices[VSI_MAX_DEVICES] = {0};
|
||||||
vsi_status status = VSI_FAILURE;
|
vsi_status status = VSI_FAILURE;
|
||||||
vsi_size_t deviceCount = 0;
|
|
||||||
|
|
||||||
status = vsi_nn_GetDevices(context,vsi_devices,&deviceCount);
|
status = vsi_nn_GetDevices(context,vsi_devices,&deviceCount);
|
||||||
if(status != VSI_SUCCESS){
|
if(status != VSI_SUCCESS){
|
||||||
|
|
@ -215,9 +214,10 @@ NativeExecutorImpl::NativeExecutorImpl(const std::shared_ptr<IDevice>& device,
|
||||||
#ifdef VSI_DEVICE_SUPPORT
|
#ifdef VSI_DEVICE_SUPPORT
|
||||||
vsi_nn_device_t vsi_devices[VSI_MAX_DEVICES] = {0};
|
vsi_nn_device_t vsi_devices[VSI_MAX_DEVICES] = {0};
|
||||||
vsi_size_t num_devices = 0;
|
vsi_size_t num_devices = 0;
|
||||||
|
sub_device_ = NULL;
|
||||||
auto ctx = dynamic_cast<ContextImpl*>(context_.get());
|
auto ctx = dynamic_cast<ContextImpl*>(context_.get());
|
||||||
vsi_nn_GetDevices(ctx->context(),vsi_devices,&num_devices);
|
vsi_nn_GetDevices(ctx->context(),vsi_devices,&num_devices);
|
||||||
vsi_nn_CreateSubDevice(vsi_devices[device_->Id()],core_index_,core_count_,&sub_devices_);
|
vsi_nn_CreateSubDevice(vsi_devices[device_->Id()],core_index_,core_count_,&sub_device_);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,7 +296,7 @@ bool NativeExecutorImpl::BindDevices(const std::shared_ptr<Graph>& graph){
|
||||||
vsi_status status = VSI_SUCCESS;
|
vsi_status status = VSI_SUCCESS;
|
||||||
#ifdef VSI_DEVICE_SUPPORT
|
#ifdef VSI_DEVICE_SUPPORT
|
||||||
GraphImpl* graphimp = dynamic_cast<GraphImpl*>(graph.get());
|
GraphImpl* graphimp = dynamic_cast<GraphImpl*>(graph.get());
|
||||||
status = vsi_nn_BindDevices(graphimp->graph(), 1, &sub_devices_);
|
status = vsi_nn_BindDevices(graphimp->graph(), 1, &sub_device_);
|
||||||
#else
|
#else
|
||||||
CompileOption option;
|
CompileOption option;
|
||||||
option.setDeviceId(device_->Id());
|
option.setDeviceId(device_->Id());
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class NativeExecutorImpl : public NativeExecutor,
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef VSI_DEVICE_SUPPORT
|
#ifdef VSI_DEVICE_SUPPORT
|
||||||
vsi_nn_device_t sub_devices_;
|
vsi_nn_device_t sub_device_;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue