[MLGO] Make sure inliner logs when deleting callees

When using final reward (which is now the default), we were skipping
logging decisions that were leading to callee deletion. This fixes that.

Differential Revision: https://reviews.llvm.org/D108587
This commit is contained in:
Mircea Trofin 2021-08-23 14:43:36 -07:00
parent d898693f72
commit 1055c5e1d3
2 changed files with 34 additions and 0 deletions

View File

@ -227,6 +227,8 @@ private:
(*CallerSizeEstimateBefore + *CalleeSizeEstimateBefore);
getAdvisor()->updateNativeSizeEstimate(Reward);
log(Reward, /*Success=*/true);
} else {
log(NoReward, /*Success=*/true);
}
}

View File

@ -0,0 +1,32 @@
; REQUIRES: have_tf_api
; RUN: opt -enable-ml-inliner=development -passes=scc-oz-module-inliner \
; RUN: -training-log=- -tfutils-text-log -S < %s | FileCheck %s
define i32 @top() {
%a = call i32 @to_be_deleted()
%b = call i32 @externally_visible()
%ret = add i32 %a, %b
ret i32 %ret
}
define internal i32 @to_be_deleted() {
ret i32 1
}
define i32 @externally_visible() {
ret i32 2
}
; CHECK: key: "inlining_decision"
; CHECK-NEXT: value {
; CHECK-NEXT: feature {
; CHECK-NEXT: int64_list {
; CHECK-NEXT: value: 1
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: feature {
; CHECK-NEXT: int64_list {
; CHECK-NEXT: value: 1
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: }