2006-07-19 22:07:25 +02:00
|
|
|
# -*- mode:python -*-
|
|
|
|
|
2006-07-21 21:46:12 +02:00
|
|
|
# Copyright (c) 2004-2006 The Regents of The University of Michigan
|
2006-07-19 22:07:25 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met: redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer;
|
|
|
|
# redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution;
|
|
|
|
# neither the name of the copyright holders nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived from
|
|
|
|
# this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2006-07-21 21:46:12 +02:00
|
|
|
#
|
|
|
|
# Authors: Steve Reinhardt
|
|
|
|
# Kevin Lim
|
2006-07-19 22:07:25 +02:00
|
|
|
|
2009-03-08 01:58:51 +01:00
|
|
|
import os, signal
|
2010-11-08 20:58:25 +01:00
|
|
|
import sys, time
|
2006-07-19 22:07:25 +02:00
|
|
|
import glob
|
|
|
|
from SCons.Script.SConscript import SConsEnvironment
|
|
|
|
|
|
|
|
Import('env')
|
|
|
|
|
|
|
|
env['DIFFOUT'] = File('diff-out')
|
|
|
|
|
2012-04-14 11:44:27 +02:00
|
|
|
# get the termcap from the environment
|
|
|
|
termcap = env['TERMCAP']
|
|
|
|
|
2006-07-19 22:07:25 +02:00
|
|
|
# Dict that accumulates lists of tests by category (quick, medium, long)
|
|
|
|
env.Tests = {}
|
|
|
|
|
|
|
|
def contents(node):
|
|
|
|
return file(str(node)).read()
|
|
|
|
|
2009-03-08 01:58:51 +01:00
|
|
|
# functions to parse return value from scons Execute()... not the same
|
|
|
|
# as wait() etc., so python built-in os funcs don't work.
|
|
|
|
def signaled(status):
|
|
|
|
return (status & 0x80) != 0;
|
|
|
|
|
|
|
|
def signum(status):
|
|
|
|
return (status & 0x7f);
|
|
|
|
|
|
|
|
# List of signals that indicate that we should retry the test rather
|
|
|
|
# than consider it failed.
|
|
|
|
retry_signals = (signal.SIGTERM, signal.SIGKILL, signal.SIGINT,
|
|
|
|
signal.SIGQUIT, signal.SIGHUP)
|
|
|
|
|
|
|
|
# regular expressions of lines to ignore when diffing outputs
|
|
|
|
output_ignore_regexes = (
|
|
|
|
'^command line:', # for stdout file
|
2013-01-07 19:05:45 +01:00
|
|
|
'^gem5 compiled ', # for stderr file
|
|
|
|
'^gem5 started ', # for stderr file
|
|
|
|
'^gem5 executing on ', # for stderr file
|
2009-03-08 01:58:51 +01:00
|
|
|
'^Simulation complete at', # for stderr file
|
|
|
|
'^Listening for', # for stderr file
|
|
|
|
'listening for remote gdb', # for stderr file
|
|
|
|
)
|
|
|
|
|
|
|
|
output_ignore_args = ' '.join(["-I '"+s+"'" for s in output_ignore_regexes])
|
|
|
|
|
|
|
|
output_ignore_args += ' --exclude=stats.txt --exclude=outdiff'
|
|
|
|
|
|
|
|
def run_test(target, source, env):
|
2006-07-19 22:07:25 +02:00
|
|
|
"""Check output from running test.
|
|
|
|
|
|
|
|
Targets are as follows:
|
2009-03-08 01:58:51 +01:00
|
|
|
target[0] : status
|
|
|
|
|
|
|
|
Sources are:
|
2013-06-27 11:49:49 +02:00
|
|
|
source[0] : gem5 binary
|
2009-03-08 01:58:51 +01:00
|
|
|
source[1] : tests/run.py script
|
|
|
|
source[2] : reference stats file
|
2006-07-19 22:07:25 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
# make sure target files are all gone
|
|
|
|
for t in target:
|
|
|
|
if os.path.exists(t.abspath):
|
2009-03-11 18:54:42 +01:00
|
|
|
env.Execute(Delete(t.abspath))
|
2009-03-08 01:58:51 +01:00
|
|
|
|
|
|
|
tgt_dir = os.path.dirname(str(target[0]))
|
|
|
|
|
|
|
|
# Base command for running test. We mess around with indirectly
|
|
|
|
# referring to files via SOURCES and TARGETS so that scons can mess
|
|
|
|
# with paths all it wants to and we still get the right files.
|
|
|
|
cmd = '${SOURCES[0]} -d %s -re ${SOURCES[1]} %s' % (tgt_dir, tgt_dir)
|
|
|
|
|
|
|
|
# Prefix test run with batch job submission command if appropriate.
|
|
|
|
# Batch command also supports timeout arg (in seconds, not minutes).
|
|
|
|
timeout = 15 * 60 # used to be a param, probably should be again
|
|
|
|
if env['BATCH']:
|
|
|
|
cmd = '%s -t %d %s' % (env['BATCH_CMD'], timeout, cmd)
|
|
|
|
|
2013-06-27 11:49:49 +02:00
|
|
|
# Create a default value for the status string, changed as needed
|
|
|
|
# based on the status.
|
|
|
|
status_str = "passed."
|
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
pre_exec_time = time.time()
|
2009-03-11 18:54:42 +01:00
|
|
|
status = env.Execute(env.subst(cmd, target=target, source=source))
|
2009-03-08 01:58:51 +01:00
|
|
|
if status == 0:
|
2013-06-27 11:49:49 +02:00
|
|
|
# gem5 terminated normally.
|
2009-03-08 01:58:51 +01:00
|
|
|
# Run diff on output & ref directories to find differences.
|
|
|
|
# Exclude the stats file since we will use diff-out on that.
|
2010-11-08 20:58:25 +01:00
|
|
|
|
|
|
|
# NFS file systems can be annoying and not have updated yet
|
|
|
|
# wait until we see the file modified
|
|
|
|
statsdiff = os.path.join(tgt_dir, 'statsdiff')
|
|
|
|
m_time = 0
|
|
|
|
nap = 0
|
|
|
|
while m_time < pre_exec_time and nap < 10:
|
|
|
|
try:
|
|
|
|
m_time = os.stat(statsdiff).st_mtime
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
time.sleep(1)
|
|
|
|
nap += 1
|
|
|
|
|
2009-03-08 01:58:51 +01:00
|
|
|
outdiff = os.path.join(tgt_dir, 'outdiff')
|
2011-10-23 01:52:07 +02:00
|
|
|
# tack 'true' on the end so scons doesn't report diff's
|
|
|
|
# non-zero exit code as a build error
|
|
|
|
diffcmd = 'diff -ubrs %s ${SOURCES[2].dir} %s > %s; true' \
|
2009-03-08 01:58:51 +01:00
|
|
|
% (output_ignore_args, tgt_dir, outdiff)
|
2009-03-11 18:54:42 +01:00
|
|
|
env.Execute(env.subst(diffcmd, target=target, source=source))
|
2009-03-08 01:58:51 +01:00
|
|
|
print "===== Output differences ====="
|
|
|
|
print contents(outdiff)
|
|
|
|
# Run diff-out on stats.txt file
|
|
|
|
diffcmd = '$DIFFOUT ${SOURCES[2]} %s > %s' \
|
|
|
|
% (os.path.join(tgt_dir, 'stats.txt'), statsdiff)
|
|
|
|
diffcmd = env.subst(diffcmd, target=target, source=source)
|
2013-06-27 11:49:49 +02:00
|
|
|
diff_status = env.Execute(diffcmd, strfunction=None)
|
|
|
|
# If there is a difference, change the status string to say so
|
|
|
|
if diff_status != 0:
|
|
|
|
status_str = "CHANGED!"
|
2009-03-08 01:58:51 +01:00
|
|
|
print "===== Statistics differences ====="
|
|
|
|
print contents(statsdiff)
|
|
|
|
|
2013-06-27 11:49:49 +02:00
|
|
|
else: # gem5 exit status != 0
|
|
|
|
# Consider it a failed test unless the exit status is 2
|
|
|
|
status_str = "FAILED!"
|
|
|
|
# gem5 did not terminate properly, so no need to check the output
|
2009-03-08 02:24:13 +01:00
|
|
|
if signaled(status):
|
2013-06-27 11:49:49 +02:00
|
|
|
print 'gem5 terminated with signal', signum(status)
|
2009-03-08 02:24:13 +01:00
|
|
|
if signum(status) in retry_signals:
|
|
|
|
# Consider the test incomplete; don't create a 'status' output.
|
|
|
|
# Hand the return status to scons and let scons decide what
|
|
|
|
# to do about it (typically terminate unless run with -k).
|
|
|
|
return status
|
2013-01-07 19:05:37 +01:00
|
|
|
elif status == 2:
|
2013-06-27 11:49:49 +02:00
|
|
|
# The test was skipped, change the status string to say so
|
|
|
|
status_str = "skipped."
|
2009-03-08 02:24:13 +01:00
|
|
|
else:
|
2013-06-27 11:49:49 +02:00
|
|
|
print 'gem5 exited with non-zero status', status
|
2009-03-08 01:58:51 +01:00
|
|
|
# complete but failed execution (call to exit() with non-zero
|
|
|
|
# status, SIGABORT due to assertion failure, etc.)... fall through
|
|
|
|
# and generate FAILED status as if output comparison had failed
|
|
|
|
|
2013-06-27 11:49:49 +02:00
|
|
|
# Generate status file contents based on exit status of gem5 and diff-out
|
2009-03-08 01:58:51 +01:00
|
|
|
f = file(str(target[0]), 'w')
|
|
|
|
print >>f, tgt_dir, status_str
|
2006-07-19 22:07:25 +02:00
|
|
|
f.close()
|
|
|
|
# done
|
|
|
|
return 0
|
|
|
|
|
2009-03-08 01:58:51 +01:00
|
|
|
def run_test_string(target, source, env):
|
|
|
|
return env.subst("Running test in ${TARGETS[0].dir}.",
|
2006-07-19 22:07:25 +02:00
|
|
|
target=target, source=source)
|
|
|
|
|
2009-03-08 01:58:51 +01:00
|
|
|
testAction = env.Action(run_test, run_test_string)
|
2006-07-19 22:07:25 +02:00
|
|
|
|
|
|
|
def print_test(target, source, env):
|
2012-04-14 11:44:27 +02:00
|
|
|
# print the status with colours to make it easier to see what
|
|
|
|
# passed and what failed
|
|
|
|
line = contents(source[0])
|
|
|
|
|
|
|
|
# split the line to words and get the last one
|
|
|
|
words = line.split()
|
|
|
|
status = words[-1]
|
|
|
|
|
|
|
|
# if the test failed make it red, if it passed make it green, and
|
|
|
|
# skip the punctuation
|
|
|
|
if status == "FAILED!":
|
|
|
|
status = termcap.Red + status[:-1] + termcap.Normal + status[-1]
|
2013-06-27 11:49:49 +02:00
|
|
|
elif status == "CHANGED!":
|
|
|
|
status = termcap.Yellow + status[:-1] + termcap.Normal + status[-1]
|
2012-04-14 11:44:27 +02:00
|
|
|
elif status == "passed.":
|
|
|
|
status = termcap.Green + status[:-1] + termcap.Normal + status[-1]
|
2013-01-07 19:05:37 +01:00
|
|
|
elif status == "skipped.":
|
2013-06-27 11:49:49 +02:00
|
|
|
status = termcap.Cyan + status[:-1] + termcap.Normal + status[-1]
|
2012-04-14 11:44:27 +02:00
|
|
|
|
|
|
|
# put it back in the list and join with space
|
|
|
|
words[-1] = status
|
|
|
|
line = " ".join(words)
|
|
|
|
|
|
|
|
print '***** ' + line
|
2006-07-19 22:07:25 +02:00
|
|
|
return 0
|
|
|
|
|
|
|
|
printAction = env.Action(print_test, strfunction = None)
|
|
|
|
|
2007-08-04 00:04:26 +02:00
|
|
|
# Static vars for update_test:
|
|
|
|
# - long-winded message about ignored sources
|
|
|
|
ignore_msg = '''
|
|
|
|
Note: The following file(s) will not be copied. New non-standard
|
2011-03-04 08:54:31 +01:00
|
|
|
output files must be copied manually once before --update-ref will
|
2007-08-04 00:04:26 +02:00
|
|
|
recognize them as outputs. Otherwise they are assumed to be
|
|
|
|
inputs and are ignored.
|
|
|
|
'''
|
|
|
|
# - reference files always needed
|
2008-12-08 16:16:40 +01:00
|
|
|
needed_files = set(['simout', 'simerr', 'stats.txt', 'config.ini'])
|
2007-08-04 00:04:26 +02:00
|
|
|
# - source files we always want to ignore
|
|
|
|
known_ignores = set(['status', 'outdiff', 'statsdiff'])
|
|
|
|
|
2006-07-19 22:07:25 +02:00
|
|
|
def update_test(target, source, env):
|
|
|
|
"""Update reference test outputs.
|
|
|
|
|
2008-12-08 16:16:40 +01:00
|
|
|
Target is phony. First two sources are the ref & new stats.txt file
|
2006-07-19 22:07:25 +02:00
|
|
|
files, respectively. We actually copy everything in the
|
|
|
|
respective directories except the status & diff output files.
|
|
|
|
|
|
|
|
"""
|
|
|
|
dest_dir = str(source[0].get_dir())
|
|
|
|
src_dir = str(source[1].get_dir())
|
2007-08-04 00:04:26 +02:00
|
|
|
dest_files = set(os.listdir(dest_dir))
|
|
|
|
src_files = set(os.listdir(src_dir))
|
|
|
|
# Copy all of the required files plus any existing dest files.
|
|
|
|
wanted_files = needed_files | dest_files
|
|
|
|
missing_files = wanted_files - src_files
|
|
|
|
if len(missing_files) > 0:
|
|
|
|
print " WARNING: the following file(s) are missing " \
|
|
|
|
"and will not be updated:"
|
|
|
|
print " ", " ,".join(missing_files)
|
|
|
|
copy_files = wanted_files - missing_files
|
|
|
|
warn_ignored_files = (src_files - copy_files) - known_ignores
|
|
|
|
if len(warn_ignored_files) > 0:
|
|
|
|
print ignore_msg,
|
|
|
|
print " ", ", ".join(warn_ignored_files)
|
|
|
|
for f in copy_files:
|
2006-07-19 22:07:25 +02:00
|
|
|
if f in dest_files:
|
|
|
|
print " Replacing file", f
|
|
|
|
dest_files.remove(f)
|
|
|
|
else:
|
|
|
|
print " Creating new file", f
|
|
|
|
copyAction = Copy(os.path.join(dest_dir, f), os.path.join(src_dir, f))
|
|
|
|
copyAction.strfunction = None
|
2009-03-11 18:54:42 +01:00
|
|
|
env.Execute(copyAction)
|
2006-07-19 22:07:25 +02:00
|
|
|
return 0
|
|
|
|
|
|
|
|
def update_test_string(target, source, env):
|
|
|
|
return env.subst("Updating ${SOURCES[0].dir} from ${SOURCES[1].dir}",
|
|
|
|
target=target, source=source)
|
|
|
|
|
|
|
|
updateAction = env.Action(update_test, update_test_string)
|
|
|
|
|
2006-08-16 15:45:46 +02:00
|
|
|
def test_builder(env, ref_dir):
|
|
|
|
"""Define a test."""
|
|
|
|
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
path = list(ref_dir.split('/'))
|
2006-08-16 15:45:46 +02:00
|
|
|
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
# target path (where test output goes) consists of category, mode,
|
|
|
|
# name, isa, opsys, and config (skips the 'ref' component)
|
|
|
|
assert(path.pop(-4) == 'ref')
|
|
|
|
tgt_dir = os.path.join(*path[-6:])
|
2006-08-16 15:45:46 +02:00
|
|
|
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
# local closure for prepending target path to filename
|
2006-08-16 15:45:46 +02:00
|
|
|
def tgt(f):
|
|
|
|
return os.path.join(tgt_dir, f)
|
|
|
|
|
2008-12-08 16:16:40 +01:00
|
|
|
ref_stats = os.path.join(ref_dir, 'stats.txt')
|
|
|
|
new_stats = tgt('stats.txt')
|
2006-08-16 15:45:46 +02:00
|
|
|
status_file = tgt('status')
|
|
|
|
|
2013-10-16 00:22:41 +02:00
|
|
|
env.Command([status_file, new_stats],
|
2009-03-08 01:58:51 +01:00
|
|
|
[env.M5Binary, 'run.py', ref_stats],
|
2006-08-16 15:45:46 +02:00
|
|
|
testAction)
|
|
|
|
|
|
|
|
# phony target to echo status
|
2011-03-04 08:54:31 +01:00
|
|
|
if GetOption('update_ref'):
|
2006-08-16 15:45:46 +02:00
|
|
|
p = env.Command(tgt('_update'),
|
|
|
|
[ref_stats, new_stats, status_file],
|
|
|
|
updateAction)
|
|
|
|
else:
|
|
|
|
p = env.Command(tgt('_print'), [status_file], printAction)
|
2006-07-19 22:07:25 +02:00
|
|
|
|
2006-08-16 15:45:46 +02:00
|
|
|
env.AlwaysBuild(p)
|
2006-07-19 22:07:25 +02:00
|
|
|
|
|
|
|
|
2006-08-16 20:42:44 +02:00
|
|
|
# Figure out applicable configs based on build type
|
|
|
|
configs = []
|
2012-01-28 16:24:45 +01:00
|
|
|
if env['TARGET_ISA'] == 'alpha':
|
|
|
|
configs += ['tsunami-simple-atomic',
|
|
|
|
'tsunami-simple-timing',
|
|
|
|
'tsunami-simple-atomic-dual',
|
|
|
|
'tsunami-simple-timing-dual',
|
|
|
|
'twosys-tsunami-simple-atomic',
|
|
|
|
'tsunami-o3', 'tsunami-o3-dual',
|
2014-07-23 23:09:05 +02:00
|
|
|
'tsunami-minor', 'tsunami-minor-dual',
|
2013-01-07 19:05:52 +01:00
|
|
|
'tsunami-inorder',
|
|
|
|
'tsunami-switcheroo-full']
|
2012-01-28 16:24:45 +01:00
|
|
|
if env['TARGET_ISA'] == 'sparc':
|
|
|
|
configs += ['t1000-simple-atomic',
|
|
|
|
't1000-simple-timing']
|
|
|
|
if env['TARGET_ISA'] == 'arm':
|
2012-03-09 15:59:28 +01:00
|
|
|
configs += ['simple-atomic-dummychecker',
|
|
|
|
'o3-timing-checker',
|
|
|
|
'realview-simple-atomic',
|
2012-01-28 16:24:45 +01:00
|
|
|
'realview-simple-atomic-dual',
|
|
|
|
'realview-simple-timing',
|
|
|
|
'realview-simple-timing-dual',
|
|
|
|
'realview-o3',
|
2012-03-09 15:59:28 +01:00
|
|
|
'realview-o3-checker',
|
2013-01-07 19:05:52 +01:00
|
|
|
'realview-o3-dual',
|
2014-07-23 23:09:05 +02:00
|
|
|
'realview-minor',
|
|
|
|
'realview-minor-dual',
|
2013-01-07 19:05:52 +01:00
|
|
|
'realview-switcheroo-atomic',
|
|
|
|
'realview-switcheroo-timing',
|
|
|
|
'realview-switcheroo-o3',
|
|
|
|
'realview-switcheroo-full']
|
2012-01-28 16:24:45 +01:00
|
|
|
if env['TARGET_ISA'] == 'x86':
|
|
|
|
configs += ['pc-simple-atomic',
|
|
|
|
'pc-simple-timing',
|
2013-04-23 07:03:09 +02:00
|
|
|
'pc-o3-timing',
|
|
|
|
'pc-switcheroo-full']
|
2012-01-28 16:24:45 +01:00
|
|
|
|
2014-07-23 23:09:05 +02:00
|
|
|
configs += ['simple-atomic', 'simple-atomic-mp',
|
|
|
|
'simple-timing', 'simple-timing-mp',
|
|
|
|
'inorder-timing',
|
|
|
|
'minor-timing', 'minor-timing-mp',
|
|
|
|
'o3-timing', 'o3-timing-mp',
|
|
|
|
'rubytest', 'memtest',
|
|
|
|
'tgen-simple-mem', 'tgen-dram-ctrl']
|
2006-08-16 20:42:44 +02:00
|
|
|
|
2011-08-08 17:50:13 +02:00
|
|
|
if env['PROTOCOL'] != 'None':
|
2010-01-30 05:29:40 +01:00
|
|
|
if env['PROTOCOL'] == 'MI_example':
|
|
|
|
configs += [c + "-ruby" for c in configs]
|
|
|
|
else:
|
|
|
|
configs = [c + "-ruby-" + env['PROTOCOL'] for c in configs]
|
2009-05-11 19:38:46 +02:00
|
|
|
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
src = Dir('.').srcdir
|
2006-08-16 20:42:44 +02:00
|
|
|
for config in configs:
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
dirs = src.glob('*/*/*/ref/%s/*/%s' % (env['TARGET_ISA'], config))
|
2006-08-16 15:45:46 +02:00
|
|
|
for d in dirs:
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
d = str(d)
|
2009-07-07 07:45:58 +02:00
|
|
|
if not os.path.exists(os.path.join(d, 'skip')):
|
|
|
|
test_builder(env, d)
|