1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 // automatically generated by the FlatBuffers compiler, do not modify
16
17
18 #ifndef FLATBUFFERS_GENERATED_COMPILEDPROGRAMCACHE_TFLITE_GPU_CL_DATA_H_
19 #define FLATBUFFERS_GENERATED_COMPILEDPROGRAMCACHE_TFLITE_GPU_CL_DATA_H_
20
21 #include "flatbuffers/flatbuffers.h"
22
23 namespace tflite {
24 namespace gpu {
25 namespace cl {
26 namespace data {
27
28 struct Program;
29
30 struct CompiledCache;
31
32 struct Program FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
33 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
34 VT_FINGERPRINT = 4,
35 VT_BINARY = 6
36 };
fingerprintFLATBUFFERS_FINAL_CLASS37 uint64_t fingerprint() const {
38 return GetField<uint64_t>(VT_FINGERPRINT, 0);
39 }
binaryFLATBUFFERS_FINAL_CLASS40 const flatbuffers::Vector<uint8_t> *binary() const {
41 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_BINARY);
42 }
VerifyFLATBUFFERS_FINAL_CLASS43 bool Verify(flatbuffers::Verifier &verifier) const {
44 return VerifyTableStart(verifier) &&
45 VerifyField<uint64_t>(verifier, VT_FINGERPRINT) &&
46 VerifyOffset(verifier, VT_BINARY) &&
47 verifier.VerifyVector(binary()) &&
48 verifier.EndTable();
49 }
50 };
51
52 struct ProgramBuilder {
53 flatbuffers::FlatBufferBuilder &fbb_;
54 flatbuffers::uoffset_t start_;
add_fingerprintProgramBuilder55 void add_fingerprint(uint64_t fingerprint) {
56 fbb_.AddElement<uint64_t>(Program::VT_FINGERPRINT, fingerprint, 0);
57 }
add_binaryProgramBuilder58 void add_binary(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> binary) {
59 fbb_.AddOffset(Program::VT_BINARY, binary);
60 }
ProgramBuilderProgramBuilder61 explicit ProgramBuilder(flatbuffers::FlatBufferBuilder &_fbb)
62 : fbb_(_fbb) {
63 start_ = fbb_.StartTable();
64 }
65 ProgramBuilder &operator=(const ProgramBuilder &);
FinishProgramBuilder66 flatbuffers::Offset<Program> Finish() {
67 const auto end = fbb_.EndTable(start_);
68 auto o = flatbuffers::Offset<Program>(end);
69 return o;
70 }
71 };
72
73 inline flatbuffers::Offset<Program> CreateProgram(
74 flatbuffers::FlatBufferBuilder &_fbb,
75 uint64_t fingerprint = 0,
76 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> binary = 0) {
77 ProgramBuilder builder_(_fbb);
78 builder_.add_fingerprint(fingerprint);
79 builder_.add_binary(binary);
80 return builder_.Finish();
81 }
82
83 inline flatbuffers::Offset<Program> CreateProgramDirect(
84 flatbuffers::FlatBufferBuilder &_fbb,
85 uint64_t fingerprint = 0,
86 const std::vector<uint8_t> *binary = nullptr) {
87 auto binary__ = binary ? _fbb.CreateVector<uint8_t>(*binary) : 0;
88 return tflite::gpu::cl::data::CreateProgram(
89 _fbb,
90 fingerprint,
91 binary__);
92 }
93
94 struct CompiledCache FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
95 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
96 VT_DRIVER_VERSION = 4,
97 VT_PROGRAMS = 6
98 };
driver_versionFLATBUFFERS_FINAL_CLASS99 const flatbuffers::String *driver_version() const {
100 return GetPointer<const flatbuffers::String *>(VT_DRIVER_VERSION);
101 }
programsFLATBUFFERS_FINAL_CLASS102 const flatbuffers::Vector<flatbuffers::Offset<Program>> *programs() const {
103 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Program>> *>(VT_PROGRAMS);
104 }
VerifyFLATBUFFERS_FINAL_CLASS105 bool Verify(flatbuffers::Verifier &verifier) const {
106 return VerifyTableStart(verifier) &&
107 VerifyOffset(verifier, VT_DRIVER_VERSION) &&
108 verifier.VerifyString(driver_version()) &&
109 VerifyOffset(verifier, VT_PROGRAMS) &&
110 verifier.VerifyVector(programs()) &&
111 verifier.VerifyVectorOfTables(programs()) &&
112 verifier.EndTable();
113 }
114 };
115
116 struct CompiledCacheBuilder {
117 flatbuffers::FlatBufferBuilder &fbb_;
118 flatbuffers::uoffset_t start_;
add_driver_versionCompiledCacheBuilder119 void add_driver_version(flatbuffers::Offset<flatbuffers::String> driver_version) {
120 fbb_.AddOffset(CompiledCache::VT_DRIVER_VERSION, driver_version);
121 }
add_programsCompiledCacheBuilder122 void add_programs(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Program>>> programs) {
123 fbb_.AddOffset(CompiledCache::VT_PROGRAMS, programs);
124 }
CompiledCacheBuilderCompiledCacheBuilder125 explicit CompiledCacheBuilder(flatbuffers::FlatBufferBuilder &_fbb)
126 : fbb_(_fbb) {
127 start_ = fbb_.StartTable();
128 }
129 CompiledCacheBuilder &operator=(const CompiledCacheBuilder &);
FinishCompiledCacheBuilder130 flatbuffers::Offset<CompiledCache> Finish() {
131 const auto end = fbb_.EndTable(start_);
132 auto o = flatbuffers::Offset<CompiledCache>(end);
133 return o;
134 }
135 };
136
137 inline flatbuffers::Offset<CompiledCache> CreateCompiledCache(
138 flatbuffers::FlatBufferBuilder &_fbb,
139 flatbuffers::Offset<flatbuffers::String> driver_version = 0,
140 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Program>>> programs = 0) {
141 CompiledCacheBuilder builder_(_fbb);
142 builder_.add_programs(programs);
143 builder_.add_driver_version(driver_version);
144 return builder_.Finish();
145 }
146
147 inline flatbuffers::Offset<CompiledCache> CreateCompiledCacheDirect(
148 flatbuffers::FlatBufferBuilder &_fbb,
149 const char *driver_version = nullptr,
150 const std::vector<flatbuffers::Offset<Program>> *programs = nullptr) {
151 auto driver_version__ = driver_version ? _fbb.CreateString(driver_version) : 0;
152 auto programs__ = programs ? _fbb.CreateVector<flatbuffers::Offset<Program>>(*programs) : 0;
153 return tflite::gpu::cl::data::CreateCompiledCache(
154 _fbb,
155 driver_version__,
156 programs__);
157 }
158
GetCompiledCache(const void * buf)159 inline const tflite::gpu::cl::data::CompiledCache *GetCompiledCache(const void *buf) {
160 return flatbuffers::GetRoot<tflite::gpu::cl::data::CompiledCache>(buf);
161 }
162
GetSizePrefixedCompiledCache(const void * buf)163 inline const tflite::gpu::cl::data::CompiledCache *GetSizePrefixedCompiledCache(const void *buf) {
164 return flatbuffers::GetSizePrefixedRoot<tflite::gpu::cl::data::CompiledCache>(buf);
165 }
166
CompiledCacheIdentifier()167 inline const char *CompiledCacheIdentifier() {
168 return "AFCM";
169 }
170
CompiledCacheBufferHasIdentifier(const void * buf)171 inline bool CompiledCacheBufferHasIdentifier(const void *buf) {
172 return flatbuffers::BufferHasIdentifier(
173 buf, CompiledCacheIdentifier());
174 }
175
VerifyCompiledCacheBuffer(flatbuffers::Verifier & verifier)176 inline bool VerifyCompiledCacheBuffer(
177 flatbuffers::Verifier &verifier) {
178 return verifier.VerifyBuffer<tflite::gpu::cl::data::CompiledCache>(CompiledCacheIdentifier());
179 }
180
VerifySizePrefixedCompiledCacheBuffer(flatbuffers::Verifier & verifier)181 inline bool VerifySizePrefixedCompiledCacheBuffer(
182 flatbuffers::Verifier &verifier) {
183 return verifier.VerifySizePrefixedBuffer<tflite::gpu::cl::data::CompiledCache>(CompiledCacheIdentifier());
184 }
185
CompiledCacheExtension()186 inline const char *CompiledCacheExtension() {
187 return "jetbin";
188 }
189
FinishCompiledCacheBuffer(flatbuffers::FlatBufferBuilder & fbb,flatbuffers::Offset<tflite::gpu::cl::data::CompiledCache> root)190 inline void FinishCompiledCacheBuffer(
191 flatbuffers::FlatBufferBuilder &fbb,
192 flatbuffers::Offset<tflite::gpu::cl::data::CompiledCache> root) {
193 fbb.Finish(root, CompiledCacheIdentifier());
194 }
195
FinishSizePrefixedCompiledCacheBuffer(flatbuffers::FlatBufferBuilder & fbb,flatbuffers::Offset<tflite::gpu::cl::data::CompiledCache> root)196 inline void FinishSizePrefixedCompiledCacheBuffer(
197 flatbuffers::FlatBufferBuilder &fbb,
198 flatbuffers::Offset<tflite::gpu::cl::data::CompiledCache> root) {
199 fbb.FinishSizePrefixed(root, CompiledCacheIdentifier());
200 }
201
202 } // namespace data
203 } // namespace cl
204 } // namespace gpu
205 } // namespace tflite
206
207 #endif // FLATBUFFERS_GENERATED_COMPILEDPROGRAMCACHE_TFLITE_GPU_CL_DATA_H_
208