GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit 20484f8a authored by John Zhang's avatar John Zhang

vmargs improvement

parent 4f62d0be
......@@ -221,6 +221,7 @@ language:
compiler:
exec: # optional, string
args: # optional, list of string
vmargs: # optional, list of string
runner:
flags: # optional
```
......@@ -250,6 +251,15 @@ def target(driver, args):
# target definition
```
If `backend` is `mu`, `vmargs` key can be used to specify VM options.
The value of this key is a list of strings.
The framework will join this list together with appropriate separators according to the selected Mu implementation and pass the joint string to the VM initialisation function.
> Note, because the framework passes a list of strings to create the subprocess,
> the flag `--mu-vmargs=` to RPython displayed on the commandline omits the quotation mark (`'`).
> If the command is copied and pasted to the command line, make sure the qutation mark is added to the
> argument string.
The `exec` key can be used to specify a Python 2.7 interpreter for compiling RPython.
By default [PyPy](http://pypy.org/) is used because of its speed.
......@@ -277,7 +287,7 @@ language:
source: build_(benchname).c # required, string
compiler:
exec: # optional, string
vmarg: # optional, string
vmargs: # optional, string
```
Compile and run a C source file consisting of Mu API calls to construct the Mu bundle,
then run the bundle on the specified Mu implementation.
......@@ -288,8 +298,7 @@ Generally the `source` file should be in the form of `build_(bench).c`, since th
`clang` is the default C compiler. This can be changed in the optional `exec` key.
`vmarg` key can be used to pass an argument string to the VM initialiser.
Note that in the case of Holstein, since the option items are joined with `'\n'`, it needs be `'\\n'` in the string here.
The meaning and requirement for `vmargs` key is the same with RPython.
Same requirements for `environ` and `runner` from [RPython](#rpython) apply.
......@@ -14,7 +14,7 @@ btree:
backend: c
source: targetbtree.py
environ:
PYPY_USESSION_BASENAME: &basename "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
rpyzebu:
language:
name: rpython
......@@ -22,4 +22,8 @@ btree:
impl: zebu
source: targetbtree.py
environ:
PYPY_USESSION_BASENAME: *basename
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
......@@ -74,7 +74,26 @@ class Mu(Language):
cc.setdefault('libmu_link_name', libname)
# vmarg
cc['vmarg'] = expandenv(cc.get('vmarg', ""), task.env)
def set_default_args(defl_d, vmargs):
# include default args if not specified, otherwise use custom-defined value
for key, val in defl_d.items():
if not any([key in arg for arg in vmargs]):
vmargs.append('%(key)s=%(val)s' % locals())
return vmargs
vmargs = list(map(lambda a: expandenv(a, task.env), cc.get('vmargs', [])))
if lc['impl'] == 'holstein':
separators = '\n'
default_args = {}
else: # zebu
separators = ' '
emit_dir = task.output_dir / ('%s_%s-emit' % (task.taskset.name, task.name))
default_args = {
'--aot-emit-dir': str(emit_dir)
}
vmargs = set_default_args(default_args, vmargs)
vmarg_s = separators.join(vmargs)
cc['vmarg_s'] = vmarg_s
return cc
@classmethod
......@@ -134,7 +153,7 @@ class Mu(Language):
# Then run the build program to get the boot image
target = target_dir / target_name
cmd = [build_target]
cmd.append(cc['vmarg'])
cmd.append(cc['vmarg_s'])
cmd.append(target)
cls.run_in_subproc(cmd, task.env)
......
......@@ -76,6 +76,29 @@ class RPython(Language):
# flags
cc['flags'] = list(map(lambda a: expandenv(a, task.env), cc.get('flags', [])))
if lc['backend'] == 'mu':
# vmargs
def set_default_args(defl_d, vmargs):
# include default args if not specified, otherwise use custom-defined value
for key, val in defl_d.items():
if not any([key in arg for arg in vmargs]):
vmargs.append('%(key)s=%(val)s' % locals())
return vmargs
vmargs = list(map(lambda a: expandenv(a, task.env), cc.get('vmargs', [])))
if lc['impl'] == 'holstein':
separators = '\n'
default_args = {}
else: # zebu
separators = ' '
emit_dir = task.output_dir / ('%s_%s-emit' % (task.taskset.name, task.name))
default_args = {
'--aot-emit-dir': str(emit_dir)
}
vmargs = set_default_args(default_args, vmargs)
vmarg_s = separators.join(vmargs)
cc['vmarg_s'] = vmarg_s
return cc
@classmethod
......@@ -115,9 +138,7 @@ class RPython(Language):
if bk == 'mu':
flags.append('--mu-impl=%(impl)s' % task.lang)
flags.append('--mu-suplibdir=%s' % task.output_dir)
if task.lang['impl'] == 'zebu':
emit_dir = task.output_dir / ('%s_%s-emit' % (task.taskset.name, task.name))
flags.append('--mu-vmargs=--aot-emit-dir=%s' % emit_dir)
flags.append("--mu-vmargs=%(vmarg_s)s" % task.compiler)
flags.extend(task.compiler['flags'])
target_dir = task.output_dir
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment