MCPcopy Create free account
hub / github.com/ROCm/clr / getMemoryObjectWithOffset

Function getMemoryObjectWithOffset

hipamd/src/hip_memory.cpp:73–94  ·  view source on GitHub ↗

================================================================================================

Source from the content-addressed store, hash-verified

71
72// ================================================================================================
73amd::Memory* getMemoryObjectWithOffset(const void* ptr, const size_t size) {
74 size_t offset = 0;
75 amd::Memory* memObj = getMemoryObject(ptr, offset);
76
77 if (memObj != nullptr) {
78 if (size > (memObj->getSize() - offset)) {
79 return nullptr;
80 }
81 memObj = new (memObj->getContext()) amd::Buffer(*memObj, memObj->getMemFlags(), offset, size);
82 if (memObj == nullptr) {
83 ;
84 return nullptr;
85 }
86
87 if (!memObj->create(nullptr)) {
88 memObj->release();
89 return nullptr;
90 }
91 }
92
93 return memObj;
94}
95
96// ================================================================================================
97hipError_t ihipFree(void* ptr) {

Callers 1

ihipCreateTextureObjectFunction · 0.85

Calls 5

getMemoryObjectFunction · 0.85
getMemFlagsMethod · 0.80
getSizeMethod · 0.45
createMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected