From c6fea6d0464cf235cd12b14cd401df4f9213f506 Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Wed, 8 Jul 2020 13:00:43 +0100 Subject: [PATCH 1/2] Use libgraal as standard compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - added --no-libgraal flag to disable use of libgraal - only compile libgraal-jdk for the compile target - for ci and testing, truffle-lib is just fine - the jar target doesn’t use libgraal-jdk, but truffle-libs, which makes it better for use in CI - tooling and superinstruction tests don’t need libgraal - use of interpreter-only implies we don’t need libgraal - on Travis, avoid compiling libgraal. Note, there is some issue with the path for libgraal not being determined correctly. Did not further investigate. Signed-off-by: Stefan Marr --- .gitlab-ci.yml | 2 +- .travis.yml | 14 ++++++------ build.xml | 40 ++++++++++++++++++++++++--------- som | 37 +++++++++++++++++++++++------- tests/superinstructions/test.sh | 2 +- 5 files changed, 67 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 558152b6a..024a7e878 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ kompos_and_dym_tests: stage: full-test tags: [benchmarks, infinity] script: - - ant jacoco-lib compile dynamic-metrics-tests superinstructions-tests + - ant jacoco-lib jar dynamic-metrics-tests superinstructions-tests - (cd tools/kompos && npm install . && npm -s run verify && npm test) replay_tests: diff --git a/.travis.yml b/.travis.yml index 6cbbbf4d2..76295f6fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,17 +38,17 @@ jobs: - name: Kompos Tests script: - run nvm install 8 - - $ANT + - $ANT jar kompos - cd tools/kompos - run npm -s run verify - run npm test - name: Replay Tests 1 script: - - $ANT compile + - $ANT jar - run ./tests/replay/test.sh 1 - name: Replay Tests 2 script: - - $ANT compile + - $ANT jar - run ./tests/replay/test.sh 2 # Disabled due to breaking changes in the tracing infrastructure. Not fixed to make merge of Snapshotting PR(#293) easier. @@ -65,16 +65,16 @@ jobs: dist: trusty jdk: openjdk11 script: - - $ANT compile - - run ./som core-lib/TestSuite/TestRunner.ns + - $ANT jar + - run ./som --no-libgraal core-lib/TestSuite/TestRunner.ns - name: macOS Unit Tests os: osx osx_image: xcode9.3 language: generic script: - - $ANT compile - - run ./som core-lib/TestSuite/TestRunner.ns + - $ANT jar + - run ./som --no-libgraal core-lib/TestSuite/TestRunner.ns before_install: - | diff --git a/build.xml b/build.xml index a60666479..55a32a99c 100644 --- a/build.xml +++ b/build.xml @@ -50,6 +50,7 @@ + @@ -142,7 +143,7 @@ - + @@ -160,6 +161,7 @@ + @@ -172,7 +174,20 @@ - + + + + + + + + + + + + + + @@ -240,7 +255,7 @@ - + - + + + + @@ -389,11 +407,11 @@ - + - + - + @@ -445,7 +463,7 @@ - + @@ -481,7 +499,7 @@ - + @@ -492,7 +510,7 @@ - + @@ -563,7 +581,7 @@ - + diff --git a/som b/som index cf791a18f..4ac71a94c 100755 --- a/som +++ b/som @@ -124,6 +124,8 @@ parser.add_argument('-E', '--no-early-compilation', help='start compilation usin dest='early_compilation', action='store_false', default=True) parser.add_argument('-EG', '--no-embedded-graal', help='run without the embedded Graal', dest='embedded_graal', action='store_false', default=True) +parser.add_argument('-LG', '--no-libgraal', help='run without using the embedded libgraal. Settings like JVMCI_BIN and GRAAL_HOME are ignored as long as libgraal is not disabled.', + dest='use_libgraal', action='store_false', default=True) parser.add_argument('-X', '--java-interpreter', help='run without Graal, and only the Java interpreter', dest='java_interpreter', action='store_true', default=False) parser.add_argument('-T', '--no-trace', help='do not print truffle compilation info', @@ -160,13 +162,17 @@ if args.dynamic_metrics: if args.java_interpreter: args.interpreter = True +if args.interpreter: + args.use_libgraal = False + # Determine JVM to be used java_bin = None -if JVMCI_BIN: - java_bin = JVMCI_BIN -if not java_bin and GRAAL_HOME and os.path.isfile(GRAAL_HOME + '/bin/java'): - java_bin = GRAAL_HOME + '/bin/java' +if not args.use_libgraal: + if JVMCI_BIN: + java_bin = JVMCI_BIN + if not java_bin and GRAAL_HOME and os.path.isfile(GRAAL_HOME + '/bin/java'): + java_bin = GRAAL_HOME + '/bin/java' if not java_bin: # use local JVMCI, which ant already needed @@ -198,6 +204,16 @@ if not args.interpreter and not java_bin.startswith(BASE_DIR + '/libs/jvmci') an print "No compatible JDK found. Please set the GRAAL_HOME or JVMCI_BIN environment variables." sys.exit(1) +if args.use_libgraal: + from subprocess import check_output, STDOUT, CalledProcessError + try: + libgraal_jdk_home = check_output([BASE_DIR + '/libs/mx/mx', '--primary-suite-path', BASE_DIR + '/libs/truffle/vm', '--env', 'libgraal', 'graalvm-home'], stderr=STDOUT, env = {'JAVA_HOME': java_bin.replace('/bin/java', '')}) + java_bin = libgraal_jdk_home.strip() + '/bin/java' + except CalledProcessError as e: + print "Failed to determine location of libgraal" + print e.output + sys.exit(1) + ## ## Defining Necessary Parameter Bits ## @@ -216,8 +232,15 @@ BOOT_CLASSPATH = ('-Xbootclasspath/a:' + TRUFFLE_DIR + '/sdk/mxbuild/dists/jdk1.8/graal-sdk.jar:' + TRUFFLE_DIR + '/truffle/mxbuild/dists/jdk1.8/truffle-api.jar') -GRAAL_JAVA_8_FLAGS = ['-Djvmci.Compiler=graal', - '-Djvmci.class.path.append=' + TRUFFLE_DIR + '/compiler/mxbuild/dists/jdk1.8/graal.jar'] +if args.use_libgraal: + GRAAL_JAVA_8_FLAGS = ['-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', + '-XX:-UseJVMCIClassLoader', '-Dgraalvm.locatorDisabled=true'] + GRAAL_JVMCI_FLAGS = [] +else: + GRAAL_JAVA_8_FLAGS = ['-Djvmci.Compiler=graal', + '-Djvmci.class.path.append=' + TRUFFLE_DIR + '/compiler/mxbuild/dists/jdk1.8/graal.jar'] + GRAAL_JVMCI_FLAGS = ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:-UseJVMCICompiler'] + GRAAL_JAVA_9_FLAGS = [ '--module-path=' + TRUFFLE_DIR + '/sdk/mxbuild/modules/org.graalvm.graal_sdk.jar:' + @@ -232,8 +255,6 @@ TWEAK_INLINING = ['-Dgraal.TruffleCompilationThreshold=191', '-Dgraal.TruffleInliningMaxCallerSize=10000', '-Dgraal.TruffleSplittingMaxCalleeSize=100000'] -GRAAL_JVMCI_FLAGS = ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:-UseJVMCICompiler'] - JAVA_ARGS = ['-server', '-XX:+UseThreadPriorities'] if JAVA_MAJOR_VERSION == 8: diff --git a/tests/superinstructions/test.sh b/tests/superinstructions/test.sh index 2c2ef701a..d17f6ce4c 100755 --- a/tests/superinstructions/test.sh +++ b/tests/superinstructions/test.sh @@ -23,7 +23,7 @@ NEEDS_UPDATE=false function runBenchmark { BENCH=$1 - HARNESS="${SOM_DIR}/som -si -Dsi.output=${SCRIPT_PATH}/results/${BENCH}.txt \ + HARNESS="${SOM_DIR}/som --no-libgraal -si -Dsi.output=${SCRIPT_PATH}/results/${BENCH}.txt \ -G $SOM_DIR/core-lib/Benchmarks/Harness.ns" echo $HARNESS $@ $HARNESS $@ From c0cb3bfbe55509b40f80e739139bb0ede545b43f Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Thu, 6 Aug 2020 10:29:48 +0100 Subject: [PATCH 2/2] Combine benchmark jobs to save compile time Signed-off-by: Stefan Marr --- .gitlab-ci.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 024a7e878..adc24059d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,14 +55,6 @@ benchmark_savina_job: - ant compile - rebench --experiment="CI Benchmark Run Pipeline ID $CI_PIPELINE_ID" --branch="$CI_COMMIT_REF_NAME" -c codespeed.conf SOMns-Savina -benchmark_savina_csp_job: - stage: benchmark - tags: [benchmarks, infinity] - allow_failure: true - script: - - ant compile - - rebench --experiment="CI Benchmark Run Pipeline ID $CI_PIPELINE_ID" --branch="$CI_COMMIT_REF_NAME" -c codespeed.conf SOMns-SavinaCSP - benchmark_job: stage: benchmark tags: [benchmarks, infinity] @@ -71,12 +63,13 @@ benchmark_job: - ant compile - rebench --experiment="CI Benchmark Run Pipeline ID $CI_PIPELINE_ID" --branch="$CI_COMMIT_REF_NAME" -c codespeed.conf SOMns -benchmark_interp_job: +benchmark_csp_and_interp_job: stage: benchmark tags: [benchmarks, infinity] allow_failure: true script: - ant compile + - rebench --experiment="CI Benchmark Run Pipeline ID $CI_PIPELINE_ID" --branch="$CI_COMMIT_REF_NAME" -c codespeed.conf SOMns-SavinaCSP - rebench --experiment="CI Benchmark Run Pipeline ID $CI_PIPELINE_ID" --branch="$CI_COMMIT_REF_NAME" -c codespeed.conf SOMns-interp benchmark_nightly_job: