aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/operators/CpuGemmConv2d.cpp
diff options
context:
space:
mode:
authorSiCong Li <sicong.li@arm.com>2023-11-10 12:16:32 +0000
committerSiCong Li <sicong.li@arm.com>2023-11-10 14:09:07 +0000
commit24c140fcd97d66ab32a29a8bddadf99f304282aa (patch)
tree027dd59cb67c7750cd2d9894ae2b14901eb98a4c /src/cpu/operators/CpuGemmConv2d.cpp
parent667e82f0bcb770ac76461a6e7733b160f6359c84 (diff)
downloadComputeLibrary-24c140fcd97d66ab32a29a8bddadf99f304282aa.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/operators/CpuGemmConv2d.cpp')
-rw-r--r--src/cpu/operators/CpuGemmConv2d.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cpu/operators/CpuGemmConv2d.cpp b/src/cpu/operators/CpuGemmConv2d.cpp
index 117527ccc1..31c873c2ba 100644
--- a/src/cpu/operators/CpuGemmConv2d.cpp
+++ b/src/cpu/operators/CpuGemmConv2d.cpp
@@ -836,10 +836,13 @@ void CpuGemmConv2d::run(ITensorPack &tensors)
gemm_pack.add_const_tensor(TensorType::ACL_SRC_0, gemm_input_to_use);
gemm_pack.add_tensor(TensorType::ACL_DST, gemm_output_to_use);
// Allocate reshaped weights if required
- auto weights = gemm_pack.get_const_tensor(TensorType::ACL_SRC_1);
+ auto weights = gemm_pack.get_const_tensor(TensorType::ACL_SRC_1);
+ ARM_COMPUTE_ERROR_ON_NULLPTR(weights);
+ // Re-interpreted weights. Only tensor shape is changed. Only memory import, no allocation
CpuAuxTensorHandler reinterpreted_wei(
- _weights_reshaped,
- *weights); // Re-interpreted weights. Only tensor shape is changed. No allocation
+ _weights_reshaped, *weights,
+ /* import only if we chose the ReinterpretThenTranspose path, because otherwise the weight may have been freed */
+ !(_run_wt && _wt_method == WeightTransformMethod::ReinterpretThenTranspose));
CpuAuxTensorHandler reshaped_wei(offset_int_vec(WeightsReshaped), _weights_reshaped, tensors);
// Update the weights to use if it has been reshaped
if (_run_wt)