-
Notifications
You must be signed in to change notification settings - Fork 712
[ET][Portable][Build Size] Move to elementwise_utils as apply_tritensor_elementwise_fn #6005
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
[ET][Portable][Build Size] Move to elementwise_utils as apply_tritensor_elementwise_fn #6005
Conversation
…or_elementwise_fn @swolchok's technique is superior to the TensorReader/TensorWriter approach I introduced in D63703174. So, I am rewriting my build size reduction stack on top of his approach. Superior how? - It should lead to smaller overall build size. Current measurements indicate this. Complete data will be published after the stack is complete. - It is better suited for dtype selective build, since it passes the op name to all of the ET_SWITCHes involved. - It is more performant. Current measurements to clamp.Tensor_out indicate this. Note that in the data below, my stack is marginally more performant for the vanilla case (no broadcast & all dtypes equal), but this is only because I added a "fast path" in my code for such vanilla case, which can be trivially added to Scott's approach as well. It is more relevant to compare numbers for mixed dtype or broadcasting. ``` Baseline clamp.Tensor_out no broadcast float: 25451 [23423 - 28839] microseconds clamp.Tensor_out no broadcast double: 25461 [23377 - 50940] microseconds clamp.Tensor_out no broadcast mixed dtype: 23367 [21353 - 27022] microseconds clamp.Tensor_out broadcast: 702529 [679667 - 742005] microseconds Manuel C clamp.Tensor_out no broadcast float: 22919 [21333 - 27140] microseconds clamp.Tensor_out no broadcast double: 23095 [21472 - 27462] microseconds clamp.Tensor_out no broadcast mixed dtype: 35042 [32875 - 42491] microseconds clamp.Tensor_out broadcast: 936541 [916437 - 971499] microseconds Scott W clamp.Tensor_out no broadcast float: 28263 [26458 - 32832] microseconds clamp.Tensor_out no broadcast double: 27442 [25548 - 39417] microseconds clamp.Tensor_out no broadcast mixed dtype: 25592 [23620 - 30148] microseconds clamp.Tensor_out broadcast: 695399 [674244 - 738919] microseconds ``` Build size reduction after Scott's diffs touching clamp.Tensor_out and where.self_out: - clamp: 7.42 MB -> 119 KB - where: 106 KB -> 16 KB Differential Revision: [D63838072](https://our.internmc.facebook.com/intern/diff/D63838072/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6005
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 2b59ac2 with merge base cb12061 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D63838072 |
…ply_tritensor_elementwise_fn" swolchok's technique is superior to the TensorReader/TensorWriter approach I introduced in D63703174. So, I am rewriting my build size reduction stack on top of his approach. Superior how? - It should lead to smaller overall build size. Current measurements indicate this. Complete data will be published after the stack is complete. - It is better suited for dtype selective build, since it passes the op name to all of the ET_SWITCHes involved. - It is more performant. Current measurements to clamp.Tensor_out indicate this. Note that in the data below, my stack is marginally more performant for the vanilla case (no broadcast & all dtypes equal), but this is only because I added a "fast path" in my code for such vanilla case, which can be trivially added to Scott's approach as well. It is more relevant to compare numbers for mixed dtype or broadcasting. ``` Baseline clamp.Tensor_out no broadcast float: 25451 [23423 - 28839] microseconds clamp.Tensor_out no broadcast double: 25461 [23377 - 50940] microseconds clamp.Tensor_out no broadcast mixed dtype: 23367 [21353 - 27022] microseconds clamp.Tensor_out broadcast: 702529 [679667 - 742005] microseconds Manuel C clamp.Tensor_out no broadcast float: 22919 [21333 - 27140] microseconds clamp.Tensor_out no broadcast double: 23095 [21472 - 27462] microseconds clamp.Tensor_out no broadcast mixed dtype: 35042 [32875 - 42491] microseconds clamp.Tensor_out broadcast: 936541 [916437 - 971499] microseconds Scott W clamp.Tensor_out no broadcast float: 28263 [26458 - 32832] microseconds clamp.Tensor_out no broadcast double: 27442 [25548 - 39417] microseconds clamp.Tensor_out no broadcast mixed dtype: 25592 [23620 - 30148] microseconds clamp.Tensor_out broadcast: 695399 [674244 - 738919] microseconds ``` Build size reduction after Scott's diffs touching clamp.Tensor_out and where.self_out: - clamp: 7.42 MB -> 119 KB - where: 106 KB -> 16 KB Differential Revision: [D63838072](https://our.internmc.facebook.com/intern/diff/D63838072/) [ghstack-poisoned]
|
This pull request was exported from Phabricator. Differential Revision: D63838072 |
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.
Sure, though being more verbose is imo a good code trait...
…ply_tritensor_elementwise_fn" swolchok's technique is superior to the TensorReader/TensorWriter approach I introduced in D63703174. So, I am rewriting my build size reduction stack on top of his approach. Superior how? - It should lead to smaller overall build size. Current measurements indicate this. Complete data will be published after the stack is complete. - It is better suited for dtype selective build, since it passes the op name to all of the ET_SWITCHes involved. - It is more performant. Current measurements to clamp.Tensor_out indicate this. Note that in the data below, my stack is marginally more performant for the vanilla case (no broadcast & all dtypes equal), but this is only because I added a "fast path" in my code for such vanilla case, which can be trivially added to Scott's approach as well. It is more relevant to compare numbers for mixed dtype or broadcasting. ``` Baseline clamp.Tensor_out no broadcast float: 25451 [23423 - 28839] microseconds clamp.Tensor_out no broadcast double: 25461 [23377 - 50940] microseconds clamp.Tensor_out no broadcast mixed dtype: 23367 [21353 - 27022] microseconds clamp.Tensor_out broadcast: 702529 [679667 - 742005] microseconds Manuel C clamp.Tensor_out no broadcast float: 22919 [21333 - 27140] microseconds clamp.Tensor_out no broadcast double: 23095 [21472 - 27462] microseconds clamp.Tensor_out no broadcast mixed dtype: 35042 [32875 - 42491] microseconds clamp.Tensor_out broadcast: 936541 [916437 - 971499] microseconds Scott W clamp.Tensor_out no broadcast float: 28263 [26458 - 32832] microseconds clamp.Tensor_out no broadcast double: 27442 [25548 - 39417] microseconds clamp.Tensor_out no broadcast mixed dtype: 25592 [23620 - 30148] microseconds clamp.Tensor_out broadcast: 695399 [674244 - 738919] microseconds ``` Build size reduction after Scott's diffs touching clamp.Tensor_out and where.self_out: - clamp: 7.42 MB -> 119 KB - where: 106 KB -> 16 KB Differential Revision: [D63838072](https://our.internmc.facebook.com/intern/diff/D63838072/) [ghstack-poisoned]
|
This pull request was exported from Phabricator. Differential Revision: D63838072 |
…ply_tritensor_elementwise_fn" swolchok's technique is superior to the TensorReader/TensorWriter approach I introduced in D63703174. So, I am rewriting my build size reduction stack on top of his approach. Superior how? - It should lead to smaller overall build size. Current measurements indicate this. Complete data will be published after the stack is complete. - It is better suited for dtype selective build, since it passes the op name to all of the ET_SWITCHes involved. - It is more performant. Current measurements to clamp.Tensor_out indicate this. Note that in the data below, my stack is marginally more performant for the vanilla case (no broadcast & all dtypes equal), but this is only because I added a "fast path" in my code for such vanilla case, which can be trivially added to Scott's approach as well. It is more relevant to compare numbers for mixed dtype or broadcasting. ``` Baseline clamp.Tensor_out no broadcast float: 25451 [23423 - 28839] microseconds clamp.Tensor_out no broadcast double: 25461 [23377 - 50940] microseconds clamp.Tensor_out no broadcast mixed dtype: 23367 [21353 - 27022] microseconds clamp.Tensor_out broadcast: 702529 [679667 - 742005] microseconds Manuel C clamp.Tensor_out no broadcast float: 22919 [21333 - 27140] microseconds clamp.Tensor_out no broadcast double: 23095 [21472 - 27462] microseconds clamp.Tensor_out no broadcast mixed dtype: 35042 [32875 - 42491] microseconds clamp.Tensor_out broadcast: 936541 [916437 - 971499] microseconds Scott W clamp.Tensor_out no broadcast float: 28263 [26458 - 32832] microseconds clamp.Tensor_out no broadcast double: 27442 [25548 - 39417] microseconds clamp.Tensor_out no broadcast mixed dtype: 25592 [23620 - 30148] microseconds clamp.Tensor_out broadcast: 695399 [674244 - 738919] microseconds ``` Build size reduction after Scott's diffs touching clamp.Tensor_out and where.self_out: - clamp: 7.42 MB -> 119 KB - where: 106 KB -> 16 KB Differential Revision: [D63838072](https://our.internmc.facebook.com/intern/diff/D63838072/) [ghstack-poisoned]
|
This pull request was exported from Phabricator. Differential Revision: D63838072 |
…ply_tritensor_elementwise_fn" swolchok's technique is superior to the TensorReader/TensorWriter approach I introduced in D63703174. So, I am rewriting my build size reduction stack on top of his approach. Superior how? - It should lead to smaller overall build size. Current measurements indicate this. Complete data will be published after the stack is complete. - It is better suited for dtype selective build, since it passes the op name to all of the ET_SWITCHes involved. - It is more performant. Current measurements to clamp.Tensor_out indicate this. Note that in the data below, my stack is marginally more performant for the vanilla case (no broadcast & all dtypes equal), but this is only because I added a "fast path" in my code for such vanilla case, which can be trivially added to Scott's approach as well. It is more relevant to compare numbers for mixed dtype or broadcasting. ``` Baseline clamp.Tensor_out no broadcast float: 25451 [23423 - 28839] microseconds clamp.Tensor_out no broadcast double: 25461 [23377 - 50940] microseconds clamp.Tensor_out no broadcast mixed dtype: 23367 [21353 - 27022] microseconds clamp.Tensor_out broadcast: 702529 [679667 - 742005] microseconds Manuel C clamp.Tensor_out no broadcast float: 22919 [21333 - 27140] microseconds clamp.Tensor_out no broadcast double: 23095 [21472 - 27462] microseconds clamp.Tensor_out no broadcast mixed dtype: 35042 [32875 - 42491] microseconds clamp.Tensor_out broadcast: 936541 [916437 - 971499] microseconds Scott W clamp.Tensor_out no broadcast float: 28263 [26458 - 32832] microseconds clamp.Tensor_out no broadcast double: 27442 [25548 - 39417] microseconds clamp.Tensor_out no broadcast mixed dtype: 25592 [23620 - 30148] microseconds clamp.Tensor_out broadcast: 695399 [674244 - 738919] microseconds ``` Build size reduction after Scott's diffs touching clamp.Tensor_out and where.self_out: - clamp: 7.42 MB -> 119 KB - where: 106 KB -> 16 KB Differential Revision: [D63838072](https://our.internmc.facebook.com/intern/diff/D63838072/) [ghstack-poisoned]
|
This pull request was exported from Phabricator. Differential Revision: D63838072 |
|
This pull request has been merged in a79caab. |
Stack from ghstack (oldest at bottom):
@swolchok's technique is superior to the TensorReader/TensorWriter approach I introduced in D63703174. So, I am rewriting my build size reduction stack on top of his approach.
Superior how?
Build size reduction after Scott's diffs touching clamp.Tensor_out and where.self_out:
Differential Revision: D63838072