-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[BOLT] Emit intra-function control flow in YAMLBAT #76911
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
[BOLT] Emit intra-function control flow in YAMLBAT #76911
Conversation
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Relax assumptions that YAML output is not supported in BAT mode. Set up basic infrastructure for emitting YAML for functions not covered by BAT, such as from `.bolt.org.text` section (code identical to input binary sans external refs), or non-rewritten functions in non-relocation mode (where the function stays in the same section but BAT mapping is not emitted). This diff only produces YAML profile for non-BAT functions (skipped, non-simple). YAML profile for BAT functions is added in follow-up diffs: - #76911 emits YAML profile with internal control flow information only (branch profile), - #76896 adds cross-function profile (calls profile). Test Plan: Added bolt/test/X86/bolt-address-translation-yaml.test Reviewers: ayermolo, dcci, maksfb, rafaelauler Reviewed By: rafaelauler Pull Request: #76910
Created using spr 1.3.4 [skip ci]
using BBHashMap = std::map<uint32_t, std::pair<unsigned, size_t>>; | ||
/// Return a mapping from basic block input offset to hash and block index for a given function. | ||
const BBHashMap &getBBHashMap(uint64_t OutputAddress) const { | ||
return FuncHashes.at(OutputAddress).second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized you used "at" a number of times now in this stack of diffs. Isn't this supposed to throw exceptions? Isn't LLVM codebase exception free?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out. You're right, it does throw an exception: https://en.cppreference.com/w/cpp/container/map/at
I had code with find
and assert
but switched to at
for conciseness. Let me unwind that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in #86353. Will rebase this and follow-up diffs shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
Relax assumptions that YAML output is not supported in BAT mode. Set up basic infrastructure for emitting YAML for functions not covered by BAT, such as from `.bolt.org.text` section (code identical to input binary sans external refs), or non-rewritten functions in non-relocation mode (where the function stays in the same section but BAT mapping is not emitted). This diff only produces YAML profile for non-BAT functions (skipped, non-simple). YAML profile for BAT functions is added in follow-up diffs: - llvm#76911 emits YAML profile with internal control flow information only (branch profile), - llvm#76896 adds cross-function profile (calls profile). Test Plan: Added bolt/test/X86/bolt-address-translation-yaml.test Reviewers: ayermolo, dcci, maksfb, rafaelauler Reviewed By: rafaelauler Pull Request: llvm#76910
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
Provide secondary entry points for `EntryDiscriminator` call info field in YAML profile. Increases BAT section size to: - large binary: 39655300 bytes (1.03x the original), - medium binary: 3834328 bytes (0.65x), - small binary: 924 bytes (0.64x). Depends on: #76911 Test Plan: - Updated bolt-address-translation{,-yaml}.test - Added openssl test: rafaelauler/bolt-tests#30 Reviewers: dcci, rafaelauler, maksfb, ayermolo Reviewed By: rafaelauler Pull Request: #86218
Attach branch counters to YAML profile, covering intra-function control
flow.
Depends on: #86353
Test Plan: Updated bolt/test/X86/bolt-address-translation-yaml.test