Return error from hipMallocManaged for size =0

Change-Id: Ida0cecf05e1df731176d41e59422d1e606cc9bd9


[ROCm/clr commit: 236ef94166]
이 커밋은 다음에 포함됨:
Rahul Garg
2020-08-10 18:25:31 +00:00
부모 4a3b0190c5
커밋 420ec4eeae
+2 -2
파일 보기
@@ -59,7 +59,7 @@ static_assert(static_cast<uint32_t>(hipMemRangeAttributeLastPrefetchLocation) ==
hipError_t hipMallocManaged(void** dev_ptr, size_t size, unsigned int flags) {
HIP_INIT_API(hipMallocManaged, dev_ptr, size, flags);
if ((dev_ptr == nullptr) || (flags != hipMemAttachGlobal)) {
if ((dev_ptr == nullptr) || (size == 0) || (flags != hipMemAttachGlobal)) {
HIP_RETURN(hipErrorInvalidValue);
}
@@ -213,4 +213,4 @@ static hipError_t ihipMallocManaged(void** ptr, size_t size) {
ClPrint(amd::LOG_INFO, amd::LOG_API, "%-5d: [%zx] ihipMallocManaged ptr=0x%zx", getpid(),
std::this_thread::get_id(), *ptr);
return hipSuccess;
}
}