Introduce notion of compute type. Refactor add/clamp/where (#6007)
Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/6007 Introduced notion of compute type. We now perform the computation over `CTYPE_COMP` (the compute type) rather than `CTYPE_COMMON` (the common type) All of the occurrences of `CTYPE_COMMON` in elementwise_util.h need to be replaced with `CTYPE_COMP`, to properly reflect that we are dealing with the computation type, and not the common type. But we don't do that in this diff, to facilitate review. The previous `SupportedTensorDtypes::SAME_AS_COMMON` is transformed into `SupportedTensorDtypes::SAME_AS_COMP` and a newer `SupportedTensorDtypes::SAME_AS_COMMON` is written. `SupportedTensorDtypes::SAME_AS_COMMON` should perform the reverse mapping than get_compute_type(). In this case, this means that when `CTYPE_COMP` is anything but float, `SAME_AS_COMMON` is effectively the same as `SAME_AS_COMP`. But when `CTYPE_COMP` is float, `SAME_AS_COMMON` switches over `Float`, `Half` and `BFloat16` Build size reduction: - add: 21K -> 18K - clamp: 28K -> 23K - where: 16K -> 12K ghstack-source-id: 246981810 exported-using-ghexport Reviewed By: swolchok Differential Revision: D63860791 fbshipit-source-id: 30763a1f456a701eeb15d2a7b37ae28825579625
M
Manuel Candales committed
607d4a3ee58df48b703047d68053b6662d498f84
Parent: 4153371
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 10/10/2024, 12:25:24 AM