!35156 Return true when copy size is 0
Merge pull request !35156 from liangzelang/dev_master
This commit is contained in:
commit
3c07413969
|
@ -1075,6 +1075,10 @@ bool AscendKernelRuntime::SyncStream() {
|
|||
|
||||
bool AscendKernelRuntime::MemcpyAsync(void *dst, const void *src, uint64_t size, int32_t kind) {
|
||||
SetCurrentContext();
|
||||
if (size == 0) {
|
||||
MS_LOG(DEBUG) << "rtMemcpyAsync size is 0, copy kind:" << kind;
|
||||
return true;
|
||||
}
|
||||
if (stream_ == nullptr) {
|
||||
MS_LOG(ERROR) << "MemcpyAsync failed. stream_ is nullptr";
|
||||
return false;
|
||||
|
@ -1092,10 +1096,6 @@ bool AscendKernelRuntime::MemcpyAsync(void *dst, const void *src, uint64_t size,
|
|||
MS_LOG(ERROR) << "rtMemcpyAsync src ptr is null, copy kind:" << kind;
|
||||
return false;
|
||||
}
|
||||
if (size == 0) {
|
||||
MS_LOG(ERROR) << "rtMemcpyAsync size is 0, copy kind:" << kind;
|
||||
return false;
|
||||
}
|
||||
// cppcheck-suppress unreadVariable
|
||||
auto lock = device::KernelRuntime::LockRuntime(stream_);
|
||||
if (RT_ERROR_NONE != rtMemcpyAsync(dst, size, src, size, static_cast<rtMemcpyKind_t>(kind), stream_)) {
|
||||
|
|
Loading…
Reference in New Issue