This is an archive of the discontinued LLVM Phabricator instance.

[TTI] Add getCacheLineSize
ClosedPublic

Authored by anemet on Jan 18 2016, 3:53 PM.

Details

Summary

And use it in PPCLoopDataPrefetch.cpp.

@hfinkel, please let me know if your preference would be to preserve the
ppc-loop-prefetch-cache-line option in order to be able to override the
value of TTI::getCacheLineSize for PPC.

Diff Detail

Repository
rL LLVM

Event Timeline

anemet updated this revision to Diff 45217.Jan 18 2016, 3:53 PM
anemet retitled this revision from to [TTI] Add getCacheLineSize.
anemet updated this object.
anemet added a reviewer: hfinkel.
anemet added subscribers: llvm-commits, hfinkel.
hulx2000 added a subscriber: hulx2000.
hulx2000 added inline comments.
include/llvm/Analysis/TargetTransformInfoImpl.h
267 ↗(On Diff #45217)

Return 64 by default is not good, it would be better if assert or return unsupported message by default, and only return 64 for PPC.

anemet added inline comments.Jan 19 2016, 3:25 PM
include/llvm/Analysis/TargetTransformInfoImpl.h
267 ↗(On Diff #45217)

I don't see a precedent for doing such invasive things in the TTI layer itself.

I could return 0 (invalid). That way clients can do the assert or disable any action based on this parameter.

hulx2000 added inline comments.Jan 20 2016, 11:35 AM
include/llvm/Analysis/TargetTransformInfoImpl.h
267 ↗(On Diff #45217)

My concern is :

Now only PPC use this API, which is fine no matter what you do.

However if you return 64 by default, some day other cpu/architecture will start to use it, if people are not careful enough, it will return possibly wrong value for them, give some warning/assert is better than silently return a wrong value, return 0 is ok too.

anemet added inline comments.Jan 20 2016, 1:55 PM
include/llvm/Analysis/TargetTransformInfoImpl.h
267 ↗(On Diff #45217)

OK, 0 sounds like a good compromise. Adding it.

anemet updated this revision to Diff 45445.Jan 20 2016, 2:06 PM

Address hulx2000's comment

zzheng added a subscriber: zzheng.Jan 20 2016, 4:44 PM

Adam, this looks good to me, assuming Hal is OK with the flag being removed. I think we'll be able to use this hook in some of the loop optimizations (e.g., interchange).

anemet updated this revision to Diff 45544.Jan 21 2016, 9:29 AM

Now that we have a PPC hook for this, it's actually trivial to retain the the
flag ppc-loop-prefetch-cache-line. This makes the patch NFC, so you ignore my question Hal.

I'll commit this shortly per Geoff's approval. Thanks guys!

Now that we have a PPC hook for this, it's actually trivial to retain the the
flag ppc-loop-prefetch-cache-line. This makes the patch NFC, so you ignore my question Hal.

I'll commit this shortly per Geoff's approval. Thanks guys!

Sorry, per Matt, of course.

mcrosier accepted this revision.Jan 21 2016, 10:28 AM
mcrosier added a reviewer: mcrosier.

Per Matt (and I agree as well).

This revision is now accepted and ready to land.Jan 21 2016, 10:28 AM
This revision was automatically updated to reflect the committed changes.