Skip to content

Commit

Permalink
fix(dipu,droplet): clear error after malloc failed (no mem) (#903)
Browse files Browse the repository at this point in the history
allocator 随后会尝试释放一些 block 再
malloc,如果不清理错误,之后的调用全都会错误
  • Loading branch information
lljbash authored Jul 18, 2024
1 parent 1c2e9ea commit f984eba
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dipu/torch_dipu/csrc_dipu/vendor/droplet/deviceimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ OpStatus mallocDevice(void** p, size_t nbytes, bool throwExcepion) {
::tangGetLastError(); /* reset internal error state*/
throw std::runtime_error("alloc failed in dipu");
} else if (r == ::tangErrorMemoryAllocation) {
::tangGetLastError();
return OpStatus::ERR_NOMEM;
} else {
return OpStatus::ERR_UNKNOWN;
Expand Down

0 comments on commit f984eba

Please sign in to comment.