Skip to content

Commit 99b95f0

Browse files
committed
Add check for host inlining
1 parent b2b85c1 commit 99b95f0

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

ci.jsonnet

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ local part_definitions = {
6565
"*.log",
6666
],
6767

68+
mx_options:: [],
6869
mx_build_options:: [],
6970
},
7071

7172
build: {
7273
setup+: [["mx", "sversions"]] +
7374
# aot-build.log is used for the build-stats metrics, in other cases it does no harm
74-
jt(["build", "--env", self.mx_env, "--"] + self.mx_build_options + ["|", "tee", "aot-build.log"]) +
75+
jt(["build", "--env", self.mx_env] + self.mx_options + ["--"] + self.mx_build_options + ["|", "tee", "aot-build.log"]) +
7576
[
7677
# make sure jt always uses what was just built
7778
["set-export", "RUBY_BIN", jt(["--use", self.mx_env, "--silent", "launcher"])[0]],
@@ -204,6 +205,14 @@ local part_definitions = {
204205
HOST_VM_CONFIG: "graal-enterprise",
205206
},
206207
},
208+
host_inlining_log: {
209+
# Same as in mx.truffleruby/native-host-inlining
210+
mx_options+:: [
211+
"--extra-image-builder-argument=rubyvm:-H:Log=TruffleHostInliningPhase,~CanonicalizerPhase,~GraphBuilderPhase",
212+
"--extra-image-builder-argument=rubyvm:-H:+TruffleHostInliningPrintExplored",
213+
"--extra-image-builder-argument=rubyvm:-Dgraal.LogFile=host-inlining.txt",
214+
],
215+
},
207216
},
208217

209218
jdk: {
@@ -533,13 +542,13 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
533542
"ruby-test-compiler-graal-enterprise-17": $.platform.linux + $.jdk.v17 + $.env.jvm_ee + gate + $.use.truffleruby + $.run.test_compiler,
534543
"ruby-test-compiler-graal-enterprise-20": $.platform.linux + $.jdk.v20 + $.env.jvm_ee + gate + $.use.truffleruby + $.run.test_compiler,
535544

536-
"ruby-test-svm-graal-core-linux-17": $.platform.linux + $.jdk.v17 + $.env.native + $.env.gdb_svm + gate + native_tests,
545+
"ruby-test-svm-graal-core-linux-17": $.platform.linux + $.jdk.v17 + $.env.native + $.env.gdb_svm + gate + native_tests + $.env.host_inlining_log,
537546
"ruby-test-svm-graal-core-linux-20": $.platform.linux + $.jdk.v20 + $.env.native + $.env.gdb_svm + gate + native_tests,
538547
"ruby-test-svm-graal-core-darwin-amd64-17": $.platform.darwin_amd64 + $.jdk.v17 + $.env.native + $.env.gdb_svm + gate + native_tests,
539548
"ruby-test-svm-graal-core-darwin-amd64-20": $.platform.darwin_amd64 + $.jdk.v20 + $.env.native + $.env.gdb_svm + gate + native_tests,
540549
"ruby-test-svm-graal-core-darwin-aarch64-17": $.platform.darwin_aarch64 + $.jdk.v17 + $.env.native + gate + native_tests,
541550
"ruby-test-svm-graal-core-darwin-aarch64-20": $.platform.darwin_aarch64 + $.jdk.v20 + $.env.native + gate + native_tests,
542-
"ruby-test-svm-graal-enterprise-linux": $.platform.linux + $.jdk.v17 + $.env.native_ee + $.env.gdb_svm + gate + native_tests,
551+
"ruby-test-svm-graal-enterprise-linux": $.platform.linux + $.jdk.v17 + $.env.native_ee + $.env.gdb_svm + gate + native_tests + $.env.host_inlining_log,
543552
"ruby-test-svm-graal-enterprise-darwin-aarch64 ": $.platform.darwin_aarch64 + $.jdk.v17 + $.env.native_ee + gate + native_tests,
544553
},
545554

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
source test/truffle/common.sh.inc
4+
5+
file=${1:-host-inlining.txt}
6+
7+
if [ -f "$file" ]; then
8+
# shellcheck disable=SC2016
9+
ruby tool/extract_host_inlining.rb 'org.truffleruby.language.methods.CallForeignMethodNodeGen$ConvertForOperatorAndReDispatchNodeGen.execute' "$file" > out.txt
10+
# shellcheck disable=SC2016
11+
grep -F 'Root[org.truffleruby.language.methods.CallForeignMethodNodeGen$ConvertForOperatorAndReDispatchNodeGen.execute]' out.txt
12+
if ! grep -E 'Out of budget|too big to explore' out.txt; then
13+
echo 'ConvertForOperatorAndReDispatchNodeGen.execute should be out of budget (too much code), did host inlining output change?'
14+
cat out.txt
15+
exit 1
16+
fi
17+
18+
ruby tool/extract_host_inlining.rb org.truffleruby.language.dispatch.RubyCallNode.execute "$file" > out.txt
19+
grep -F 'Root[org.truffleruby.language.dispatch.RubyCallNode.execute]' out.txt
20+
if grep -E 'Out of budget|too big to explore' out.txt; then
21+
echo 'RubyCallNode.execute no longer fits in host inlining budget'
22+
cat out.txt
23+
exit 1
24+
fi
25+
26+
ruby tool/extract_host_inlining.rb --simplify org.truffleruby.language.dispatch.RubyCallNode.execute "$file" | grep CUTOFF > simplified.txt
27+
if grep -v -E 'not direct call|not inlinable|marked to be not used for inlining|leads to unwind' simplified.txt; then
28+
echo 'RubyCallNode.execute has unexpected CUTOFFs'
29+
cat out.txt
30+
exit 1
31+
fi
32+
33+
rm out.txt
34+
rm simplified.txt
35+
else
36+
echo "$file does not exist, skipping test"
37+
fi

0 commit comments

Comments
 (0)