-
Notifications
You must be signed in to change notification settings - Fork 743
Coerce to true_ctype in tensor_factory #7856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Stack from ghstack (oldest at bottom): |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/7856
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| dynamism) {} | ||
| dynamism) { | ||
| // The only valid values for bool are 0 and 1; coerce! | ||
| if constexpr (std::is_same_v<true_ctype, bool>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems in ifdef aten section this transformation is unconditional while here it is applied only if it is bool. I dont fully understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't build with bits16 and we don't have bit_cast, otherwise I would make it unconditional here and use bit_cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing bit_cast not being usable is related to it available only in c++20.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes; we will have access to c10::bit_cast once I get back to code sharing but currently we don't have it.
Partial fix for #7748.
* Coerce to true_ctype in tensor_factory (#7856) This should fix the problem where attempts to test bool are often wonky in OSS and fail UBSAN internally; it is undefined behavior to store a value other than 0 or 1 for type bool. * Support Half/BFloat16 in prod operator (#7857) Partial fix for #7748.
* Coerce to true_ctype in tensor_factory (pytorch#7856) This should fix the problem where attempts to test bool are often wonky in OSS and fail UBSAN internally; it is undefined behavior to store a value other than 0 or 1 for type bool. * Support Half/BFloat16 in prod operator (pytorch#7857) Partial fix for pytorch#7748.
This should fix the problem where attempts to test
boolare often wonky in OSS and fail UBSAN internally; it is undefined behavior to store a value other than 0 or 1 for typebool.