diff options
author | Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-27 17:46:17 +0100 |
---|---|---|
committer | felixjohnny.thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-28 12:08:05 +0000 |
commit | afd38f0c617d6f89b2b4532c6c44f116617e2b6f (patch) | |
tree | 03bc7d5a762099989b16a656fa8d397b490ed70e /compute_kernel_writer/prototype/examples/writer_helper.cpp | |
parent | bdcb4c148ee2fdeaaddf4cf1e57bbb0de02bb894 (diff) | |
download | ComputeLibrary-afd38f0c617d6f89b2b4532c6c44f116617e2b6f.tar.gz |
Apply clang-format on repository
Code is formatted as per a revised clang format configuration
file(not part of this delivery). Version 14.0.6 is used.
Exclusion List:
- files with .cl extension
- files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...)
And the following directories
- compute_kernel_writer/validation/
- tests/
- include/
- src/core/NEON/kernels/convolution/
- src/core/NEON/kernels/arm_gemm/
- src/core/NEON/kernels/arm_conv/
- data/
There will be a follow up for formatting of .cl files and the
files under tests/ and compute_kernel_writer/validation/.
Signed-off-by: Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com>
Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Diffstat (limited to 'compute_kernel_writer/prototype/examples/writer_helper.cpp')
-rw-r--r-- | compute_kernel_writer/prototype/examples/writer_helper.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/compute_kernel_writer/prototype/examples/writer_helper.cpp b/compute_kernel_writer/prototype/examples/writer_helper.cpp index ccef92dcdf..8623afbf50 100644 --- a/compute_kernel_writer/prototype/examples/writer_helper.cpp +++ b/compute_kernel_writer/prototype/examples/writer_helper.cpp @@ -23,14 +23,14 @@ */ #include "ckw/KernelWriter.h" -#include "../include/ckw/KernelWriterHelper.h" #include "ckw/TensorTileSampler.h" +#include "../include/ckw/KernelWriterHelper.h" #include <iostream> using namespace ckw; -TensorTileSampler create_simple_sampler(KernelWriter& writer) +TensorTileSampler create_simple_sampler(KernelWriter &writer) { TensorTileSampler sampler; @@ -65,11 +65,11 @@ TensorTileSampler create_simple_sampler(KernelWriter& writer) int main() { - Kernel kernel("test", GpuTargetLanguage::OpenCL); + Kernel kernel("test", GpuTargetLanguage::OpenCL); KernelWriterHelper<KernelWriter> writer(kernel); - const TensorInfo src_info(DataType::Fp32, TensorShape({ 1, 1, 1, 1, 1 }), TensorDataLayout::Nhwc, 0); - const TensorInfo dst_info(DataType::Fp32, TensorShape({ 1, 1, 1, 1, 1 }), TensorDataLayout::Nhwc, 1); + const TensorInfo src_info(DataType::Fp32, TensorShape({1, 1, 1, 1, 1}), TensorDataLayout::Nhwc, 0); + const TensorInfo dst_info(DataType::Fp32, TensorShape({1, 1, 1, 1, 1}), TensorDataLayout::Nhwc, 1); auto &src_tensor = writer.declare_tensor_argument("src", src_info); auto &dst_tensor = writer.declare_tensor_argument("dst", dst_info); @@ -77,27 +77,24 @@ int main() const auto sampler = create_simple_sampler(writer); auto &src = writer.declare_tile("src_tile", TileInfo(src_tensor.data_type(), sampler.height(), sampler.width())); - auto &other = writer.declare_tile("other_tile", TileInfo(src_tensor.data_type(), sampler.height(), sampler.width())); + auto &other = + writer.declare_tile("other_tile", TileInfo(src_tensor.data_type(), sampler.height(), sampler.width())); auto &dst = writer.declare_tile("dst_tile", TileInfo(src_tensor.data_type(), sampler.height(), sampler.width())); writer.op_load(src, src_tensor, sampler); writer.op_load(other, src_tensor, sampler); writer.op_load(dst, dst_tensor, sampler); - auto test = dst ^ src ^ other; + auto test = dst ^ src ^ other; auto other_test = logical_and(dst, src, other); writer.op_assign(dst, logical_and(dst, src, other)); writer.op_assign(dst, test); writer.op_assign(dst, other_test); writer.op_assign(dst, operator^(operator^(dst, src), other)); - writer.op_if(exp(src) == dst, [&]{ - writer.op_binary_expression(dst, src, BinaryOp::Add, src); - }).op_else_if(exp(src) > dst, [&]{ - writer.op_binary_expression(dst, src, BinaryOp::Add, src); - }).op_else([&] { - writer.op_assign(dst, src); - }); + writer.op_if(exp(src) == dst, [&] { writer.op_binary_expression(dst, src, BinaryOp::Add, src); }) + .op_else_if(exp(src) > dst, [&] { writer.op_binary_expression(dst, src, BinaryOp::Add, src); }) + .op_else([&] { writer.op_assign(dst, src); }); writer.op_assign(dst, src + src * src); writer.op_assign(dst, src * max(src, dst) + src); @@ -106,13 +103,11 @@ int main() writer.op_assign(dst, src ^ dst); writer.op_assign(dst, ~src); - writer.op_for_loop(dst < src, dst += src, [&]{ - writer.op_assign(dst, src + dst); - }); + writer.op_for_loop(dst < src, dst += src, [&] { writer.op_assign(dst, src + dst); }); writer.op_assign(dst += src); writer.op_assign(dst += exp(src)); std::cout << "======== KERNEL ========" << std::endl; std::cout << writer.generate_code() << std::endl; -}
\ No newline at end of file +} |