aboutsummaryrefslogtreecommitdiff
path: root/src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp
diff options
context:
space:
mode:
authorRamy Elgammal <ramelg01@e129512.arm.com>2023-01-11 18:48:04 +0000
committerRamy Elgammal <ramy.elgammal@arm.com>2023-01-25 10:24:23 +0000
commit002e6530f6218b00a28aef9be8b21efb08cf3602 (patch)
treef3e2f9d064b985ffe283512825b34cdd59f29f50 /src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp
parentcc2877368d5e15d9ea89d31c84ec651fc0fffd13 (diff)
downloadComputeLibrary-002e6530f6218b00a28aef9be8b21efb08cf3602.tar.gz
Implement dynamic fusion softmax operator
- Return aux tensorInfo by get_aux_tensors() at runtime to init the aux tensor with the right size. - Keep softmax unfusable for this commit - Hence, added Tensor3D to template writer arguments declaration, for sake of keeping dynamic fusion softmax componenets' kernels matching their cl counterparts. Resolves: COMPMID-5523 Change-Id: I667f39545db925f667036ef448302c79a0330373 Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com> Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/483924 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Comments-Addressed: bsgcomp <bsgcomp@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8986 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Jakub Sujak <jakub.sujak@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp')
-rw-r--r--src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp b/src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp
index 2ab6316947..eda15f1d95 100644
--- a/src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp
+++ b/src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateWriter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Arm Limited.
+ * Copyright (c) 2022-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -180,7 +180,8 @@ std::string ClTemplateWriter::write_code()
}
auto arguments = _components.get_argument_tensors();
- std::sort(arguments.begin(), arguments.end(), [](const ITensorInfo *l, const ITensorInfo *r) {
+ std::sort(arguments.begin(), arguments.end(), [](const ITensorInfo * l, const ITensorInfo * r)
+ {
return l->id() < r->id();
});
code += write_kernel_signature(_vtable.get_variable_list(arguments));
@@ -192,16 +193,16 @@ std::string ClTemplateWriter::write_code()
code += " //------------------ END KERNEL_BUILDER_COORDINATE ---------------------\n";
{
- const auto tiles = _components.get_tiles();
+ const auto tiles = _components.get_tiles();
std::stringstream tiles_ss;
tiles_ss << " //------------------ START TILE DECLARATION ---------------------\n";
for(auto tile : tiles)
{
- const auto var = _vtable.get_variable(tile);
+ const auto var = _vtable.get_variable(tile);
const auto data_type = get_cl_type_from_data_type(tile->data_type());
- const auto var_name = var.uniq_name;
+ const auto var_name = var.uniq_name;
tiles_ss << " TILE(" << data_type << ", M0, N0, " << var_name << ");\n";
}
@@ -276,6 +277,11 @@ std::string ClTemplateWriter::write_argument_declaration(const GpuKernelVariable
code += "\n TENSOR4D_T(" + var.uniq_name + ", IMAGE)";
break;
}
+ case GpuKernelArgumentInfo::Type::Tensor_3D:
+ {
+ code += "\n TENSOR3D_DECLARATION(" + var.uniq_name + ")";
+ break;
+ }
default:
{
ARM_COMPUTE_ERROR("Unsupported declaration generation for GpuKernelArgumentInfo::Type");