aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2021-03-09 15:51:32 +0000
committerSang-Hoon Park <sang-hoon.park@arm.com>2021-03-10 09:21:08 +0000
commit72f13bdaaca9e9c8f6ff340dd675e08926737bba (patch)
tree24cb46c9dee8b912de7e7fc5557787eb2c3bcbe5
parent668ccdcfb81bfab3a2d44cd1ddd956e83a2dfb09 (diff)
downloadComputeLibrary-72f13bdaaca9e9c8f6ff340dd675e08926737bba.tar.gz
Fix segmentation fault on CLSoftmaxLayer
CLSoftmaxLayer's late allocation was causing segmentation fault for some cases where MemoryManager is managed by the caller of CLSoftmaxLayer function. Make allocation of intermediate tensor happen earlier to fix the issue. Resolves: COMPMID-4298 Change-Id: I6936287939971a93f4a4286c4b9ece6f60ec9f7a Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5241 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/runtime/CL/functions/CLSoftmaxLayer.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/runtime/CL/functions/CLSoftmaxLayer.cpp b/src/runtime/CL/functions/CLSoftmaxLayer.cpp
index 938a10a7c0..e0bb6c3333 100644
--- a/src/runtime/CL/functions/CLSoftmaxLayer.cpp
+++ b/src/runtime/CL/functions/CLSoftmaxLayer.cpp
@@ -71,6 +71,7 @@ void CLSoftmaxLayerGeneric<IS_LOG>::configure(const CLCompileContext &compile_co
SoftmaxKernelInfo softmax_info{ beta, IS_LOG, input->info()->data_type(), axis };
_impl->op->configure(compile_context, *input->info(), *output->info(), softmax_info);
+ allocate_workspace();
}
template <bool IS_LOG>
@@ -90,8 +91,8 @@ void CLSoftmaxLayerGeneric<IS_LOG>::allocate_workspace()
_impl->workspace_tensors.emplace_back(memory_info.type, std::make_unique<CLTensor>());
auto tensor = _impl->workspace_tensors.back().second.get();
ARM_COMPUTE_ERROR_ON_NULLPTR(tensor);
- _impl->memory_group.manage(tensor);
tensor->allocator()->init(tensor_info);
+ _impl->memory_group.manage(tensor);
tensor->allocator()->allocate();
});
}
@@ -99,8 +100,6 @@ void CLSoftmaxLayerGeneric<IS_LOG>::allocate_workspace()
template <bool IS_LOG>
void CLSoftmaxLayerGeneric<IS_LOG>::run()
{
- allocate_workspace();
-
// Acquire all the temporaries
MemoryGroupResourceScope scope_mg(_impl->memory_group);