Skip to content

Commit

Permalink
[GR-27111] Remove tracing commands, break the interpreter loop into p…
Browse files Browse the repository at this point in the history
…arts.

PullRequest: graal/7480
  • Loading branch information
axel22 committed Nov 3, 2020
2 parents da89769 + d530ac1 commit 843532e
Show file tree
Hide file tree
Showing 23 changed files with 1,877 additions and 1,787 deletions.
1 change: 1 addition & 0 deletions vm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/latest_graalvm
/latest_graalvm_home
/benchmarks/**/*.wasm
10 changes: 9 additions & 1 deletion vm/ci_common/common-bench.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,23 @@ vm_bench_js_linux: ${vm_bench_common} ${vm_java_8} ${svm-common-linux-amd64} ${s
vm_bench_polybench_linux: ${vm_bench_common} ${vm_java_8} ${svm-common-linux-amd64} ${truffleruby_linux} ${custom_vm_linux} {
base_cmd: [mx, --env, "polybench-${VM_ENV}"]
bench_cmd: ${vm_bench_polybench_linux.base_cmd} [benchmark, "polybench:*", --results-file, ${vm_bench_polybench_linux.result_file}, --, "--polybench-vm=graalvm-${VM_ENV}"]
downloads: {
WABT_DIR: {name: wabt, version: "1.0.12", platformspecific: true},
EMSDK_DIR: {name: emsdk, version: "1.39.13", platformspecific: true},
}
environment: {
EMCC_DIR: "$EMSDK_DIR/emscripten/master/"
}
setup: ${common_vm.setup} [
${vm_bench_polybench_linux.base_cmd} [build]
${vm_bench_polybench_linux.base_cmd} [build, --all]
]
run: [
${vm_bench_polybench_linux.bench_cmd} ["--polybench-vm-config=jvm-interpreter"]
${vm_bench_common.upload}
${vm_bench_polybench_linux.bench_cmd} ["--polybench-vm-config=native-interpreter"]
${vm_bench_common.upload}
]
targets: [bench, daily]
}

builds += [
Expand Down
72 changes: 72 additions & 0 deletions vm/mx.vm/mx_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
))


polybench_benchmark_methods = ["_run"]


