SWDEV-326791 - Fixes hipHostRegister's inconsistent behavior when invalid parameter is passed
Change-Id: I5d5d979485cfd99908f84cc92648177cb8a569c7
This commit is contained in:
committed by
Sourabh Betigeri
orang tua
42137222ad
melakukan
0a76232c97
@@ -977,7 +977,9 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) {
|
||||
hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) {
|
||||
HIP_INIT_API(hipHostRegister, hostPtr, sizeBytes, flags);
|
||||
CHECK_STREAM_CAPTURE_SUPPORTED();
|
||||
if(hostPtr != nullptr) {
|
||||
if (hostPtr == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
} else {
|
||||
amd::Memory* mem = new (*hip::host_device->asContext()) amd::Buffer(*hip::host_device->asContext(),
|
||||
CL_MEM_USE_HOST_PTR | CL_MEM_SVM_ATOMICS, sizeBytes);
|
||||
|
||||
@@ -1005,8 +1007,6 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags)
|
||||
mem->getUserData().deviceId = hip::getCurrentDevice()->deviceId();
|
||||
}
|
||||
HIP_RETURN(hipSuccess);
|
||||
} else {
|
||||
HIP_RETURN_DURATION(ihipMalloc(&hostPtr, sizeBytes, flags), hostPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user