This is an archive of the discontinued LLVM Phabricator instance.

[mlgo] Support exposing more features than those supported by models
ClosedPublic

Authored by mtrofin on Apr 27 2022, 3:33 PM.

Details

Summary

This allows the compiler to support more features than those supported by a
model. The only requirement (development mode only) is that the new features must be appended
at the end of the list of features requested from the model. The support
is transparent to compiler code: for unsupported features, we provide a
valid buffer to copy their values; it's just that this buffer is
disconnected from the model, so insofar as the model is concerned (AOT
or development mode), these features don't exist. The buffers are
allocated at setup - meaning, at steady state, there is no extra allocation
(maintaining the current invariant). These buffers has 2 roles: one,
keep the compiler code simple. Second, allow logging their values in
development mode. The latter allows retraining a model supporting the
larger feature set starting from traces produced with the old model.

For release mode (AOT-ed models), this decouples compiler evolution from
model evolution, which we want in scenarios where the toolchain is
frequently rebuilt and redeployed: we can first deploy the new features,
and continue working with the older model, until a new model is made
available, which can then be picked up the next time the compiler is built.

Diff Detail

Event Timeline

mtrofin created this revision.Apr 27 2022, 3:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2022, 3:33 PM
mtrofin requested review of this revision.Apr 27 2022, 3:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2022, 3:33 PM

what restricts that "the new features must be appended at the end of the list of features requested from the model"?

Wondering whether it is possible to relax this constraint cause it may cause trouble if there are multiple developers for the same pass

mtrofin updated this revision to Diff 426499.May 2 2022, 1:07 PM

clarify "new features at the end" is a requirement for dev mode only

what restricts that "the new features must be appended at the end of the list of features requested from the model"?

It's a requirement for development mode only (updated to clarify). To your question, see TFUtils.cpp, lines 303 and then the added lines 309 and below.

Wondering whether it is possible to relax this constraint cause it may cause trouble if there are multiple developers for the same pass

How?

mtrofin edited the summary of this revision. (Show Details)May 2 2022, 1:08 PM
yundiqian accepted this revision.May 9 2022, 1:21 PM

what restricts that "the new features must be appended at the end of the list of features requested from the model"?

It's a requirement for development mode only (updated to clarify). To your question, see TFUtils.cpp, lines 303 and then the added lines 309 and below.

Wondering whether it is possible to relax this constraint cause it may cause trouble if there are multiple developers for the same pass

How?

As per offline discussion, will keep this constraint for now, and remove this constraint after migrating to tflite.

This revision is now accepted and ready to land.May 9 2022, 1:21 PM
This revision was landed with ongoing or failed builds.May 9 2022, 6:01 PM
This revision was automatically updated to reflect the committed changes.

Hmm... there may be something else here. I did this, by looking at
https://lab.llvm.org/buildbot/#/builders/169/builds/8182/steps/7/logs/stdio

git pull
mkdir build && cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF
'-DLLVM_ENABLE_PROJECTS='\''clang;compiler-rt;lld'\'''
-DLLVM_CCACHE_BUILD=ON ../llvmninja
This completed just fine.
Could it be an issue with the caches?

Hmm... there may be something else here. I did this, by looking at
https://lab.llvm.org/buildbot/#/builders/169/builds/8182/steps/7/logs/stdio

git pull
mkdir build && cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF
'-DLLVM_ENABLE_PROJECTS='\''clang;compiler-rt;lld'\'''
-DLLVM_CCACHE_BUILD=ON ../llvmninja
This completed just fine.
Could it be an issue with the caches?

No, we can reproduce that on clean VM