Skip to content

Commit f984eba

Browse files
authored
fix(dipu,droplet): clear error after malloc failed (no mem) (#903)
allocator 随后会尝试释放一些 block 再 malloc,如果不清理错误,之后的调用全都会错误
1 parent 1c2e9ea commit f984eba

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

dipu/torch_dipu/csrc_dipu/vendor/droplet/deviceimpl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ OpStatus mallocDevice(void** p, size_t nbytes, bool throwExcepion) {
163163
::tangGetLastError(); /* reset internal error state*/
164164
throw std::runtime_error("alloc failed in dipu");
165165
} else if (r == ::tangErrorMemoryAllocation) {
166+
::tangGetLastError();
166167
return OpStatus::ERR_NOMEM;
167168
} else {
168169
return OpStatus::ERR_UNKNOWN;

0 commit comments

Comments
 (0)