forked from mindspore-Ecosystem/mindspore
!46622 fix LockRuntime stream nullptr
Merge pull request !46622 from baihuawei/fix_stream_null2.0
This commit is contained in:
commit
4e04eec424
|
|
@ -1102,19 +1102,21 @@ bool AscendKernelRuntime::RunTask(const session::KernelGraph &graph) {
|
|||
|
||||
bool AscendKernelRuntime::SyncStream() {
|
||||
SetCurrentContext();
|
||||
{
|
||||
if (stream_ != nullptr) {
|
||||
// cppcheck-suppress unreadVariable
|
||||
auto lock = device::KernelRuntime::LockRuntime(stream_);
|
||||
if (stream_ != nullptr && !AscendStreamMng::GetInstance().SyncStream(stream_)) {
|
||||
if (!AscendStreamMng::GetInstance().SyncStream(stream_)) {
|
||||
MS_LOG(ERROR) << "Sync default stream failed.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// cppcheck-suppress unreadVariable
|
||||
auto lock = device::KernelRuntime::LockRuntime(communication_stream_);
|
||||
if (communication_stream_ != nullptr && !AscendStreamMng::GetInstance().SyncStream(communication_stream_)) {
|
||||
MS_LOG(ERROR) << "Sync default stream failed.";
|
||||
return false;
|
||||
if (communication_stream_ != nullptr) {
|
||||
// cppcheck-suppress unreadVariable
|
||||
auto lock = device::KernelRuntime::LockRuntime(communication_stream_);
|
||||
if (!AscendStreamMng::GetInstance().SyncStream(communication_stream_)) {
|
||||
MS_LOG(ERROR) << "Sync default stream failed.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue