1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 03:12:34 +01:00

Merge pull request #500 from setrofim/next

memcopy workload + fix gem5 support.
This commit is contained in:
setrofim
2017-10-10 08:58:24 +01:00
committed by GitHub
10 changed files with 299 additions and 27 deletions

View File

@@ -138,6 +138,9 @@ class ExecutionContext(object):
self.output.write_state()
self.output.write_result()
def finalize(self):
self.tm.finalize()
def start_job(self):
if not self.job_queue:
raise RuntimeError('No jobs to run')
@@ -269,7 +272,8 @@ class Executor(object):
self.logger.info('Connecting to target')
self.target_manager = TargetManager(config.run_config.device,
config.run_config.device_config)
config.run_config.device_config,
output.basepath)
output.write_target_info(self.target_manager.get_target_info())
self.logger.info('Initializing execution context')
@@ -295,6 +299,7 @@ class Executor(object):
runner = Runner(context, pm)
signal.send(signal.RUN_STARTED, self)
runner.run()
context.finalize()
self.execute_postamble(context, output)
signal.send(signal.RUN_COMPLETED, self)

View File

@@ -3,7 +3,8 @@ from copy import copy
from devlib import (LinuxTarget, AndroidTarget, LocalLinuxTarget,
Platform, Juno, TC2, Gem5SimulationPlatform,
AdbConnection, SshConnection, LocalConnection)
AdbConnection, SshConnection, LocalConnection,
Gem5Connection)
from wa.framework import pluginloader
from wa.framework.exception import PluginLoaderError
@@ -12,6 +13,7 @@ from wa.framework.target.assistant import LinuxAssistant, AndroidAssistant
from wa.utils.types import list_of_strings, list_of_ints
from wa.utils.misc import isiterable
def get_target_descriptions(loader=pluginloader):
targets = {}
for cls in loader.list_target_descriptors():
@@ -26,7 +28,7 @@ def get_target_descriptions(loader=pluginloader):
return targets.values()
def instantiate_target(tdesc, params, connect=None):
def instantiate_target(tdesc, params, connect=None, extra_platform_params=None):
target_params = {p.name: p for p in tdesc.target_params}
platform_params = {p.name: p for p in tdesc.platform_params}
conn_params = {p.name: p for p in tdesc.conn_params}
@@ -52,6 +54,11 @@ def instantiate_target(tdesc, params, connect=None):
msg = 'Unexpected parameter for {}: {}'
raise ValueError(msg.format(tdesc.name, name))
for pname, pval in (extra_platform_params or {}).iteritems():
if pname in pp:
raise RuntimeError('Platform parameter clash: {}'.format(pname))
pp[pname] = pval
tp['platform'] = (tdesc.platform or Platform)(**pp)
if cp:
tp['connection_settings'] = cp
@@ -230,10 +237,6 @@ VEXPRESS_PLATFORM_PARAMS = [
]
GEM5_PLATFORM_PARAMS = [
Parameter('host_output_dir', kind=str, mandatory=True,
description='''
Path on the host where gem5 output (e.g. stats file) will be placed.
'''),
Parameter('gem5_bin', kind=str, mandatory=True,
description='''
Path to the gem5 binary
@@ -247,6 +250,10 @@ GEM5_PLATFORM_PARAMS = [
VirtIO device setup arguments to be passed to gem5. VirtIO is used
to transfer files between the simulation and the host.
'''),
Parameter('name', kind=str, default='gem5',
description='''
The name for the gem5 "device".
'''),
]
@@ -303,6 +310,32 @@ CONNECTION_PARAMS = {
to be run via sudo is to go.
"""),
],
Gem5Connection: [
Parameter('host', kind=str, mandatory=False,
description="""
Host name or IP address of the target.
"""),
Parameter('username', kind=str, default='root',
description="""
User name to connect to gem5 simulation.
"""),
Parameter('password', kind=str,
description="""
Password to use.
"""),
Parameter('port', kind=int,
description="""
The port SSH server is listening on on the target.
"""),
Parameter('password_prompt', kind=str,
description="""
Password prompt to expect
"""),
Parameter('original_prompt', kind=str,
description="""
Original shell prompt to expect.
"""),
],
LocalConnection: [
Parameter('password', kind=str,
description="""
@@ -342,24 +375,26 @@ ASSISTANTS = {
'local': LinuxAssistant,
}
# name --> (platform_class, params_list, defaults)
# name --> ((platform_class, conn_class), params_list, defaults)
# Note: normally, connection is defined by the Target name, but
# platforms may choose to override it
PLATFORMS = {
'generic': (Platform, COMMON_PLATFORM_PARAMS, None),
'juno': (Juno, COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS,
'generic': ((Platform, None), COMMON_PLATFORM_PARAMS, None),
'juno': ((Juno, None), COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS,
{
'vemsd_mount': '/media/JUNO',
'baudrate': 115200,
'bootloader': 'u-boot',
'hard_reset_method': 'dtr',
}),
'tc2': (TC2, COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS,
'tc2': ((TC2, None), COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS,
{
'vemsd_mount': '/media/VEMSD',
'baudrate': 38400,
'bootloader': 'bootmon',
'hard_reset_method': 'reboottxt',
}),
'gem5': (Gem5SimulationPlatform, GEM5_PLATFORM_PARAMS, None),
'gem5': ((Gem5SimulationPlatform, Gem5Connection), GEM5_PLATFORM_PARAMS, None),
}
@@ -382,17 +417,23 @@ class DefaultTargetDescriptor(TargetDescriptor):
assistant = ASSISTANTS[target_name]
conn_params = CONNECTION_PARAMS[conn]
for platform_name, platform_tuple in PLATFORMS.iteritems():
platform, platform_params = self._get_item(platform_tuple)
(platform, plat_conn), platform_params = self._get_item(platform_tuple)
name = '{}_{}'.format(platform_name, target_name)
td = TargetDescription(name, self)
td.target = target
td.conn = conn
td.platform = platform
td.assistant = assistant
td.target_params = target_params
td.conn_params = conn_params
td.platform_params = platform_params
td.assistant_params = assistant.parameters
if plat_conn:
td.conn = plat_conn
td.conn_params = CONNECTION_PARAMS[plat_conn]
else:
td.conn = conn
td.conn_params = conn_params
result.append(td)
return result

View File

@@ -1,4 +1,5 @@
import logging
import os
from wa.framework import signal
from wa.framework.plugin import Parameter
@@ -8,6 +9,7 @@ from wa.framework.target.descriptor import (get_target_descriptions,
from wa.framework.target.info import TargetInfo
from wa.framework.target.runtime_parameter_manager import RuntimeParameterManager
from devlib import Gem5SimulationPlatform
from devlib.utils.misc import memoized
from devlib.exception import TargetError
@@ -25,7 +27,8 @@ class TargetManager(object):
"""),
]
def __init__(self, name, parameters):
def __init__(self, name, parameters, outdir):
self.outdir = outdir
self.logger = logging.getLogger('tm')
self.target_name = name
self.target = None
@@ -53,8 +56,8 @@ class TargetManager(object):
self.rpm = RuntimeParameterManager(self.target)
def finalize(self):
self.logger.info('Disconnecting from the device')
if self.disconnect:
if self.disconnect or isinstance(self.target.platform, Gem5SimulationPlatform):
self.logger.info('Disconnecting from the device')
with signal.wrap('TARGET_DISCONNECT'):
self.target.disconnect()
@@ -85,8 +88,14 @@ class TargetManager(object):
if self.target_name not in target_map:
raise ValueError('Unknown Target: {}'.format(self.target_name))
tdesc = target_map[self.target_name]
extra_plat_params={}
if tdesc.platform is Gem5SimulationPlatform:
extra_plat_params['host_output_dir'] = self.outdir
self.logger.debug('Creating {} target'.format(self.target_name))
self.target = instantiate_target(tdesc, self.parameters, connect=False)
self.target = instantiate_target(tdesc, self.parameters, connect=False,
extra_platform_params=extra_plat_params)
with signal.wrap('TARGET_CONNECT'):
self.target.connect()