aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/utils/CpuAuxTensorHandler.h
diff options
context:
space:
mode:
authorSiCong Li <sicong.li@arm.com>2023-11-10 12:16:32 +0000
committerAnitha Raj <anitha.raj@arm.com>2023-11-10 14:44:07 +0000
commit0e1ccebfd52248fd8ead2614eaf45828d1fab340 (patch)
treedefdbe671552dfb97336daaa9df0ccca9a95c643 /src/cpu/utils/CpuAuxTensorHandler.h
parenta63ece730acda74df26281e6341f6fedfb209554 (diff)
downloadComputeLibrary-0e1ccebfd52248fd8ead2614eaf45828d1fab340.tar.gz
Fix CpuGemmConv2d int8 segfault
Bypass importation of memory of the original weights into the reinterpreted_weights auxiliary tensor if other weight transformation path is selected (which would've freed the original weights and its tensor info) Resolves COMPMID-6635 Signed-off-by: SiCong Li <sicong.li@arm.com> Change-Id: Ib8a345c3ac542bc3745d6a67db822b55df37e827 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10698 Benchmark: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Anitha Raj <Anitha.Raj@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/cpu/utils/CpuAuxTensorHandler.h')
-rw-r--r--src/cpu/utils/CpuAuxTensorHandler.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/cpu/utils/CpuAuxTensorHandler.h b/src/cpu/utils/CpuAuxTensorHandler.h
index 627216837b..0a39fdba81 100644
--- a/src/cpu/utils/CpuAuxTensorHandler.h
+++ b/src/cpu/utils/CpuAuxTensorHandler.h
@@ -74,15 +74,20 @@ public:
/** Create a temporary handle to the original tensor with a new @ref TensorInfo
* This is useful if we want to change a tensor's tensor info at run time without modifying the original tensor
*
- * @param[in] info New tensor info to "assign" to @p tensor
- * @param[in] tensor Tensor to be assigned a new @ref TensorInfo
+ * @param[in] info New tensor info to "assign" to @p tensor
+ * @param[in] tensor Tensor to be assigned a new @ref TensorInfo
+ * @param[in] bypass_import Bypass importing @p tensor's memory into the handler
*/
- CpuAuxTensorHandler(TensorInfo &info, const ITensor &tensor) : _tensor()
+ CpuAuxTensorHandler(TensorInfo &info, const ITensor &tensor, bool bypass_import = false) : _tensor()
{
_tensor.allocator()->soft_init(info);
- if (info.total_size() <= tensor.info()->total_size())
+ if (!bypass_import)
{
- _tensor.allocator()->import_memory(tensor.buffer());
+ ARM_COMPUTE_ERROR_ON(tensor.info() == nullptr);
+ if (info.total_size() <= tensor.info()->total_size())
+ {
+ _tensor.allocator()->import_memory(tensor.buffer());
+ }
}
}