This is an archive of the discontinued LLVM Phabricator instance.

Remove ML inlining model artifacts.
ClosedPublic

Authored by jacobhegna on Jun 14 2021, 11:32 AM.

Details

Summary

They are not conducive to being stored in git. Instead, we autogenerate
mock model artifacts for use in tests. Production models can be
specified with the cmake flag LLVM_INLINER_MODEL_PATH.

LLVM_INLINER_MODEL_PATH has two sentinel values:

  • download, which will download the most recent compatible model.
  • autogenerate, which will autogenerate a "fake" model for testing the model uptake infrastructure.

Diff Detail

Event Timeline

jacobhegna created this revision.Jun 14 2021, 11:32 AM
jacobhegna requested review of this revision.Jun 14 2021, 11:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2021, 11:32 AM
mtrofin added inline comments.Jun 14 2021, 11:43 AM
llvm/cmake/modules/TensorFlowCompile.cmake
0–1

can you give it a more specific name, to avoid potential name collision - e.g. get_tf_model_abs_path or smth like that

0–1

This file shouldn't have anything inlining specific.

9

Add in the comment ".. for test"

10

the name could suggest it's a mock model.

llvm/lib/Analysis/models/generate_inlining_model.py
1 ↗(On Diff #351944)

make this file inlining-independent, and the interface something that can be provided via configuration, so we can eventually factor out that config somehow in a language-independent way, and share it between c++ and python.

It's fine if the configuration is just another python that defines the features and their tensor shape, no need for a configuration language.

Addressed mtrofin's comments.

  • autogenerated models are produced in the build directory
  • remove references to inlining from TensorFlowCompile.cmake and generate_mock_model.py
  • put inlining features in separate config file

Adding inlining config file.

Update to use constant policy.

Added context for yundi.

The mock model is now just a tf.function with the correct inputs and outputs. In the case of the inlining model, it will always make the decision to inline.

The unit tests all now pass.

Remove tf_agents dependency.

jacobhegna added inline comments.Jun 15 2021, 2:37 PM
llvm/lib/Analysis/models/inlining/config.py
11

this comment is wrong - I'll fix in the next revision update with whatever other things need to be fixed.

Generate output_spec.json.

jacobhegna edited the summary of this revision. (Show Details)

Fix development mode tests, add ability to download models.

jacobhegna marked 4 inline comments as done.Jun 17 2021, 2:49 PM

marking comments as done.

mtrofin accepted this revision.Jun 17 2021, 3:13 PM

lgtm

llvm/lib/Analysis/CMakeLists.txt
5

second 'most' is probably 'model'

This revision is now accepted and ready to land.Jun 17 2021, 3:13 PM
This revision was landed with ongoing or failed builds.Jun 21 2021, 10:38 AM
This revision was automatically updated to reflect the committed changes.
llvm/lib/Analysis/models/inliner/README.txt