From 38b600d8abb2c5f7a44511b5deddf441f975d51d Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Thu, 15 Feb 2024 15:02:19 +0000 Subject: IVGCVSW-7968 Update Doxygen docu for 24.02 Signed-off-by: Nikhil Raj Change-Id: I8c1e45815c6cf78f80d6f2c0959a5bbba6cd11de --- latest/_gpu_fsa_cast_8cpp_source.html | 230 ++++++++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 latest/_gpu_fsa_cast_8cpp_source.html (limited to 'latest/_gpu_fsa_cast_8cpp_source.html') diff --git a/latest/_gpu_fsa_cast_8cpp_source.html b/latest/_gpu_fsa_cast_8cpp_source.html new file mode 100644 index 0000000000..49952f72e5 --- /dev/null +++ b/latest/_gpu_fsa_cast_8cpp_source.html @@ -0,0 +1,230 @@ + + + + + + + + +Arm NN: src/backends/gpuFsa/layers/GpuFsaCast.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  24.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
GpuFsaCast.cpp
+
+
+Go to the documentation of this file.
1 //
+
2 // Copyright © 2024 Arm Ltd and Contributors. All rights reserved.
+
3 // SPDX-License-Identifier: MIT
+
4 //
+
5 
+
6 #include "GpuFsaCast.hpp"
+ +
8 
+ +
10 
+
11 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuCast.h>
+
12 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuOutput.h>
+
13 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h>
+
14 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h>
+
15 
+
16 using namespace arm_compute::experimental::dynamic_fusion;
+
17 
+
18 namespace armnn
+
19 {
+
20 
+
21 static constexpr arm_compute::ConvertPolicy g_AclConvertPolicy = arm_compute::ConvertPolicy::SATURATE;
+
22 
+
23 static CastAttributes CastAttributesFromTensorInfo(const TensorInfo& input)
+
24 {
+
25  using namespace armcomputetensorutils;
+
26 
+
27  CastAttributes cast_attr;
+
28  arm_compute::DataType dataType = GetArmComputeDataType(input.GetDataType(), false);
+
29  cast_attr.data_type(dataType).convert_policy(g_AclConvertPolicy);
+
30  return cast_attr;
+
31 }
+
32 
+ +
34 {
+
35  using namespace armcomputetensorutils;
+
36 
+
37  // Create a new workload sketch, for validation purposes
+
38  auto compileCtx = arm_compute::CLKernelLibrary::get().get_compile_context();
+
39  auto workloadContext = GpuWorkloadContext(&compileCtx);
+
40  GpuWorkloadSketch sketch{ &workloadContext };
+
41 
+
42  arm_compute::TensorInfo aclinputInfo = BuildArmComputeTensorInfo(input, input.GetNumDimensions());
+
43 
+
44  aclinputInfo.set_are_values_constant(input.IsConstant());
+
45 
+
46  arm_compute::ITensorInfo* inputInfo0 = workloadContext.create_tensor_info(aclinputInfo);
+
47 
+
48  CastAttributes cast_attr = CastAttributesFromTensorInfo(output);
+
49 
+
50  arm_compute::Status aclStatus = GpuCast::validate_op(sketch, inputInfo0, cast_attr);
+
51 #ifndef NDEBUG
+
52  const bool validated = aclStatus.error_code() == arm_compute::ErrorCode::OK;
+
53  if (!validated)
+
54  {
+
55  std::cout << "GpuFsaCastValidate failed: " << aclStatus.error_description() << std::endl;
+
56  }
+
57 #endif
+
58  return aclStatus;
+
59 }
+
60 
+ +
62  const TensorInfo& input,
+
63  const TensorInfo& output)
+
64 {
+
65  using namespace armcomputetensorutils;
+
66 
+
67  GpuWorkloadSketch* sketch = blob->sketch.get();
+
68  GpuWorkloadContext* workloadContext = blob->workloadContext.get();
+
69  std::vector<arm_compute::ITensorInfo*> inputTensorInfos = {};
+
70  std::vector<arm_compute::ITensorInfo*> outputTensorInfos = {};
+
71 
+
72  arm_compute::TensorInfo aclinputInfo = BuildArmComputeTensorInfo(input, input.GetNumDimensions());
+
73 
+
74  aclinputInfo.set_are_values_constant(input.IsConstant());
+
75 
+
76  inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclinputInfo));
+
77 
+
78  CastAttributes cast_attr = CastAttributesFromTensorInfo(output);
+
79 
+
80  // Validate operator, check status and update reasonIfUnsupported
+
81  arm_compute::Status aclStatus = GpuCast::validate_op(*sketch, inputTensorInfos[0], cast_attr);
+
82  const bool validated = aclStatus.error_code() == arm_compute::ErrorCode::OK;
+
83  if (!validated)
+
84  {
+
85  throw BackendCapabilityException("\"" + std::string(GpuFsaBackendId())
+
86  + "\" backend failed during cast operator validation");
+
87  }
+
88 
+
89  arm_compute::ITensorInfo* castOutputInfo =
+
90  GpuCast::create_op(*sketch, inputTensorInfos[0], cast_attr);
+
91 
+
92  // Temporary fix until fusing attempt is make for GpuFsa backend and Output layer workload is created.
+
93  outputTensorInfos.emplace_back(workloadContext->create_tensor_info());
+
94  GpuOutput::create_op(*sketch, castOutputInfo, outputTensorInfos[0]);
+
95 
+
96  // Store the TensorInfos within the blob as unique_ptrs to be used later
+
97  blob->inputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(inputTensorInfos);
+
98  blob->outputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(outputTensorInfos);
+
99 }
+
100 
+
101 } // namespace armnn
+
+
+
arm_compute::Status GpuFsaCastValidate(const TensorInfo &input, const TensorInfo &output)
Definition: GpuFsaCast.cpp:33
+ +
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:197
+
constexpr const char * GpuFsaBackendId()
+
bool IsConstant() const
Definition: Tensor.cpp:509
+
std::unique_ptr< std::vector< arm_compute::ITensorInfo * > > inputTensorInfos
+
DataType
Definition: Types.hpp:48
+
std::unique_ptr< arm_compute::experimental::dynamic_fusion::GpuWorkloadSketch > sketch
+
Status
Definition: Types.hpp:42
+
void GpuFsaCastCreateOp(GpuFsaPreCompiledBlob *blob, const TensorInfo &input, const TensorInfo &output)
Definition: GpuFsaCast.cpp:61
+ + +
Copyright (c) 2021 ARM Limited and Contributors.
+ +
std::shared_ptr< arm_compute::experimental::dynamic_fusion::GpuWorkloadContext > workloadContext
+
A structure which contains all the elements needed to execute a fused workload in the GpuFsa Backend.
+ +
std::unique_ptr< std::vector< arm_compute::ITensorInfo * > > outputTensorInfos
+ + + + -- cgit v1.2.1