Skip to content

[experimental] [AArch64] Reorder RTA functions by runtime call density#9727

Open
igogo-x86 wants to merge 2 commits intofacebook:masterfrom
igogo-x86:aarch64-experiment-rta-reorder
Open

[experimental] [AArch64] Reorder RTA functions by runtime call density#9727
igogo-x86 wants to merge 2 commits intofacebook:masterfrom
igogo-x86:aarch64-experiment-rta-reorder

Conversation

@igogo-x86
Copy link
Contributor

On AArch64, non-smashable calls to the runtime (movz/movk/blr sequences) are significantly more expensive than on x86 due to instruction encoding overhead. This patch reorders functions during retranslateAll so that functions with the highest runtime call density (weighted by profile execution counts) are placed first in code.hot.

The idea is that clustering call-heavy functions near the start of the TC improves icache locality for runtime call sequences.

Controlled by two new config options:

  • Eval.JitRuntimeCallReorder (bool, default: true, AArch64 only)
  • Eval.JitRuntimeCallReorderLimitMB (uint32, default: 64)

Diagnostic output available via TRACE=mcg:6.

On AArch64, non-smashable calls to the runtime (movz/movk/blr sequences)
are significantly more expensive than on x86 due to instruction encoding
overhead. This patch reorders functions during retranslateAll so that
functions with the highest runtime call density (weighted by profile
execution counts) are placed first in code.hot.

The idea is that clustering call-heavy functions near the start of the TC
improves icache locality for runtime call sequences.

Controlled by two new config options:
  - Eval.JitRuntimeCallReorder (bool, default: true, AArch64 only)
  - Eval.JitRuntimeCallReorderLimitMB (uint32, default: 64)

Diagnostic output available via TRACE=mcg:6.
@meta-cla meta-cla bot added the CLA Signed label Feb 23, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 23, 2026

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D94090083. (Because this pull request was imported automatically, there will not be any future comments.)

@charles-typ
Copy link

Hi @igogo-x86

We are hitting some assertion errors in CI:

buck-out/v2/art/fbcode/hphp/runtime/vm/__headers__/902f7dcbb74b7967/buck-headers/hphp/runtime/vm/srckey-inl.h:102: Offset HPHP::SrcKey::offset() const: assertion '!prologue() && !funcEntry()' failed.

@facebook-github-bot
Copy link
Contributor

@igogo-x86 has updated the pull request. You must reimport the pull request before landing.

@igogo-x86
Copy link
Contributor Author

Hi, @charles-typ
I'll likely need a full stack trace if the patch doesn't help

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants