benchmark
5786e143 - tp_richcompare followups (#184606)

Commit
46 days ago
tp_richcompare followups (#184606) Summary: ## Correctness fixes - `TorchScriptObjectVariable.richcompare_impl`: use value-based comparison instead of identity for pybind11 opaque objects (root cause of the DTensor compiled autograd revert). - Tuple/list ordering with symbolic shapes: specialize via `guard_if_dyn` instead of graph-breaking. - Route comparison ops through `generic_richcompare` in `_handle_insert_op_in_graph` when any operand is not a tensor/symnode, fixing `tensor == UserDefinedObject()`. - Add `DequeVariable.richcompare_impl`. - Resolve `_base_vt` items in `_seq_richcompare` for `UserDefinedListVariable`. ## Refactors (reviewer feedback) - Split `BaseListVariable.richcompare_impl` into `ListVariable`/`TupleVariable` wrappers calling shared `_seq_richcompare`. - Tensor richcompare whitelist: return `NotImplemented` for non-tensor/symnode/constant types (was blacklist). - Add `generic_richcompare_bool` with NaN identity shortcut, matching CPython's `PyObject_RichCompareBool`. - Misc: rename `lhs`/`rhs` to `v`/`w`, fix CPython permalinks, consistent type annotations, replace `_SENTINEL` with `NO_SUCH_SUBOBJ`. ## Tests Opaque object comparison, tensor vs UDOV, deque, list subclass, `immutable_list`, symbolic shape ordering, NaN identity in containers, subclass priority, `DispatchKeySet`. X-link: https://github.com/pytorch/pytorch/pull/184606 Approved by: https://github.com/guilhermeleobas, https://github.com/zou3519 Reviewed By: atalman Differential Revision: D107537566 fbshipit-source-id: 0fd5a85c4f22b83eeed87c8947894fbe1c7b9652 Co-authored-by: Guilherme Leobas <gleobas@quansight.com>
Author
Committer
Parents
Loading