1*89c4ff92SAndroid Build Coastguard Worker // 2*89c4ff92SAndroid Build Coastguard Worker // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. 3*89c4ff92SAndroid Build Coastguard Worker // SPDX-License-Identifier: MIT 4*89c4ff92SAndroid Build Coastguard Worker // 5*89c4ff92SAndroid Build Coastguard Worker 6*89c4ff92SAndroid Build Coastguard Worker #pragma once 7*89c4ff92SAndroid Build Coastguard Worker 8*89c4ff92SAndroid Build Coastguard Worker #include <arm_compute/core/CL/CLCompileContext.h> 9*89c4ff92SAndroid Build Coastguard Worker 10*89c4ff92SAndroid Build Coastguard Worker namespace armnn 11*89c4ff92SAndroid Build Coastguard Worker { 12*89c4ff92SAndroid Build Coastguard Worker 13*89c4ff92SAndroid Build Coastguard Worker class ClContextDeserializer 14*89c4ff92SAndroid Build Coastguard Worker { 15*89c4ff92SAndroid Build Coastguard Worker public: 16*89c4ff92SAndroid Build Coastguard Worker ClContextDeserializer() = default; 17*89c4ff92SAndroid Build Coastguard Worker ~ClContextDeserializer() = default; 18*89c4ff92SAndroid Build Coastguard Worker 19*89c4ff92SAndroid Build Coastguard Worker /// Deserializes the CLCompileContext built-in programs from a binary file 20*89c4ff92SAndroid Build Coastguard Worker /// @param [in] clCompileContext The CLCompileContext to be serialized 21*89c4ff92SAndroid Build Coastguard Worker /// @param [in] context The CL Kernel context built-in program will be created from 22*89c4ff92SAndroid Build Coastguard Worker /// @param [in] device The CL Kernel device built-in program will be created from 23*89c4ff92SAndroid Build Coastguard Worker /// @param [in] filePath The serialized file 24*89c4ff92SAndroid Build Coastguard Worker void Deserialize(arm_compute::CLCompileContext& clCompileContext, 25*89c4ff92SAndroid Build Coastguard Worker cl::Context& context, 26*89c4ff92SAndroid Build Coastguard Worker cl::Device& device, 27*89c4ff92SAndroid Build Coastguard Worker const std::string& filePath); 28*89c4ff92SAndroid Build Coastguard Worker 29*89c4ff92SAndroid Build Coastguard Worker /// Deserializes the CLCompileContext built-in programs from binary file contents 30*89c4ff92SAndroid Build Coastguard Worker /// @param [in] clCompileContext The CLCompileContext to be serialized 31*89c4ff92SAndroid Build Coastguard Worker /// @param [in] context The CL Kernel context built-in program will be created from 32*89c4ff92SAndroid Build Coastguard Worker /// @param [in] device The CL Kernel device built-in program will be created from 33*89c4ff92SAndroid Build Coastguard Worker /// @param [in] filePath The serialized file 34*89c4ff92SAndroid Build Coastguard Worker void DeserializeFromBinary(arm_compute::CLCompileContext& clCompileContext, 35*89c4ff92SAndroid Build Coastguard Worker cl::Context& context, 36*89c4ff92SAndroid Build Coastguard Worker cl::Device& device, 37*89c4ff92SAndroid Build Coastguard Worker const std::vector<uint8_t>& binaryContent); 38*89c4ff92SAndroid Build Coastguard Worker 39*89c4ff92SAndroid Build Coastguard Worker }; 40*89c4ff92SAndroid Build Coastguard Worker 41*89c4ff92SAndroid Build Coastguard Worker } // namespace armnn