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

Function validateMemoryObject

hipamd/src/hip_memory.cpp:2131–2162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2129}
2130
2131hipError_t validateMemoryObject(const void* ptr, bool isDeviceMemory, amd::Coord3D& origin,
2132 amd::Coord3D& copyRegion, size_t rowPitch, size_t slicePitch,
2133 amd::BufferRect& rect) {
2134 if (ptr == nullptr) {
2135 return hipErrorInvalidValue;
2136 }
2137
2138 if (!rect.create(static_cast<size_t*>(origin), static_cast<size_t*>(copyRegion), rowPitch,
2139 slicePitch)) {
2140 return hipErrorInvalidValue;
2141 }
2142
2143 size_t offset = 0;
2144 amd::Memory* memory = nullptr;
2145 memory = getMemoryObject(ptr, offset);
2146 if (memory == nullptr && isDeviceMemory) {
2147 return hipErrorInvalidValue;
2148 }
2149
2150 amd::Coord3D start(rect.start_, 0, 0);
2151 amd::Coord3D size(rect.end_, 1, 1);
2152 if (memory && !memory->validateRegion(start, size)) {
2153 return hipErrorInvalidValue;
2154 }
2155
2156 rect.start_ += offset;
2157
2158 origin.c[0] = rect.offset(0, 0, 0); // Get the physical offset of the logic origin
2159 origin.c[1] = origin.c[2] = 0;
2160
2161 return hipSuccess;
2162}
2163
2164hipError_t ihipDrvMemcpy3D_validate(const HIP_MEMCPY3D* pCopy, amd::Coord3D& srcOrigin,
2165 amd::Coord3D& dstOrigin, amd::Coord3D& copyRegion,

Callers 1

ihipDrvMemcpy3D_validateFunction · 0.85

Calls 4

getMemoryObjectFunction · 0.85
validateRegionMethod · 0.80
createMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected