P4 to Git Change 1764069 by michliao@hliao-dev-00-hip-workspace on 2019/04/01 11:23:34

SWDEV-144570 - Handle zero-byte memset & memcpy

	- Properly handle zero-byte memset & memcpy by skipping the real stuff.

	RB: http://ocltc.amd.com/reviews/r/17062/

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#48 edit


[ROCm/hip commit: b392004e71]
This commit is contained in:
foreman
2019-04-01 11:51:06 -04:00
orang tua bf0d9947f5
melakukan 2c8d0de12d
+9
Melihat File
@@ -76,6 +76,11 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags)
hipError_t ihipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind,
amd::HostQueue& queue, bool isAsync = false) {
if (sizeBytes == 0) {
// Skip if nothing needs writing.
return hipSuccess;
}
amd::Command* command = nullptr;
amd::Command::EventWaitList waitList;
@@ -114,6 +119,10 @@ hipError_t ihipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKin
hipError_t ihipMemset(void* dst, int value, size_t valueSize, size_t sizeBytes,
hipStream_t stream, bool isAsync = false) {
if (sizeBytes == 0) {
// Skip if nothing needs filling.
return hipSuccess;
}
if (dst == nullptr) {
return hipErrorInvalidValue;