From 8bf9947daee957f53d7896ba40f09b074c85aa9f Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Fri, 8 Aug 2025 16:36:38 -0700 Subject: [PATCH] [mlgo] Remove tests involving the size estimator, after PR #139357 We'll remove the size estimator after, this change is to get the `ml-*` build bots green after the aforementioned PR. We never used the size estimator again after the initial DQN-based training. Should we want to again, we now have IR2Vec, which the old estimator was approximating in functionality. --- .../Inline/ML/bounds-checks-rewards.ll | 21 ++++++++++--------- .../Inline/ML/development-training-log.ll | 6 ------ .../Inline/ML/size-estimator-default.ll | 4 ---- .../Inline/ML/size-estimator-training.ll | 6 ------ 4 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 llvm/test/Transforms/Inline/ML/size-estimator-default.ll delete mode 100644 llvm/test/Transforms/Inline/ML/size-estimator-training.ll diff --git a/llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll b/llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll index 0cd61c8a232d9..c5842a1cfb5fd 100644 --- a/llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll +++ b/llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll @@ -13,20 +13,20 @@ ; RUN: %python %S/../../../../lib/Analysis/models/saved-model-to-tflite.py %t_savedmodel %t ; ; When the bounds are very wide ("no bounds"), all inlinings happen. -; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%t -training-log=%t1 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -S < %s | FileCheck %s --check-prefixes=NOBOUNDS-OUT,CHECK +; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-model-under-training=%t -training-log=%t1 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -S < %s | FileCheck %s --check-prefixes=NOBOUNDS-OUT,CHECK ; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t1 | FileCheck %s --check-prefix=NOBOUNDS ; ; When the bounds are very restrictive, the first inlining happens but it's ; considered as "bad" (since it trips over the bounds) and its reward is a ; penalty. However, the mandatory inlining, which is considered next, happens. ; No other inlinings happend. -; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%t -training-log=%t2 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.0 -S < %s | FileCheck %s --check-prefixes=BOUNDS-OUT,CHECK +; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-model-under-training=%t -training-log=%t2 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.0 -S < %s | FileCheck %s --check-prefixes=BOUNDS-OUT,CHECK ; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t2 | FileCheck %s --check-prefix=BOUNDS ; ; With more restrictive bounds, the first inlining happens and is OK. The ; mandatory inlining happens next, and it trips over the bounds, which then ; forces no further inlinings. -; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%t -training-log=%t3 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.1 -S < %s | FileCheck %s --check-prefixes=RELAXED-BOUNDS-OUT,CHECK +; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-model-under-training=%t -training-log=%t3 -enable-ml-inliner=development -ml-advisor-size-increase-threshold=1.2 -S < %s | FileCheck %s --check-prefixes=RELAXED-BOUNDS-OUT,CHECK ; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t3 | FileCheck %s --check-prefix=RELAXED-BOUNDS target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" @@ -52,15 +52,16 @@ define i64 @top() { } attributes #0 = { alwaysinline } ; NOBOUNDS: observation: 0 -; NOBOUNDS: delta_size: 6 -; RELAXED-BOUNDS: delta_size: 6 -; BOUNDS: delta_size: 2147483647 +; NOBOUNDS: inlining_decision: 1 +; RELAXED-BOUNDS: inlining_decision: 1 +; BOUNDS: inlining_decision: 1 ; NOBOUNDS: observation: 1 -; BOUNDS-NOT: observation -; RELAXED-BOUNDS-NOT: observation -; NOBOUNDS: delta_size: -11 +; BOUNDS-NOT: observation: 1 +; RELAXED-BOUNDS: observation: 1 +; NOBOUNDS: inlining_decision: 1 ; NOBOUNDS: observation: 2 -; NOBOUNDS: delta_size: 4 +; NOBOUNDS: inlining_decision +; RELAXED-BOUNDS-NOT: observation: 2 ; CHECK-LABEL: @top ; must_be_inlined must always be inlined, so we won't find a call to it in @top() diff --git a/llvm/test/Transforms/Inline/ML/development-training-log.ll b/llvm/test/Transforms/Inline/ML/development-training-log.ll index b53b6bc95ef11..c8b5198bb8387 100644 --- a/llvm/test/Transforms/Inline/ML/development-training-log.ll +++ b/llvm/test/Transforms/Inline/ML/development-training-log.ll @@ -5,12 +5,6 @@ ; RUN: %python %S/../../../../lib/Analysis/models/gen-inline-oz-test-model.py %t_savedmodel ; RUN: %python %S/../../../../lib/Analysis/models/saved-model-to-tflite.py %t_savedmodel %t ; -; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=%t1 -ml-inliner-model-under-training=%t -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -S < %s -; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t1 | FileCheck %s -; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=%t2 -ml-inliner-model-under-training=%t -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-output-spec-override=%S/Inputs/test_output_spec.json -S < %s -; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t2 | FileCheck %s --check-prefixes=EXTRA-OUTPUTS,CHECK -; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=%t3 -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -S < %s -; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t3 | FileCheck %s ; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=%t4 -ml-inliner-model-under-training=%t -S < %s ; RUN: %python %S/../../../../lib/Analysis/models/log_reader.py %t4 | FileCheck %s --check-prefix=NOREWARD ; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner -training-log=%t5 -S < %s diff --git a/llvm/test/Transforms/Inline/ML/size-estimator-default.ll b/llvm/test/Transforms/Inline/ML/size-estimator-default.ll deleted file mode 100644 index c9e5978ccfc39..0000000000000 --- a/llvm/test/Transforms/Inline/ML/size-estimator-default.ll +++ /dev/null @@ -1,4 +0,0 @@ -; REQUIRES: !have_tflite -; RUN: opt -passes='print' -S < %S/Inputs/size-estimator.ll 2>&1 | FileCheck %s - -; CHECK: [InlineSizeEstimatorAnalysis] size estimate for branches: None \ No newline at end of file diff --git a/llvm/test/Transforms/Inline/ML/size-estimator-training.ll b/llvm/test/Transforms/Inline/ML/size-estimator-training.ll deleted file mode 100644 index 462cc6459e333..0000000000000 --- a/llvm/test/Transforms/Inline/ML/size-estimator-training.ll +++ /dev/null @@ -1,6 +0,0 @@ -; REQUIRES: have_tflite -; RUN: opt -passes='print' -S < %S/Inputs/size-estimator.ll 2>&1 | FileCheck %s --check-prefix=DEFAULT -; RUN: opt -passes='print' -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -S < %S/Inputs/size-estimator.ll 2>&1 | FileCheck %s - -; DEFAULT: [InlineSizeEstimatorAnalysis] size estimate for branches: None -; CHECK: [InlineSizeEstimatorAnalysis] size estimate for branches: 28 \ No newline at end of file