Skip to content

[ET][Portable][Build Size] Introduce notion of compute type. Refactor add/clamp/where #6007

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

Closed

Conversation

manuelcandales
Copy link
Contributor

@manuelcandales manuelcandales commented Oct 8, 2024

Stack from ghstack (oldest at bottom):

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

Differential Revision: D63860791

… add/clamp/where

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

Differential Revision: [D63860791](https://our.internmc.facebook.com/intern/diff/D63860791/)

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Oct 8, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6007

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 326136c with merge base cb12061 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 8, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63860791

…e. Refactor add/clamp/where"

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

Differential Revision: [D63860791](https://our.internmc.facebook.com/intern/diff/D63860791/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63860791

…e. Refactor add/clamp/where"

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

Differential Revision: [D63860791](https://our.internmc.facebook.com/intern/diff/D63860791/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63860791

…e. Refactor add/clamp/where"

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

Differential Revision: [D63860791](https://our.internmc.facebook.com/intern/diff/D63860791/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63860791

…e. Refactor add/clamp/where"

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

Differential Revision: [D63860791](https://our.internmc.facebook.com/intern/diff/D63860791/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63860791

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 607d4a3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants