Skip to content

Commit

Permalink
Fix crash on unload torch cpu dll (#67632)
Browse files Browse the repository at this point in the history
Trying to rebase pytorch/pytorch#61290 into latest pytorch:master
Pull Request resolved: pytorch/pytorch#67632
Approved by: https://github.com/ezyang
  • Loading branch information
David Braun authored and pytorchmergebot committed Jul 31, 2022
1 parent 82c37d3 commit a036f0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion register_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace cuda {
namespace {
class RegisterInterface {
public:
RegisterInterface() {
RegisterInterface() : canFuseNodeIndex_(RegisterProfilingNode(canFuseNode)) {
auto ptr = getFuserInterface();
ptr->fn_compile_n = &compileCudaFusionGroup;
ptr->fn_run_n_s = &runCudaFusionGroup;
Expand All @@ -27,6 +27,13 @@ class RegisterInterface {
ptr->fn_profile_n = &shouldProfileNode;
ptr->fn_skip_n = &skipNodeKind;
}

~RegisterInterface() {
DeregisterProfilingNode(canFuseNodeIndex_);
}

private:
int canFuseNodeIndex_;
};

static RegisterInterface register_interface_;
Expand Down

0 comments on commit a036f0e

Please sign in to comment.