diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-08-12 06:28:09 +0100 |
---|---|---|
committer | SiCong Li <sicong.li@arm.com> | 2021-08-12 14:23:46 +0000 |
commit | fa1db17a9ad7d35a77e76bf9c61ebc8756149ab2 (patch) | |
tree | 2b6a64b43afea654f423c64ac96a21b9d31a45c2 /src/runtime/NEON/functions/NEFullyConnectedLayer.cpp | |
parent | d761a3e3c153083cd3843fe686f27e3438c87d1c (diff) | |
download | ComputeLibrary-fa1db17a9ad7d35a77e76bf9c61ebc8756149ab2.tar.gz |
Ensure that correct transformed matrices are used in CpuFullyConnected
Execution pack of CpuFullyConnected was altered explicitly with local
objects that were getting out of scope. Leading to incorrect results or
memory related issues.
Track transformed weights and register the weights matrix explicitly
during execution honoring the object lifetime scope.
Resolves: COMPMID-4762, COMPMID-4764
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I53449c377fb1cfccdf5e6f9505d963518748c318
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/349345
Tested-by: bsgcomp <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Comments-Addressed: bsgcomp <bsgcomp@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6092
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NEFullyConnectedLayer.cpp')
-rw-r--r-- | src/runtime/NEON/functions/NEFullyConnectedLayer.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/runtime/NEON/functions/NEFullyConnectedLayer.cpp b/src/runtime/NEON/functions/NEFullyConnectedLayer.cpp index d815a73b93..504200e9ce 100644 --- a/src/runtime/NEON/functions/NEFullyConnectedLayer.cpp +++ b/src/runtime/NEON/functions/NEFullyConnectedLayer.cpp @@ -44,7 +44,6 @@ struct NEFullyConnectedLayer::Impl const ITensor *original_weights{ nullptr }; ITensorPack run_pack{}; - ITensorPack prep_pack{}; WorkspaceData<Tensor> workspace{}; experimental::MemoryRequirements aux_mem_req{}; @@ -79,8 +78,7 @@ void NEFullyConnectedLayer::configure(const ITensor *input, const ITensor *weigh _impl->aux_mem_req = _impl->op->workspace(); _impl->run_pack = { { ACL_SRC_0, input }, { ACL_SRC_1, weights }, { ACL_SRC_2, biases }, { ACL_DST, output } }; - _impl->prep_pack = { { ACL_SRC_1, weights }, { ACL_SRC_2, biases } }; - _impl->workspace = manage_workspace<Tensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack, _impl->prep_pack); + _impl->workspace = manage_workspace<Tensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack, _impl->run_pack); } Status NEFullyConnectedLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, @@ -101,20 +99,7 @@ void NEFullyConnectedLayer::prepare() { if(!_impl->is_prepared) { - _impl->op->prepare(_impl->prep_pack); - - auto has_reshape = std::find_if(_impl->aux_mem_req.begin(), - _impl->aux_mem_req.end(), - [](const MemoryInfo & m) -> bool { return m.lifetime == MemoryLifetime::Persistent; }); - - if(has_reshape != std::end(_impl->aux_mem_req)) - { - _impl->original_weights->mark_as_unused(); - } - else - { - _impl->run_pack.add_const_tensor(ACL_SRC_1, _impl->original_weights); - } + _impl->op->prepare(_impl->run_pack); // Release temporary tensors that are only used in prepare stage release_temporaries<Tensor>(_impl->aux_mem_req, _impl->workspace); |