-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Hexagon] Improve QFP Optimizer #166647
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
[Hexagon] Improve QFP Optimizer #166647
Conversation
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
42caf09 to
57a3460
Compare
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.
LGTM
|
I would prefer if you undo some of the removed empty lines |
57a3460 to
3af2e7a
Compare
Done |
|
@llvm/pr-subscribers-backend-hexagon Author: Fateme Hosseini (fhossein-quic) ChangesThis patch enhances HexagonQFPOptimizer in multiple ways:
|
3af2e7a to
49b23e4
Compare
This patch enhances HexagonQFPOptimizer in multiple ways:
1. Refactor the code for better readability and maintainability.
2. Optimize vabs,vneg and vilog2 converts
The three instruction mentioned can be optimized like below:
```v1.sf = v0.qf32
v2.qf = vneg v1.sf```
to
```v2.qf = vneg v0.qf32```
This optimization eliminates one conversion and is applicable
to both qf32 and qf16 types.
3. Enable vsub fusion with mixed arguments
Previously, QFPOptimizer did not fuse partial qfloat operands with vsub.
This update allows selective use of vsub_hf_mix, vsub_sf_mix, vsub_qf16_mix,
and vsub_qf32_mix when appropriate. It also enables QFP simplifications
involving vector pair subregisters.
Example scenario in a machine basic block targeting Hexagon:
```v1.qf32 = ... // result of a vadd
v2.sf = v1.qf32
v3.qf32 = vmpy(v2.sf, v2.sf)```
4. Remove redundant conversions
Under certain conditions, we previously bailed out before removing qf-to-sf/hf conversions.
This patch removes that bailout, enabling more aggressive elimination of unnecessary conversions.
5. Don't optimize equals feeding into multiply:
Removing converts feeding into multiply loses precision.
This patch avoids optimizing multiplies along with giving the
users an option to enable this by a flag.
Patch By: Fateme Hosseini
Co-authored-by: Kaushik Kulkarni <quic_kauskulk@quicinc.com>
Co-authored-by: Santanu Das <santdas@qti.qualcomm.com>
49b23e4 to
85d58a8
Compare
This patch enhances HexagonQFPOptimizer in multiple ways:
Refactor the code for better readability and maintainability.
Optimize vabs,vneg and vilog2 converts
The three instruction mentioned can be optimized like below: