This is an archive of the discontinued LLVM Phabricator instance.

[NFC][mlgo] Generalize model runner interface
ClosedPublic

Authored by mtrofin on Dec 7 2021, 4:29 PM.

Details

Summary

This prepares it for the regalloc work. Part of it is making model
evaluation accross 'development' and 'release' scenarios more reusable.
This patch:

  • extends support to tensors of any shape (not just scalars, like we had

in the inliner -Oz case). While the tensor shape can be anything, we
assume row-major layout and expose the tensor as a buffer.

  • exposes the NoInferenceModelRunner, which we use in the 'development'

mode to keep the evaluation code path consistent and simplify logging,
as we'll want to reuse it in the regalloc case.

Diff Detail

Event Timeline

mtrofin created this revision.Dec 7 2021, 4:29 PM
mtrofin requested review of this revision.Dec 7 2021, 4:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2021, 4:29 PM
yundiqian accepted this revision.Dec 8 2021, 4:07 PM
yundiqian added inline comments.
llvm/include/llvm/Analysis/MLModelRunner.h
41–45

do they need to be public?

llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
269

will part of it get re-factored out of inline to common lib?

This revision is now accepted and ready to land.Dec 8 2021, 4:07 PM
mtrofin added inline comments.Dec 8 2021, 6:15 PM
llvm/include/llvm/Analysis/MLModelRunner.h
41–45

I think I may need them in a subsequent patch, but I can move them to public then.

llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
269

I'd like to, yes. Same with the log population from the evaluator - it's pretty generic.

mtrofin updated this revision to Diff 393017.Dec 8 2021, 8:10 PM

moved 2 APIs to protected

This revision was landed with ongoing or failed builds.Dec 8 2021, 8:11 PM
This revision was automatically updated to reflect the committed changes.