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

Method Add

tensorflow/compiler/xrt/xrt_util.cc:54–71  ·  view source on GitHub ↗

Adds the given handle at the index position, by marking it releasable according to the release argument. If an existing, and to-be-released handle already exists at the same index, it will be released.

Source from the content-addressed store, hash-verified

52 // according to the release argument. If an existing, and to-be-released
53 // handle already exists at the same index, it will be released.
54 Status Add(size_t index, int64 handle, bool release) {
55 if (index >= handles_.size()) {
56 handles_.resize(index + 1, XRTMemoryManager::InvalidKey());
57 handles_release_.resize(index + 1, false);
58 }
59 if (handles_release_[index]) {
60 Status status = memory_manager_->Release(handles_[index]);
61 if (!status.ok()) {
62 if (release) {
63 memory_manager_->Release(handle).IgnoreError();
64 }
65 return status;
66 }
67 }
68 handles_[index] = handle;
69 handles_release_[index] = release;
70 return Status::OK();
71 }
72
73 // Adds a to-be-released tuple allocation at the given index.
74 Status Add(size_t index, RefPtr<XRTTupleAllocation> tuple) {

Callers 5

ExecuteChainedFunction · 0.45
ExtractTfVersionsFunction · 0.45
XlaSvdOpMethod · 0.45

Calls 7

AddClass · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
ReleaseMethod · 0.45
okMethod · 0.45
IgnoreErrorMethod · 0.45
RegisterMethod · 0.45

Tested by

no test coverage detected