This is an archive of the discontinued LLVM Phabricator instance.

[profi][NFC] Refactor SampleProfileInference::apply
Needs ReviewPublic

Authored by Amir on Jun 5 2023, 5:29 PM.

Details

Reviewers
spupyrev
Summary

Split up apply into the following steps:

  • findUnreachable
  • createStableOrder
  • preAssignWeights
  • canApplyInference
  • extractProfile
  • verifyProfileConsistency

With some specializations, apply should apply to BOLT stale profile matching
(D144500), or potentially a custom apply reusing some of the interfaces.

Diff Detail

Event Timeline

Amir created this revision.Jun 5 2023, 5:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2023, 5:29 PM
Herald added a subscriber: wenlei. · View Herald Transcript
Amir requested review of this revision.Jun 5 2023, 5:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2023, 5:29 PM

Do you have a follow-up diff to adjust BOLT's part?

llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
261–264

"stable order" confuses me. How about "fixed order" or simply "an order of blocks"?

266–268

I'd separate the computation of HasSamples and preAssignWeights, as they seem to be unrelated:

277–278

this comment doesn't make sense (perhaps, outdated). remove maybe

302

should this marker be moved to the function call?

Amir added a comment.Jun 13 2023, 6:50 PM

Do you have a follow-up diff to adjust BOLT's part?

Not at the moment, it's WIP.