mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[ez] Make SymNodeImpl comments less misleading (#154480)
As discussed in DS workchat, it's easy for users to get confused by guarding for these supposedly non-guarding methods. The TL;DR is in the case of non pythonic compilers like XLA, we actually do guard. I've updated the comments accordingly to reduce confusion. Pull Request resolved: https://github.com/pytorch/pytorch/pull/154480 Approved by: https://github.com/pianpwk, https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
a75e3a02be
commit
e9b97d19b1
@ -188,24 +188,21 @@ class C10_API SymNodeImpl : public c10::intrusive_ptr_target {
|
||||
return guard_bool(file, line);
|
||||
}
|
||||
virtual bool guard_or_false(const char* file, int64_t line) {
|
||||
// No improvement for unbacked SymBools by default, replace this
|
||||
// with a better implementation! NB: PT2 primarily uses PythonSymNodeImpl,
|
||||
// the only user of this fallback path to my knowledge is XLA, which
|
||||
// is AOT and necessarily can't take a dependency on Python.
|
||||
// Note: PT2 primarily uses PythonSymNodeImpl for this functionality.
|
||||
// XLA is currently the main consumer of this fallback path since it uses
|
||||
// ahead-of-time compilation and cannot depend on Python runtime.
|
||||
return guard_bool(file, line);
|
||||
}
|
||||
virtual bool statically_known_true(const char* file, int64_t line) {
|
||||
// No improvement for unbacked SymBools by default, replace this
|
||||
// with a better implementation! NB: PT2 primarily uses PythonSymNodeImpl,
|
||||
// the only user of this fallback path to my knowledge is XLA, which
|
||||
// is AOT and necessarily can't take a dependency on Python.
|
||||
// Note: PT2 primarily uses PythonSymNodeImpl for this functionality.
|
||||
// XLA is currently the main consumer of this fallback path since it uses
|
||||
// ahead-of-time compilation and cannot depend on Python runtime.
|
||||
return guard_bool(file, line);
|
||||
}
|
||||
virtual bool guard_or_true(const char* file, int64_t line) {
|
||||
// No improvement for unbacked SymBools by default, replace this
|
||||
// with a better implementation! NB: PT2 primarily uses PythonSymNodeImpl,
|
||||
// the only user of this fallback path to my knowledge is XLA, which
|
||||
// is AOT and necessarily can't take a dependency on Python.
|
||||
// Note: PT2 primarily uses PythonSymNodeImpl for this functionality.
|
||||
// XLA is currently the main consumer of this fallback path since it uses
|
||||
// ahead-of-time compilation and cannot depend on Python runtime.
|
||||
return guard_bool(file, line);
|
||||
}
|
||||
virtual bool expect_true(const char* file, int64_t line) {
|
||||
|
Reference in New Issue
Block a user