c10:intrusive_ptr, self assignment (#119275)
Summary:
In C++ books/sources, self assignment check is often considered a bad practice, since it is very very unlikely.
See, for example libc++ doesn't have it:
https://github.com/llvm/llvm-project/blob/cf94e0082e5e0a9be43a69d9fae588bc2aafab91/libcxx/include/__memory/shared_ptr.h#L651
How about we remove it?
Test Plan:
This check is like 1% of cycles assinged to intrusive_ptr::operator=
https://fburl.com/scuba/strobelight_services/9qqnrkdn
This is not a lot in purely cycles but since it's gpu machines, can be substantial
Differential Revision: D53471639
Pull Request resolved: https://github.com/pytorch/pytorch/pull/119275
Approved by: https://github.com/cyyever, https://github.com/ezyang