[PATCH] D111747: [mlgo][aot] requrie the model is autogenerated for test determinism
Mircea Trofin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 13 10:38:49 PDT 2021
mtrofin created this revision.
mtrofin added a reviewer: phosek.
Herald added subscribers: mgrang, mgorny.
mtrofin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The tests that exercise the 'release' mode, where the model is AOT-ed,
check the output has certain properties, to validate that, indeed, a
different policy from the default one was exercised. For determinism, we
can't reliably check that output for an arbitrary learned policy, since
it could be that policy happens to mimic the default one in that
particular case.
This patch adds a requirement that those tests run only when the model
is autogenerated (e.g. on build bots).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111747
Files:
llvm/test/CMakeLists.txt
llvm/test/Transforms/Inline/ML/bounds-checks.ll
llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll
llvm/test/lit.cfg.py
llvm/test/lit.site.cfg.py.in
Index: llvm/test/lit.site.cfg.py.in
===================================================================
--- llvm/test/lit.site.cfg.py.in
+++ llvm/test/lit.site.cfg.py.in
@@ -54,6 +54,7 @@
config.linked_bye_extension = @LLVM_BYE_LINK_INTO_TOOLS@
config.have_tf_aot = @LLVM_HAVE_TF_AOT@
config.have_tf_api = @LLVM_HAVE_TF_API@
+config.llvm_inliner_model_autogenerated = not @LLVM_INLINER_MODEL_PATH@ or @LLVM_INLINER_MODEL_PATH@ == "autogenerate"
config.expensive_checks = @LLVM_ENABLE_EXPENSIVE_CHECKS@
# Support substitution of the tools_dir with user parameters. This is
Index: llvm/test/lit.cfg.py
===================================================================
--- llvm/test/lit.cfg.py
+++ llvm/test/lit.cfg.py
@@ -254,6 +254,9 @@
if config.have_tf_api:
config.available_features.add("have_tf_api")
+if config.llvm_inliner_model_autogenerated:
+ config.available_features.add("llvm_inliner_model_autogenerated")
+
def have_cxx_shared_library():
readobj_exe = lit.util.which('llvm-readobj', config.llvm_tools_dir)
if not readobj_exe:
Index: llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll
===================================================================
--- llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll
+++ llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll
@@ -6,5 +6,6 @@
; for the 'development' mode.
;
; REQUIRES: have_tf_aot
+; REQUIRES: llvm_inliner_model_autogenerated
; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -S < %S/Inputs/test-module.ll 2>&1 | FileCheck %S/Inputs/test-module.ll --check-prefix=CHECK
; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=default -S < %S/Inputs/test-module.ll 2>&1 | FileCheck %S/Inputs/test-module.ll --check-prefix=DEFAULT
Index: llvm/test/Transforms/Inline/ML/bounds-checks.ll
===================================================================
--- llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -1,8 +1,9 @@
; Test behavior when inlining policy grows size out of control.
; In all cases, the end result is the same: mandatory inlinings must happen.
-; However, when we discover we 'trip' over the artificially-low size increase
+; However, when we discover we 'trip' over the artificially-low size increase
; factor, we don't inline anymore.
; REQUIRES: have_tf_aot
+; REQUIRES: llvm_inliner_model_autogenerated
; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
@@ -38,4 +39,4 @@
; @some-function isn't mandatory, and when we set the increase threshold too low,
; it won't be inlined.
; NOBOUNDS-NOT: @some_function
-; BOUNDS: call i64 @some_function
\ No newline at end of file
+; BOUNDS: call i64 @some_function
Index: llvm/test/CMakeLists.txt
===================================================================
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -17,6 +17,7 @@
LLVM_BYE_LINK_INTO_TOOLS
LLVM_HAVE_TF_AOT
LLVM_HAVE_TF_API
+ LLVM_INLINER_MODEL_PATH
LLVM_ENABLE_EXPENSIVE_CHECKS
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111747.379464.patch
Type: text/x-patch
Size: 3346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211013/fb9d72eb/attachment.bin>
More information about the llvm-commits
mailing list