[gem5-dev] Change in gem5/gem5[develop]: cpu-o3: Fix missing overrides
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/44405 ) Change subject: cpu-o3: Fix missing overrides .. cpu-o3: Fix missing overrides Fix missing overrides in SimpleTrace. Change-Id: I82ed2a10c98ea67dde7b99db13c0ad5d9ed96f0f Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44405 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro --- M src/cpu/o3/probe/simple_trace.hh 1 file changed, 6 insertions(+), 2 deletions(-) Approvals: Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/cpu/o3/probe/simple_trace.hh b/src/cpu/o3/probe/simple_trace.hh index 45f85a9..e73779a 100644 --- a/src/cpu/o3/probe/simple_trace.hh +++ b/src/cpu/o3/probe/simple_trace.hh @@ -59,10 +59,14 @@ } /** Register the probe listeners. */ -void regProbeListeners(); +void regProbeListeners() override; /** Returns the name of the trace. */ -const std::string name() const { return ProbeListenerObject::name() + ".trace"; } +const std::string +name() const override +{ +return ProbeListenerObject::name() + ".trace"; +} private: void traceFetch(const O3CPUImpl::DynInstConstPtr& dynInst); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44405 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I82ed2a10c98ea67dde7b99db13c0ad5d9ed96f0f Gerrit-Change-Number: 44405 Gerrit-PatchSet: 3 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: util: Add missing parameter for print_insts
Hoa Nguyen has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/8 ) Change subject: util: Add missing parameter for print_insts .. util: Add missing parameter for print_insts JIRA: https://gem5.atlassian.net/browse/GEM5-949 Change-Id: I74fe7adc06124d193f17d682882766484ac18528 Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/8 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- M util/o3-pipeview.py 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/util/o3-pipeview.py b/util/o3-pipeview.py index 11e86a7..630c536 100755 --- a/util/o3-pipeview.py +++ b/util/o3-pipeview.py @@ -129,7 +129,8 @@ if fields[1] == 'fetch': if ((stop_tick > 0 and int(fields[2]) > stop_tick+insts['tick_drift']) or (stop_sn > 0 and int(fields[5]) > (stop_sn+insts['max_threshold']))): -print_insts(outfile, cycle_time, width, color, timestamps, 0) +print_insts(outfile, cycle_time, width, color, timestamps, +store_completions, 0) return (curr_inst['pc'], curr_inst['upc']) = fields[3:5] curr_inst['sn'] = int(fields[5]) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/8 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I74fe7adc06124d193f17d682882766484ac18528 Gerrit-Change-Number: 8 Gerrit-PatchSet: 2 Gerrit-Owner: Hoa Nguyen Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Hoa Nguyen Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: util: Make o3-pipeview Python3 compatible
Hoa Nguyen has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/7 ) Change subject: util: Make o3-pipeview Python3 compatible .. util: Make o3-pipeview Python3 compatible JIRA: https://gem5.atlassian.net/browse/GEM5-955 Change-Id: I48cb0bfb784eafe2057eb1095e6aad7abf9a1bc9 Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/7 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- M util/o3-pipeview.py 1 file changed, 6 insertions(+), 9 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/util/o3-pipeview.py b/util/o3-pipeview.py index 2401e8f..11e86a7 100755 --- a/util/o3-pipeview.py +++ b/util/o3-pipeview.py @@ -148,10 +148,6 @@ fields = line.split(':') -#Sorts out instructions according to sequence number -def compare_by_sn(a, b): -return cmp(a['sn'], b['sn']) - # Puts new instruction into the print queue. # Sorts out and prints instructions when their number reaches threshold value def queue_inst(outfile, inst, cycle_time, width, color, timestamps, store_completions): @@ -164,7 +160,8 @@ # Sorts out and prints instructions in print queue def print_insts(outfile, cycle_time, width, color, timestamps, store_completions, lower_threshold): global insts -insts['queue'].sort(compare_by_sn) +# sort the list of insts by sequence numbers +insts['queue'].sort(key=lambda inst: inst['sn']) while len(insts['queue']) > lower_threshold: print_item=insts['queue'].pop(0) # As the instructions are processed out of order the main loop starts @@ -223,7 +220,7 @@ # Print time_width = width * cycle_time -base_tick = (inst['fetch'] / time_width) * time_width +base_tick = (inst['fetch'] // time_width) * time_width # Find out the time of the last event - it may not # be 'retire' if the instruction is not comlpeted. @@ -237,7 +234,7 @@ if ((last_event_time - inst['fetch']) < time_width): num_lines = 1 # compact form else: -num_lines = ((last_event_time - base_tick) / time_width) + 1 +num_lines = ((last_event_time - base_tick) // time_width) + 1 curr_color = termcap.Normal @@ -267,7 +264,7 @@ if (stages[event[2]]['name'] == 'dispatch' and inst['dispatch'] == inst['issue']): continue -outfile.write(curr_color + dot * ((event[0] / cycle_time) - pos)) +outfile.write(curr_color + dot * ((event[0] // cycle_time) - pos)) outfile.write(stages[event[2]]['color'] + stages[event[2]]['shorthand']) @@ -276,7 +273,7 @@ else: curr_color = termcap.Normal -pos = (event[0] / cycle_time) + 1 +pos = (event[0] // cycle_time) + 1 outfile.write(curr_color + dot * (width - pos) + termcap.Normal + ']-(' + str(base_tick + i * time_width).rjust(15) + ') ') if i == 0: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/7 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I48cb0bfb784eafe2057eb1095e6aad7abf9a1bc9 Gerrit-Change-Number: 7 Gerrit-PatchSet: 4 Gerrit-Owner: Hoa Nguyen Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Hoa Nguyen Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: util: Fix checkpoint-tester.py checkpoint parameter
Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/9 ) Change subject: util: Fix checkpoint-tester.py checkpoint parameter .. util: Fix checkpoint-tester.py checkpoint parameter Previously, the inputs to `--take-checkpoints X,Y` was `(interval, interval)` with attention to restore the N^th checkpoint and to run the simulation for `interval` ticks. Currently, the parameter `X` is the starting tick of the simulation, while `Y` is the number of ticks to be simulated after tick `X`. Therefore, `X` should be the starting tick of the N^th checkpont. Change-Id: I1fd7c91c9454f42a4fb98aa878fb5e4ac7d238f3 Signed-off-by: Hoa Nguyen --- M util/checkpoint-tester.py 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/checkpoint-tester.py b/util/checkpoint-tester.py index e2051cd..7b37c0d 100755 --- a/util/checkpoint-tester.py +++ b/util/checkpoint-tester.py @@ -93,12 +93,12 @@ options = args[1:] -initial_args = ['--take-checkpoints', '%d,%d' % (interval, interval)] +checkpoint_args = ['--take-checkpoints', '%d,%d' % (interval, interval)] cptdir = os.path.join(top_dir, 'm5out') print('===> Running initial simulation.') -subprocess.call([m5_binary] + ['-red', cptdir] + options + initial_args) +subprocess.call([m5_binary] + ['-red', cptdir] + options + checkpoint_args) dirs = os.listdir(cptdir) expr = re.compile('cpt\.([0-9]*)') @@ -116,8 +116,9 @@ # less than tha number of checkpoints. for i in range(1, len(cpts)): print('===> Running test %d of %d.' % (i, len(cpts)-1)) +checkpoint_args = ['--take-checkpoints', '%d,%d' % (cpts[i], interval)] mydir = os.path.join(top_dir, 'test.%d' % i) -subprocess.call([m5_binary] + ['-red', mydir] + options + initial_args + +subprocess.call([m5_binary] + ['-red', mydir] + options + checkpoint_args + ['--max-checkpoints' , '1', '--checkpoint-dir', cptdir, '--checkpoint-restore', str(i)]) cpt_name = 'cpt.%d' % cpts[i] -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/9 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I1fd7c91c9454f42a4fb98aa878fb5e4ac7d238f3 Gerrit-Change-Number: 9 Gerrit-PatchSet: 1 Gerrit-Owner: Hoa Nguyen Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: tests: Define a MatchFileRegex verifier
Giacomo Travaglini has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/5 ) Change subject: tests: Define a MatchFileRegex verifier .. tests: Define a MatchFileRegex verifier Using it as a base class for MatchRegex. While the latter is using a regex to scan the stdout and stderr files, MatchFileRegex is more generically allowing you to specify which file to scan at __init__ time. Signed-off-by: Giacomo Travaglini Change-Id: I2a64dab9c88a632b0a6b400ba02aafe473b3e62d Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/5 Reviewed-by: Daniel Carvalho Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- M tests/gem5/verifier.py 1 file changed, 43 insertions(+), 18 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved Daniel Carvalho: Looks good to me, approved kokoro: Regressions pass diff --git a/tests/gem5/verifier.py b/tests/gem5/verifier.py index 60d44f3..b539a67 100644 --- a/tests/gem5/verifier.py +++ b/tests/gem5/verifier.py @@ -1,3 +1,15 @@ +# Copyright (c) 2021 Arm Limited +# All rights reserved +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# unmodified and in its entirety in all distributions of the software, +# modified or unmodified, in source code or in binary form. +# # Copyright (c) 2017 Mark D. Hill and David A. Wood # All rights reserved. # @@ -161,34 +173,47 @@ re.compile(r'''^\s*"(cwd|input|codefile)":'''), ) -class MatchRegex(Verifier): -def __init__(self, regex, match_stderr=True, match_stdout=True): -super(MatchRegex, self).__init__() +class MatchFileRegex(Verifier): +""" +Looking for a match between a regex pattern and the content of a list +of files. Verifier will pass as long as the pattern is found in at least +one of the files. +""" +def __init__(self, regex, filenames): +super(MatchFileRegex, self).__init__() self.regex = _iterable_regex(regex) -self.match_stderr = match_stderr -self.match_stdout = match_stdout +self.filenames = filenames + +def parse_file(self, fname): +with open(fname, 'r') as file_: +for line in file_: +for regex in self.regex: +if re.match(regex, line): +return True def test(self, params): fixtures = params.fixtures # Get the file from the tempdir of the test. tempdir = fixtures[constants.tempdir_fixture_name].path -def parse_file(fname): -with open(fname, 'r') as file_: -for line in file_: -for regex in self.regex: -if re.match(regex, line): -return True -if self.match_stdout: -if parse_file(joinpath(tempdir, - constants.gem5_simulation_stdout)): +for fname in self.filenames: +if self.parse_file(joinpath(tempdir, fname)): return # Success -if self.match_stderr: -if parse_file(joinpath(tempdir, - constants.gem5_simulation_stderr)): -return # Success + test_util.fail('Could not match regex.') +class MatchRegex(MatchFileRegex): +""" +Looking for a match between a regex pattern and stdout/stderr. +""" +def __init__(self, regex, match_stderr=True, match_stdout=True): +filenames = list() +if match_stdout: +filenames.append(constants.gem5_simulation_stdout) +if match_stderr: +filenames.append(constants.gem5_simulation_stderr) +super(MatchRegex, self).__init__(regex, filenames) + _re_type = type(re.compile('')) def _iterable_regex(regex): if isinstance(regex, _re_type) or isinstance(regex, str): -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/5 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I2a64dab9c88a632b0a6b400ba02aafe473b3e62d Gerrit-Change-Number: 5 Gerrit-PatchSet: 2 Gerrit-Owner: Giacomo Travaglini Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev
[gem5-dev] Change in gem5/gem5[develop]: systemc: Eliminate ClockTick duplicated name warning
Yu-hsin Wang has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/44425 ) Change subject: systemc: Eliminate ClockTick duplicated name warning .. systemc: Eliminate ClockTick duplicated name warning In systemc, a module name is consist of hierarchy names with dot separated. The basename is the last part of the module name. Because lack of hierarchy information, it's a chance that the basename is duplicated. Although, ClockTick is using sc_gen_unique_name to solve this, the warning from sc_gen_unique_name is annoying. To solve this completely, we should use the full module name to construct the name of ClockTick. Change-Id: Ie664fe4757a05f72860be49c3a9d1172f824eb2e Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44425 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- M src/systemc/channel/sc_clock.cc 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/systemc/channel/sc_clock.cc b/src/systemc/channel/sc_clock.cc index 137a7a1..bf48b82 100644 --- a/src/systemc/channel/sc_clock.cc +++ b/src/systemc/channel/sc_clock.cc @@ -54,7 +54,7 @@ ClockTick(::sc_core::sc_clock *clock, bool to, ::sc_core::sc_time _period) : ScEvent([this]() { tick(); }), -_period(_period), name(clock->basename()), p(nullptr), +_period(_period), name(clock->name()), p(nullptr), funcWrapper(clock, to ? &::sc_core::sc_clock::tickUp : &::sc_core::sc_clock::tickDown) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44425 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: Ie664fe4757a05f72860be49c3a9d1172f824eb2e Gerrit-Change-Number: 44425 Gerrit-PatchSet: 4 Gerrit-Owner: Yu-hsin Wang Gerrit-Reviewer: Earl Ou Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jui-min Lee Gerrit-Reviewer: Yu-hsin Wang Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: systemc: Fix verify.py and make it python 3 compatible
Yu-hsin Wang has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/44465 ) Change subject: systemc: Fix verify.py and make it python 3 compatible .. systemc: Fix verify.py and make it python 3 compatible 1. The logger behavior change breaks verify.py. commit 8deb205ea10d6cee0b58c46e097be46c784ed345 Author: Daniel Carvalho Date: Wed Mar 3 16:49:05 2021 -0300 base: Add LOC to Loggers Printing the line and the file that triggered a log is useful for debugging. Change-Id: I74e0637b2943049134bd3e9a4bc6cab3766591a9 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42141 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro 2. Use bytes diff in LogChecker. In Python3, string is required to be in a certain encoding, while in Python2, it is not. In the testcase, misc/cae_test/general/bitwise/or/datatypes, it contains some invalid codepoint of utf-8, we need diff the log with bytes in Pyhton3. 3. Python3 compatible. * dict.iteritems -> dict.items * remove object base class * use `except as` when catching exceptions * handle map and filter behavior change Test with src/systemc/tests/verify.py --update-json build/ARM -j `nproc` \ --filter-file src/systemc/tests/working.filt src/systemc/tests/verify.py --update-json build/ARM -j `nproc` \ --filter-file src/systemc/tests/working.filt --phase verify --result-file Change-Id: Ibf5b99d08a948387cf6162c476c294c49a7dac0f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44465 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- M src/systemc/tests/verify.py 1 file changed, 47 insertions(+), 30 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 6b4cf5c..95812f4 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # # Copyright 2018 Google, Inc. # @@ -58,14 +58,14 @@ -class Test(object): +class Test(): def __init__(self, target, suffix, build_dir, props): self.target = target self.suffix = suffix self.build_dir = build_dir self.props = {} -for key, val in props.iteritems(): +for key, val in props.items(): self.set_prop(key, val) def set_prop(self, key, val): @@ -107,7 +107,7 @@ super(TestPhaseMeta, cls).__init__(name, bases, d) -class TestPhaseBase(object, metaclass=TestPhaseMeta): +class TestPhaseBase(metaclass=TestPhaseMeta): abstract = True def __init__(self, main_args, *args): @@ -169,7 +169,7 @@ os.makedirs(test.m5out_dir()) try: subprocess.check_call(cmd, cwd=os.path.dirname(test.dir())) -except subprocess.CalledProcessError, error: +except subprocess.CalledProcessError as error: returncode = error.returncode else: returncode = 0 @@ -180,14 +180,14 @@ runnable = filter(lambda t: not t.compile_only, tests) if j == 1: -map(run_test, runnable) +list(map(run_test, runnable)) else: tp = multiprocessing.pool.ThreadPool(j) -map(lambda t: tp.apply_async(run_test, (t,)), runnable) +list(map(lambda t: tp.apply_async(run_test, (t,)), runnable)) tp.close() tp.join() -class Checker(object): +class Checker(): def __init__(self, ref, test, tag): self.ref = ref self.test = test @@ -215,6 +215,13 @@ super(DiffingChecker, self).__init__(ref, test, tag) self.out_dir = out_dir +def is_bytes_mode(self): +return False + +def do_diff(self, ref_lines, test_lines, ref_file, test_file): +return difflib.unified_diff(ref_lines, test_lines, +fromfile=ref_file, tofile=test_file) + def diffing_check(self, ref_lines, test_lines): test_file = os.path.basename(self.test) ref_file = os.path.basename(self.ref) @@ -222,11 +229,10 @@ diff_file = '.'.join([ref_file, 'diff']) diff_path = os.path.join(self.out_dir, diff_file) if test_lines != ref_lines: -with open(diff_path, 'w') as diff_f: -for line in difflib.unified_diff( -ref_lines, test_lines, -fromfile=ref_file, -tofile=test_file): +flag = 'wb' if self.is_bytes_mode() else 'w' +with open(diff_file, flag) as diff_f: +for line in self.do_diff(ref_lines, test_lines, + ref_file, test_file):