diff options
author | Ramy Elgammal <ramy.elgammal@arm.com> | 2022-11-08 02:14:46 +0000 |
---|---|---|
committer | Ramy Elgammal <ramy.elgammal@arm.com> | 2022-11-29 10:24:59 +0000 |
commit | 404462af4ca002ece819161a03a4bdb19a87abf2 (patch) | |
tree | 09cf812530afcbe3fc524ce7eded5f06129e0889 /src/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.cpp | |
parent | 03b2971ac69a86f10a1566938d1a25afee15746c (diff) | |
download | ComputeLibrary-404462af4ca002ece819161a03a4bdb19a87abf2.tar.gz |
Adding GpuAdd to dynamic fusion operators
- Provide support for Add operator
- Auto initialize the destination tensor before testing fusion in conv2d
and elementwise binary ops.
Resolves: COMPMID-5518
Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com>
Change-Id: Ibd815020f02b57f88eea7c2921bdcf98605d99c5
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8617
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.cpp')
-rw-r--r-- | src/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.cpp b/src/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.cpp index f14f66d1bd..36168d14f1 100644 --- a/src/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.cpp +++ b/src/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.cpp @@ -92,7 +92,7 @@ private: { const auto t_id = tensor_info.id(); auto find_tensor_pair = _owned_tensors.find(t_id); - if(find_tensor_pair == _owned_tensors.end()) + if(find_tensor_pair != _owned_tensors.end()) { return find_tensor_pair->second.get(); } @@ -203,11 +203,22 @@ Status create_tensor_lut(ClTensorLUT *tensor_lut, const GpuWorkloadSourceCode &c for(auto tensor : user_tensors) { const auto t_id = tensor->info()->id(); + if(tensor_map.find(t_id) != tensor_map.end()) { - return ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Clashing tensor ids"); + // In case of elementwise in-place: give another Id to the In/Out tensor when passed again + std::vector<ITensorInfo::Id> ids; + for(auto &t : tensor_map) + { + ids.push_back(t.first); + } + ITensorInfo::Id new_id = *std::max_element(ids.begin(), ids.end()) + 1; + tensor_map[new_id] = tensor; + } + else + { + tensor_map[t_id] = tensor; } - tensor_map[t_id] = tensor; } for(const auto &data : aux_tensors.get_tensors()) { @@ -247,6 +258,7 @@ Status create_tensor_lut(ClTensorLUT *tensor_lut, const GpuWorkloadSourceCode &c } } } + return Status{}; } |