IVGCVSW-5483 'Implement Loading and Saving to File'
* Implemented Serialization and Deserialization of CLContext.
* Fixed flatbuffers android-nn-driver dependency.
!android-nn-driver:4772
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: If806f050535ffaa70922ba0f1ffe7bb10f902329
diff --git a/src/backends/cl/ClContextSerializer.hpp b/src/backends/cl/ClContextSerializer.hpp
new file mode 100644
index 0000000..71e2b1f
--- /dev/null
+++ b/src/backends/cl/ClContextSerializer.hpp
@@ -0,0 +1,35 @@
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <arm_compute/core/CL/CLCompileContext.h>
+
+#include <flatbuffers/flatbuffers.h>
+
+namespace armnn
+{
+
+class ClContextSerializer
+{
+public:
+ ClContextSerializer() = default;
+ ~ClContextSerializer() = default;
+
+ /// Serializes the CLCompileContext built-in programs
+ /// @param [in] clCompileContext The CLCompileContext to be serialized.
+ void Serialize(const arm_compute::CLCompileContext& clCompileContext);
+
+ /// Serializes the ClContext to the stream.
+ /// @param [stream] the stream to save to
+ /// @return true if ClContext is Serialized to the Stream, false otherwise
+ bool SaveSerializedToStream(std::ostream& stream);
+
+private:
+ /// FlatBufferBuilder to create the CLContext FlatBuffers.
+ flatbuffers::FlatBufferBuilder m_FlatBufferBuilder;
+};
+
+} // namespace armnn
\ No newline at end of file