This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Improve costs for some conversions to fp16.
ClosedPublic

Authored by fhahn on Nov 11 2021, 10:53 AM.

Details

Summary

Currently the cost model under-estimates the cost of certain
FP16 conversions.

This patch updates getCastInstrCost to return more accurate costs for
the cases improved in c2ed9fd05479.

Note that this does not fix the incorrect costs without FULLFP16 so far.
I'm not sure if there's a good generic way to estimate those costs
better, without explicitly adding a large number of combinations to the
table. Perhaps we could return a larger cost if we cannot match the
operation in any table?

Diff Detail

Event Timeline

fhahn created this revision.Nov 11 2021, 10:53 AM
fhahn requested review of this revision.Nov 11 2021, 10:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2021, 10:53 AM
fhahn updated this revision to Diff 414042.Mar 9 2022, 2:20 AM

Just realized this was still hanging around.. Simplified after 47f4cd9c3dbfb383dd7 & ping

Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 2:20 AM

The new costs look good

llvm/test/Analysis/CostModel/AArch64/cast.ll
442–443

Use update_analyze_test_checks. You may find it is better to move the half checks to a separate function.

fhahn updated this revision to Diff 414341.Mar 10 2022, 4:23 AM

Rebase after moving fp16 cast tests tp @fp16casts in 697f55e3682.

fhahn marked an inline comment as done.Mar 10 2022, 4:23 AM
fhahn added inline comments.
llvm/test/Analysis/CostModel/AArch64/cast.ll
442–443

Good point, I moved the relevant fp16 casts in 697f55e3682.

dmgreen accepted this revision.Mar 10 2022, 4:42 AM

Thanks. LGTM

This revision is now accepted and ready to land.Mar 10 2022, 4:42 AM
This revision was landed with ongoing or failed builds.Mar 11 2022, 2:28 AM
This revision was automatically updated to reflect the committed changes.
fhahn marked an inline comment as done.