MCPcopy Create free account
hub / github.com/ARM-software/armnn / Serialize

Method Serialize

src/backends/cl/ClContextSerializer.cpp:23–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21{
22
23void ClContextSerializer::Serialize(const arm_compute::CLCompileContext& clCompileContext)
24{
25 // Get map of built programs from clCompileContext
26 std::map<std::string, cl::Program> builtProgramsMap = clCompileContext.get_built_programs();
27 if (builtProgramsMap.empty())
28 {
29 ARMNN_LOG(warning) << "There are no built programs to be serialised.";
30 return;
31 }
32
33 // Create Flatbuffer CL Programs
34 std::vector<flatbuffers::Offset<armnn::Program>> clPrograms;
35 for(const auto& program : builtProgramsMap)
36 {
37 std::vector<std::vector<uint8_t>> binaries = program.second.getInfo<CL_PROGRAM_BINARIES>();
38 clPrograms.push_back(CreateProgram(m_FlatBufferBuilder,
39 m_FlatBufferBuilder.CreateString(program.first),
40 m_FlatBufferBuilder.CreateVector(binaries[0])));
41 }
42
43 // Create Flatbuffer CLContext
44 auto clContext = CreateClContext(m_FlatBufferBuilder, m_FlatBufferBuilder.CreateVector(clPrograms));
45
46 m_FlatBufferBuilder.Finish(clContext);
47}
48
49bool ClContextSerializer::SaveSerializedToStream(std::ostream& stream)
50{

Callers 1

AfterWorkloadsCreatedMethod · 0.45

Calls 5

CreateProgramFunction · 0.85
CreateClContextFunction · 0.85
emptyMethod · 0.80
push_backMethod · 0.80
FinishMethod · 0.45

Tested by

no test coverage detected