[PyTorch] Improve conversion from/to FP16 on aarch64+sve#166306
Closed
Nicoshev wants to merge 1 commit intopytorch:mainfrom
Closed
[PyTorch] Improve conversion from/to FP16 on aarch64+sve#166306Nicoshev wants to merge 1 commit intopytorch:mainfrom
Nicoshev wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/166306
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 8cf40e6 with merge base e214af6 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
Author
|
@pytorchbot label "topic: not user facing" "release notes: cpu (aarch64)" |
) Summary: Conversion from/to float16 was not getting covered by conversion templates, because these used float16_t as data type instead of the custom at::Half. We are adding a shim that makes conversion routines use autovec code for float16 We observed the following performance improvements when compiling targeting armv9-a+sve2+fp16 before: float16_t->uint8->float16_t ===> 657.489us float16_t->int8->float16_t ===> 656.518us float16_t->int16->float16_t ===> 668.998us float16_t->int64->float16_t ===> 618.444us float16_t->double->float16_t ===> 439.728us after float16_t->uint8->float16_t ===> 181.216us ----> 263% higher throughput float16_t->int8->float16_t ===> 179.821us -----> 265% higher throughput float16_t->int16->float16_t ===> 183.417us ----> 265% higher throughput float16_t->int64->float16_t ===> 459.897us ----> 35% higher throughput float16_t->double->float16_t ===> 351.276us ---> 25% higher throughput Test Plan: Correctness: buck2 test mode/opt //caffe2/test:test_ops buck2 test mode/opt //caffe2/test:torch Performance: buck2 run mode/opt //caffe2/benchmarks/operator_benchmark/fb:operator_benchmark_test Differential Revision: D85533271
3b82c83 to
8cf40e6
Compare
mcfi
approved these changes
Oct 27, 2025
ezyang
approved these changes
Oct 27, 2025
Contributor
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Collaborator
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
tianrengao
pushed a commit
that referenced
this pull request
Oct 30, 2025
Summary: Conversion from/to float16 was not getting covered by conversion templates, because these used float16_t as data type instead of the custom at::Half. We are adding a shim that makes conversion routines use autovec code for float16 We observed the following performance improvements when compiling targeting armv9-a+sve2+fp16 before: float16_t->uint8->float16_t ===> 657.489us float16_t->int8->float16_t ===> 656.518us float16_t->int16->float16_t ===> 668.998us float16_t->int64->float16_t ===> 618.444us float16_t->double->float16_t ===> 439.728us after float16_t->uint8->float16_t ===> 181.216us ----> 263% higher throughput float16_t->int8->float16_t ===> 179.821us -----> 265% higher throughput float16_t->int16->float16_t ===> 183.417us ----> 265% higher throughput float16_t->int64->float16_t ===> 459.897us ----> 35% higher throughput float16_t->double->float16_t ===> 351.276us ---> 25% higher throughput Test Plan: Correctness: buck2 test mode/opt //caffe2/test:test_ops buck2 test mode/opt //caffe2/test:torch Performance: buck2 run mode/opt //caffe2/benchmarks/operator_benchmark/fb:operator_benchmark_test Differential Revision: D85533271 Pull Request resolved: #166306 Approved by: https://github.com/mcfi, https://github.com/ezyang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Conversion from/to float16 was not getting covered by conversion templates, because these used float16_t as data type instead of the custom at::Half.
We are adding a shim that makes conversion routines use autovec code for float16
We observed the following performance improvements when compiling targeting armv9-a+sve2+fp16
before:
float16_t->uint8->float16_t ===> 657.489us
float16_t->int8->float16_t ===> 656.518us
float16_t->int16->float16_t ===> 668.998us
float16_t->int64->float16_t ===> 618.444us
float16_t->double->float16_t ===> 439.728us
after
float16_t->uint8->float16_t ===> 181.216us ----> 263% higher throughput
float16_t->int8->float16_t ===> 179.821us -----> 265% higher throughput
float16_t->int16->float16_t ===> 183.417us ----> 265% higher throughput
float16_t->int64->float16_t ===> 459.897us ----> 35% higher throughput
float16_t->double->float16_t ===> 351.276us ---> 25% higher throughput
Test Plan:
Correctness:
buck2 test mode/opt //caffe2/test:test_ops
buck2 test mode/opt //caffe2/test:torch
Performance:
buck2 run mode/opt //caffe2/benchmarks/operator_benchmark/fb:operator_benchmark_test
Differential Revision: D85533271
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168 @aditew01 @snadampal @milpuz01 @nikhil-arm @fadara01