# pylint: disable=line-too-long
ce_components = ['cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'js', 'lg', 'lsp', 'nfi', 'njs', 'polynative', 'pro', 'rgx', 'sdk', 'slg', 'svm', 'svml', 'tfl', 'tflm', 'libpoly', 'poly', 'bpolyglot', 'vvm']
ce_complete_components = ['cmp', 'cov', 'dap', 'gu', 'gvm', 'gwa', 'ins', 'insight', 'js', 'lg', 'llp', 'lsp', 'nfi', 'ni', 'nil', 'njs', 'polynative', 'pro', 'pyn', 'pynl', 'rby', 'rbyl', 'rgx', 'sdk', 'slg', 'svm', 'svml', 'tfl', 'tflm', 'libpoly', 'poly', 'bpolyglot', 'vvm']
Expand Down Expand Up @@ -149,6 +152,75 @@ def mx_register_dynamic_suite_constituents(register_project, register_distributi
if register_project:
register_project(GraalVmSymlinks())

if mx_sdk_vm_impl.has_component('GraalWasm'):
import mx_wasm

class GraalVmWasmSourceFileProject(mx_wasm.GraalWasmSourceFileProject):
def getSourceDir(self):
return self.subDir

def getProgramSources(self):
for root, _, files in os.walk(self.getSourceDir()):
for filename in files:
if filename.endswith(".c"):
yield (root, filename)

def getBuildTask(self, args):
output_base = self.get_output_base()
return GraalVmWasmSourceFileTask(self, args, output_base)

def isBenchmarkProject(self):
return self.name.startswith("benchmarks.")

class GraalVmWasmSourceFileTask(mx_wasm.GraalWasmSourceFileTask):
def needsBuild(self, newestInput):
is_needed, reason = super(GraalVmWasmSourceFileTask, self).needsBuild(newestInput)
if is_needed:
return is_needed, reason
for root, filename in self.subject.getProgramSources():
f = join(root, mx_wasm.remove_extension(filename) + ".wasm")
if not os.path.exists(f):
return True, "symlink '{}' does not exist".format(f)
return False, ''

def benchmark_methods(self):
return polybench_benchmark_methods

def build(self):
super(GraalVmWasmSourceFileTask, self).build()
output_dir = self.subject.getOutputDir()
for root, filename in self.subject.getProgramSources():
src = join(output_dir, mx_wasm.remove_extension(filename) + ".wasm")
dst = join(root, mx_wasm.remove_extension(filename) + ".wasm")
if mx.is_windows():
mx.copyfile(src, dst)
else:
os.symlink(src, dst)

def clean(self, forBuild=False):
super(GraalVmWasmSourceFileTask, self).build()
for root, filename in self.subject.getProgramSources():
f = join(root, mx_wasm.remove_extension(filename) + ".wasm")
if os.path.exists(f):
if os.path.islink(f):
os.unlink(f)
else:
mx.rmtree(f)
output_dir = self.subject.getOutputDir()
if not forBuild and os.path.exists(output_dir):
mx.rmtree(output_dir)

register_project(GraalVmWasmSourceFileProject(
suite=_suite,
name='benchmarks.interpreter.wasm',
deps=[],
workingSets=None,
subDir=join(_suite.dir, 'benchmarks', 'interpreter'),
theLicense=None,
testProject=True,
defaultBuild=False,
))


class GraalVmSymlinks(mx.Project):
def __init__(self, **kw_args):
Expand Down
9 changes: 6 additions & 3 deletions wasm/mx.wasm/mx_wasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ def remove_extension(filename):

class GraalWasmSourceFileProject(mx.ArchivableProject):
def __init__(self, suite, name, deps, workingSets, subDir, theLicense, **args):
self.subDir = subDir
mx.ArchivableProject.__init__(self, suite, name, deps, workingSets, theLicense, **args)
self.subDir = subDir

def getSourceDir(self):
src_dir = os.path.join(self.dir, "src", self.name, self.subDir, "src")
src_dir = os.path.join(self.dir, self.subDir, self.name, "src")
return src_dir

def getOutputDir(self):
Expand Down Expand Up @@ -244,6 +244,9 @@ def __init__(self, project, args, output_base):
def __str__(self):
return 'Building {} with Emscripten'.format(self.subject.name)

def benchmark_methods(self):
return benchmark_methods

def build(self):
source_dir = self.subject.getSourceDir()
output_dir = self.subject.getOutputDir()
Expand All @@ -264,7 +267,7 @@ def build(self):
include_flags = ["-I", os.path.join(_suite.dir, "includes", self.project.includeset)]
emcc_flags = ["-s", "EXIT_RUNTIME=1", "-s", "STANDALONE_WASM", "-s", "WASM_BIGINT"] + cc_flags
if self.project.isBenchmarkProject():
emcc_flags = emcc_flags + ["-s", "EXPORTED_FUNCTIONS=" + str(benchmark_methods).replace("'", "\"") + ""]
emcc_flags = emcc_flags + ["-s", "EXPORTED_FUNCTIONS=" + str(self.benchmark_methods()).replace("'", "\"") + ""]
subdir_program_names = defaultdict(lambda: [])
for root, filename in self.subject.getProgramSources():
subdir = os.path.relpath(root, self.subject.getSourceDir())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
@Option.Group("wasm")
public class WasmOptions {
@Option(help = "A comma-separated list of builtin modules to use: <linking-name>:<builtin-module-name>.", category = OptionCategory.USER, stability = OptionStability.STABLE)//
public static final OptionKey<String> Builtins = new OptionKey<>("");
public static final OptionKey<String> Builtins = new OptionKey<>("wasi_snapshot_preview1");

@Option(help = "The minimal binary size for which to use async parsing.", category = OptionCategory.USER, stability = OptionStability.STABLE)//
public static final OptionKey<Integer> AsyncParsingBinarySize = new OptionKey<>(100_000);
Expand Down
201 changes: 0 additions & 201 deletions wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmTracing.java

This file was deleted.

Loading

0 comments on commit 843532e

Please sign in to comment.