Skip to content
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

Replace and disable the pTOC on POWER10 #5367

Open
1 of 10 tasks
aviansie-ben opened this issue Jul 6, 2020 · 0 comments
Open
1 of 10 tasks

Replace and disable the pTOC on POWER10 #5367

aviansie-ben opened this issue Jul 6, 2020 · 0 comments

Comments

@aviansie-ben
Copy link
Contributor

aviansie-ben commented Jul 6, 2020

POWER10 adds the ability to perform PC-relative loads and stores, which renders the pTOC (where we previously stored floating-point and 64-bit constants) redundant, as all pTOC loads could theoretically be replaced with PC-relative loads instead. The current high-level plan to achieve this in the short-term is to change the sequence used to load a value from a ConstantDataSnippet to instead use a prefixed PC-relative load which is patched with the correct displacement during the EmitSnippets phase. Anything that already uses ConstantDataSnippet can then get improved performance for free and any locations that would previously use a pTOC load can be replaced with use of ConstantDataSnippet when running on POWER10.

We can also further improve the situation by using the 34-bit displacement field of a prefixed load/store instruction (with a constant base of 0) to directly encode an address into a load/store if it is statically known to be sufficiently small to fit. This completely eliminates the need for an extra layer of indirection, which should be quite beneficial for performance.

In order to accomplish this, the following changes will need to be made:

  • Implement binary encoding and relocation for PC-relative loads/stores
  • Implement exploitation of prefixed loads/stores in MemoryReference::expandInstruction
  • Disable out-of-range displacement handling code in MemoryReference::addToOffset on P10
  • Improve ConstantDataSnippet load sequence
    • Switch to emitting PC-relative loads when using ConstantDataSnippet on P10
    • Implement patching of PC-relative load displacements in ConstantDataSnippet
  • Modify MemoryReference::accessStaticItem to use ConstantDataSnippet instead of pTOC loads on P10
  • Add a special case to MemoryReference::accessStaticItem to use the 34-bit displacement field for statically-known small addresses
  • Find and improve misc. locations that access the pTOC directly via TR_PPCTableOfConstants, e.g. [1]
  • Completely disable the pTOC on P10 (free register, revamp trampolines, etc.)

[1] https://github.com/eclipse/omr/blob/31fae2884bc015929925dcaeb6f7018e851fdf4a/compiler/p/codegen/ControlFlowEvaluator.cpp#L2996

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants