Merge pull request #462 from ROCm-Developer-Tools/mangupta-hipMemcpy-fix

hipMemcpy returns success if sizeBytes is 0.

[ROCm/hip commit: 22af1f6875]
Ta zmiana jest zawarta w:
Maneesh Gupta authored and GitHub committed 2018-05-22 06:34:22 +05:30
złożenie 797170d3c0
Plik 1 zmieniony
+6 -2
+6 -2
Wyświetl plik
@@ -1132,15 +1132,19 @@ hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t co
hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind) { hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind) {
HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, src, sizeBytes, kind); HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, src, sizeBytes, kind);
hipError_t e = hipSuccess;
// Return success if number of bytes to copy is 0
if (sizeBytes == 0) return ihipLogStatus(e);
hipStream_t stream = ihipSyncAndResolveStream(hipStreamNull); hipStream_t stream = ihipSyncAndResolveStream(hipStreamNull);
hc::completion_future marker; hc::completion_future marker;
hipError_t e = hipSuccess;
if(dst==NULL || src==NULL) if(dst==NULL || src==NULL)
{ {
e=hipErrorInvalidValue; e=hipErrorInvalidValue;
return e; return ihipLogStatus(e);
} }
try { try {
stream->locked_copySync(dst, src, sizeBytes, kind); stream->locked_copySync(dst, src, sizeBytes, kind);