mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Disable has_relational_guards check for dict_tag optimization for now (#146232)
has_relational_guards evaluates to true almost always, and leads to a slowdown in guards runtime Pull Request resolved: https://github.com/pytorch/pytorch/pull/146232 Approved by: https://github.com/anijain2305
This commit is contained in:
parent
e3643e1e0e
commit
08b14936ae
1 changed files with 1 additions and 10 deletions
|
|
@ -2277,8 +2277,6 @@ class GuardManager {
|
|||
return _root;
|
||||
}
|
||||
|
||||
bool has_relational_guards();
|
||||
|
||||
std::string get_source() {
|
||||
return _source;
|
||||
}
|
||||
|
|
@ -2411,7 +2409,7 @@ class GuardManager {
|
|||
// to avoid early exits when dict_tag matches and the object is
|
||||
// immutable.
|
||||
new_tag = get_dict_version_unchecked(value);
|
||||
matches_dict_tag = (new_tag == _dict_tag) && !has_relational_guards();
|
||||
matches_dict_tag = (new_tag == _dict_tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2634,10 +2632,6 @@ class RootGuardManager : public GuardManager {
|
|||
_relational_guard_resetters.emplace_back(std::move(relational_guard));
|
||||
}
|
||||
|
||||
bool has_relational_guards() {
|
||||
return !_relational_guard_resetters.empty();
|
||||
}
|
||||
|
||||
// Python visible API to check guard function.
|
||||
bool check(py::handle value) {
|
||||
return check_nopybind(value.ptr());
|
||||
|
|
@ -2854,9 +2848,6 @@ class RootGuardManager : public GuardManager {
|
|||
bool _init_local_state = false;
|
||||
};
|
||||
|
||||
bool GuardManager::has_relational_guards() {
|
||||
return _root->has_relational_guards();
|
||||
}
|
||||
/*
|
||||
* Dicts are common in python code. Therefore, we handle guards for dicts
|
||||
* differently and use PyDict_* APIs which are faster than PyObject_* APIs
|
||||
|
|
|
|||
Loading…
Reference in a new issue