mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Wrap warning handler in a function to avoid siof (#30800)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30800 SparseNN benchmark crashed due to this. Wrap warning handler in a function to avoid siof. Test Plan: Tested locally, SparseNN benchmark no longer crashes. Reviewed By: yinghai Differential Revision: D18826731 fbshipit-source-id: 8fcab8a3f38cc20f775409c0686363af3c27d0a6
This commit is contained in:
parent
bf1b4b6fef
commit
9617d07bd5
|
|
@ -66,8 +66,12 @@ void Error::AppendMessage(const std::string& new_msg) {
|
|||
namespace Warning {
|
||||
|
||||
namespace {
|
||||
static WarningHandler base_warning_handler_ = WarningHandler();
|
||||
static thread_local WarningHandler* warning_handler_ = &base_warning_handler_;
|
||||
WarningHandler* getHandler() {
|
||||
static WarningHandler base_warning_handler_ = WarningHandler();
|
||||
return &base_warning_handler_;
|
||||
};
|
||||
static thread_local WarningHandler* warning_handler_ = getHandler();
|
||||
|
||||
}
|
||||
|
||||
void warn(SourceLocation source_location, const std::string& msg) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user