MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AllocateConstObject

Method AllocateConstObject

tensorflow/lite/delegates/gpu/gl/runtime.cc:267–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267Status Runtime::AllocateConstObject(const Object& object, uint32_t* id) {
268 const ObjectData* data = GetData(object);
269 if (data == nullptr) {
270 return InternalError("Unable to allocate reference as a const object");
271 }
272 *id = next_const_id_++;
273 switch (object.object_type) {
274 case ObjectType::BUFFER: {
275 GlBuffer gl_buffer;
276 if (!shared_readonly_buffer_ ||
277 !shared_readonly_buffer_->Add(*data, &gl_buffer)) {
278 RETURN_IF_ERROR(MakeGlBuffer(object, *data, &gl_buffer));
279 }
280 RETURN_IF_ERROR(const_objects_.RegisterBuffer(*id, std::move(gl_buffer)));
281 break;
282 }
283 case ObjectType::TEXTURE: {
284 GlTexture gl_texture;
285 RETURN_IF_ERROR(MakeGlTexture(object, *data, &gl_texture));
286 RETURN_IF_ERROR(
287 const_objects_.RegisterTexture(*id, std::move(gl_texture)));
288 break;
289 }
290 case ObjectType::UNKNOWN:
291 return InternalError("Unknown object type");
292 }
293 return OkStatus();
294}
295
296Status Runtime::PrepareForExecution() {
297 if (shared_readonly_buffer_ && !shared_readonly_buffer_->empty()) {

Callers

nothing calls this directly

Calls 8

MakeGlBufferFunction · 0.85
MakeGlTextureFunction · 0.85
OkStatusFunction · 0.85
RegisterTextureMethod · 0.80
GetDataFunction · 0.70
InternalErrorFunction · 0.50
AddMethod · 0.45
RegisterBufferMethod · 0.45

Tested by

no test coverage detected