aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/backends/ClWorkloadUtils.hpp
blob: 549a0bbc2531be1ed135a3f36f9b67974137c2bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#pragma once

#include "Workload.hpp"
#include <arm_compute/core/CL/OpenCL.h>
#include <arm_compute/runtime/CL/CLFunctions.h>
#include <arm_compute/runtime/SubTensor.h>
#include "ArmComputeTensorUtils.hpp"

namespace armnn
{

template <typename T>
void CopyArmComputeClTensorData(const T* srcData, arm_compute::CLTensor& dstTensor)
{
    {
        ARMNN_SCOPED_PROFILING_EVENT(Compute::GpuAcc, "MapClTensorForWriting");
        dstTensor.map(true);
    }

    {
        ARMNN_SCOPED_PROFILING_EVENT(Compute::GpuAcc, "CopyToClTensor");
        armcomputetensorutils::CopyArmComputeITensorData<T>(srcData, dstTensor);
    }

    dstTensor.unmap();
}

template <typename T>
void InitialiseArmComputeClTensorData(arm_compute::CLTensor& clTensor, const T* data)
{
    armcomputetensorutils::InitialiseArmComputeTensorEmpty(clTensor);
    CopyArmComputeClTensorData<T>(data, clTensor);
}

} //namespace armnn