11 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h>
12 #include <arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h>
13 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuMatMul.h>
14 #include <arm_compute/dynamic_fusion/sketch/gpu/operators/GpuOutput.h>
16 using namespace arm_compute::experimental::dynamic_fusion;
17 using namespace armnn::armcomputetensorutils;
27 auto compileCtx = arm_compute::CLKernelLibrary::get().get_compile_context();
28 auto workloadContext = GpuWorkloadContext(&compileCtx);
29 GpuWorkloadSketch sketch{ &workloadContext };
31 arm_compute::TensorInfo aclInput0Info = BuildArmComputeTensorInfo(input0, input0.
GetNumDimensions());
32 arm_compute::TensorInfo aclInput1Info = BuildArmComputeTensorInfo(input1, input1.
GetNumDimensions());
34 aclInput0Info.set_are_values_constant(input0.
IsConstant());
35 aclInput1Info.set_are_values_constant(input1.
IsConstant());
37 arm_compute::ITensorInfo* inputInfo0 = workloadContext.create_tensor_info(aclInput0Info);
38 arm_compute::ITensorInfo* inputInfo1 = workloadContext.create_tensor_info(aclInput1Info);
40 MatMulAttributes matMulAttributes{};
43 GpuMatMulSettings matmulSettings{};
48 return GpuMatMul::validate_op(sketch, inputInfo0, inputInfo1, matMulAttributes, matmulSettings);
56 GpuWorkloadSketch* sketch = blob->
sketch.get();
58 std::vector<arm_compute::ITensorInfo*> inputTensorInfos = {};
59 std::vector<arm_compute::ITensorInfo*> outputTensorInfos = {};
61 arm_compute::TensorInfo aclInput0Info = BuildArmComputeTensorInfo(input0, input0.
GetNumDimensions());
62 arm_compute::TensorInfo aclInput1Info = BuildArmComputeTensorInfo(input1, input1.
GetNumDimensions());
64 aclInput0Info.set_are_values_constant(input0.
IsConstant());
65 aclInput1Info.set_are_values_constant(input1.
IsConstant());
67 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclInput0Info));
68 inputTensorInfos.emplace_back(workloadContext->create_tensor_info(aclInput1Info));
70 MatMulAttributes matMulAttributes{};
73 GpuMatMulSettings matmulSettings{};
85 const bool supported = aclStatus.error_code() == arm_compute::ErrorCode::OK;
91 arm_compute::ITensorInfo* addOutputInfo = GpuMatMul::create_op(*sketch,
98 outputTensorInfos.emplace_back(workloadContext->create_tensor_info());
99 GpuOutput::create_op(*sketch, addOutputInfo, outputTensorInfos[0]);
102 blob->
inputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(inputTensorInfos);
103 blob->
outputTensorInfos = std::make_unique<std::vector<arm_compute::ITensorInfo*>>(outputTensorInfos);