diff --git a/hipamd/rocclr/hip_memory.cpp b/hipamd/rocclr/hip_memory.cpp index 75f9fe3426..87064b8ee1 100755 --- a/hipamd/rocclr/hip_memory.cpp +++ b/hipamd/rocclr/hip_memory.cpp @@ -1855,6 +1855,10 @@ hipError_t ihipMemset3D(hipPitchedPtr pitchedDevPtr, auto sizeBytes = extent.width * extent.height * extent.depth; + if (sizeBytes == 0) { + // sizeBytes is zero hence returning early as nothing to be set + return hipSuccess; + } if (memory == nullptr) { return hipErrorInvalidValue; }