Page MenuHomePhabricator

[TTI, AArch64] Allow the cost model analysis to test vector reduce intrinsics
ClosedPublic

Authored by mssimpso on Mar 14 2018, 12:40 PM.

Details

Summary

This patch considers the experimental vector reduce intrinsics in the default implementation of getIntrinsicInstrCost. The cost of these intrinsics is computed with getArithmeticReductionCost and getMinMaxReductionCost. This patch also adds a test case for AArch64 that indicates the costs we currently compute for vector reduce intrinsics. These costs are inaccurate and will be updated in a follow-on patch.

Diff Detail

Repository
rL LLVM

Event Timeline

mssimpso created this revision.Mar 14 2018, 12:40 PM

Hi Mathew,

Why can't this be an extension of getIntrinsicInstrCost itself? It already has that logic (and much more)...

Also, my comments are related to further extensions of this function (if necessary), as well as for extending getIntrinsicInstrCost.

I fear we'll end up with a big list of lambdas before the actual switches, all to wrap common variables and safety asserts.

cheers,
--renato

lib/Analysis/TargetTransformInfo.cpp
1144 ↗(On Diff #138437)

these wrappers do seems cumbersome and mostly unnecessary. You could move the assert into getArithmeticReductionCost and getMinMaxReductionCost and avoid it altogether.

1171 ↗(On Diff #138437)

And here you can cache the values of Args[0]->getType(), etc. and just repeat the pattern.

Hi Mathew,

Why can't this be an extension of getIntrinsicInstrCost itself? It already has that logic (and much more)...

Also, my comments are related to further extensions of this function (if necessary), as well as for extending getIntrinsicInstrCost.

I fear we'll end up with a big list of lambdas before the actual switches, all to wrap common variables and safety asserts.

cheers,
--renato

Thanks a lot for taking a look at the patch, Renato! Ah, I missed the implementation of getIntrinsicInstrCost over in BasicTTIImpl.h. I agree - it definitely makes sense to move this logic there. I'll update the patch with your suggestions.

mssimpso updated this revision to Diff 138559.Mar 15 2018, 8:01 AM
mssimpso edited the summary of this revision. (Show Details)

Addressed Renato's comments.

  • Made the patch an extension of getIntrinsicInstrCost.
rengolin accepted this revision.Mar 15 2018, 8:05 AM

LGTM, thanks!

This revision is now accepted and ready to land.Mar 15 2018, 8:05 AM
This revision was automatically updated to reflect the committed changes.