fix: overflow should enable in stream init

This commit is contained in:
yangxiaorun
2023-04-06 18:09:20 +08:00
parent b1396c4d8b
commit e783f0a99c
@@ -1,6 +1,7 @@
#include "AclInterface.h"
#include "third_party/acl/inc/acl/acl_rt.h"
#include "torch_npu/csrc/core/npu/register/FunctionLoader.h"
#include "torch_npu/csrc/core/npu/NpuVariables.h"
#include "c10/util/Exception.h"
namespace c10_npu {
@@ -108,6 +109,9 @@ aclError AclrtCreateStreamWithConfig(aclrtStream *stream, uint32_t priority, uin
ret = aclrtCreateStream(stream);
}
if (ret == ACL_SUCCESS && stream != nullptr) {
if (c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910B1) {
TORCH_CHECK(AclrtSetStreamOverflowSwitch(*stream, 1) == ACL_SUCCESS, "SET StreamOverflowSwitch Failed.");
}
return AclrtSetStreamFailureMode(*stream, ACL_STOP_ON_FAILURE);
} else {
return ret;