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

Method PrepareForExecution

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

Source from the content-addressed store, hash-verified

294}
295
296Status Runtime::PrepareForExecution() {
297 if (shared_readonly_buffer_ && !shared_readonly_buffer_->empty()) {
298 GlBuffer shared_buffer;
299 RETURN_IF_ERROR(
300 shared_readonly_buffer_->CreateSharedGlBuffer(&shared_buffer));
301 shared_readonly_buffer_.reset(nullptr);
302 RETURN_IF_ERROR(const_objects_.RegisterBuffer(next_const_id_++,
303 std::move(shared_buffer)));
304 }
305
306 if (options_.reuse_internal_objects) {
307 // Analyze internal objects and make a pool of shared objects to be re-used
308 // by them. These shared objects need to be allocated upfront.
309 std::vector<Object> shared_objects;
310 RETURN_IF_ERROR(AssignInternalObjects(&shared_objects));
311 for (const Object& object : shared_objects) {
312 RETURN_IF_ERROR(AllocateInternalObject(object));
313 }
314 }
315
316 // Allocate all internal objects and create bindings for them.
317 for (auto& program : programs_) {
318 for (auto& object : program.refs) {
319 // Check whether it is created already.
320 BindFunc binding;
321 ObjectRef ref = GetRef(object);
322 Status status = MakeBindingFunc(object, ref, internal_objects_, &binding);
323 if (!status.ok()) {
324 if (status.code() != StatusCode::kNotFound) {
325 return status;
326 }
327 RETURN_IF_ERROR(AllocateInternalObject(object));
328 RETURN_IF_ERROR(
329 MakeBindingFunc(object, ref, internal_objects_, &binding));
330 }
331 program.bindings.push_back(std::move(binding));
332 }
333 program.refs.clear();
334 }
335 return OkStatus();
336}
337
338namespace {
339

Callers 1

api.ccFile · 0.80

Calls 11

GetRefFunction · 0.85
MakeBindingFuncFunction · 0.85
OkStatusFunction · 0.85
CreateSharedGlBufferMethod · 0.80
emptyMethod · 0.45
resetMethod · 0.45
RegisterBufferMethod · 0.45
okMethod · 0.45
codeMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected