This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] set min jump table entries to 64
ClosedPublic

Authored by shchenz on Aug 28 2023, 7:08 PM.

Details

Summary

This benefits some benchmarks on PPC targets.

And also add a new PPC specific option -ppc-min-jump-table-entries to keep the ability to change the setting from the command line. (After calling setMinimumJumpTableEntries() on PPC, target independent option -min-jump-table-entries does not work.)

Diff Detail

Event Timeline

shchenz created this revision.Aug 28 2023, 7:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2023, 7:08 PM
shchenz requested review of this revision.Aug 28 2023, 7:08 PM

I don't have access to any relevant PPC hardware to benchmark, but 64 seems excessively high. I mean, I can imagine it benefiting certain micro-benchmarks if it helps branch prediction in some hot code. But it's high enough that it likely also hurts other benchmarks, and maybe increases codesize.

I don't have access to any relevant PPC hardware to benchmark, but 64 seems excessively high. I mean, I can imagine it benefiting certain micro-benchmarks if it helps branch prediction in some hot code. But it's high enough that it likely also hurts other benchmarks, and maybe increases codesize.

Thanks for taking a look. I agree with you that setting this value to 64 has the possibility to hurt some applications. 64 is an experiment result based on benchmarks we(IBM Power team) care about currently. This value improves some benchmarks and does not have obvious negative impact for other ones. So we decide to change the default value. codesize is a good point, we can find out a new value for code size purpose if codesize becomes a concern for us later.

Okay; as long as you're keeping that in mind, patch seems fine.

nemanjai accepted this revision.Aug 29 2023, 12:31 PM

The reason 64 seems to be a good value on PPC chips is hopefully a transient situation that seems to have something to do with how bad the chips can be with branch prediction for indirect branches (CTR branches). I think at least some indication should be added in code comments suggesting this be re-evaluated on future HW that will hopefully do better with this kind of branch.
The other knob we have access to wrt. jump tables (density) could probably use some tuning as well.

Other than the above (which doesn't require another review), LGTM.

This revision is now accepted and ready to land.Aug 29 2023, 12:31 PM
This revision was landed with ongoing or failed builds.Aug 29 2023, 6:43 PM
This revision was automatically updated to reflect the committed changes.