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

Method InsertMemoryRegion

tensorflow/contrib/verbs/rdma.cc:1421–1436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1419}
1420
1421void RdmaMemoryMgr::InsertMemoryRegion(void* addr, size_t length,
1422 const std::string& allocator_name) {
1423 if (length == 0) return;
1424 ibv_mr* mr = ibv_reg_mr(pd_, addr, length,
1425 IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE);
1426 RDMA_LOG(1) << "Insert memory region 0x" << std::hex << mr->rkey << ". ["
1427 << addr << "-" << (void*)((uint64_t)addr + length - 1) << "]"
1428 << " SIZE: 0x" << length << " (" << allocator_name << ").";
1429 if (mr != nullptr) {
1430 mutex_lock l(mrs_mu_);
1431 auto iter = std::upper_bound(mrs_.begin(), mrs_.end(), addr, &Comparator);
1432 mrs_.insert(iter, {mr, &MRDeleter});
1433 } else {
1434 LOG(WARNING) << "Cannot register memory region";
1435 }
1436}
1437
1438void RdmaMemoryMgr::EvictMemoryRegion(void* addr, size_t length) {
1439 if (length == 0) return;

Callers 1

RegMemVisitorsMethod · 0.45

Calls 4

upper_boundFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected