-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements and fixes #1
base: gottagofast
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,19 +7,27 @@ | |
import subprocess | ||
import tempfile | ||
from collections import defaultdict | ||
from enum import Flag | ||
from enum import IntFlag | ||
from functools import partial | ||
|
||
from elftools.elf.elffile import ELFFile | ||
from elftools.elf.sections import SymbolTableSection | ||
from tqdm.contrib.concurrent import process_map | ||
|
||
|
||
class KeepLogType(Flag): | ||
class KeepLogType(IntFlag): | ||
NONE = 0 | ||
STDOUT = 1 | ||
STDERR = 2 | ||
BOTH = 3 | ||
BOTH = STDOUT | STDERR | ||
|
||
|
||
class TraceMode(IntFlag): | ||
NONE = 0 | ||
INSTR = 1 | ||
MEM = 2 | ||
BOTH = INSTR | MEM | ||
|
||
|
||
ETISS_CFG = """[StringConfigurations] | ||
vp.elf_file={test_file} | ||
|
@@ -33,8 +41,8 @@ class KeepLogType(Flag): | |
etiss.max_block_size=500 | ||
|
||
[BoolConfigurations] | ||
simple_mem_system.print_dbus_access=true | ||
jit.debug=true | ||
{trace_mem_enable}simple_mem_system.print_dbus_access=true | ||
{debug_jit_disable}jit.debug=false | ||
jit.gcc.cleanup=true | ||
jit.verify=false | ||
etiss.exit_on_loop={exit_on_loop} | ||
|
@@ -44,7 +52,7 @@ class KeepLogType(Flag): | |
plugin.filelogger.logmask=0xFFFFFFFF | ||
plugin.filelogger.terminate_on_write=true | ||
|
||
{trace_enable}[Plugin PrintInstruction] | ||
{trace_instr_enable}[Plugin PrintInstruction] | ||
""" | ||
|
||
|
||
|
@@ -100,6 +108,8 @@ def run_test(test_args: "tuple[pathlib.Path, str, pathlib.Path]", args): | |
test_addrs[symbol.entry["st_value"]] = symbol.name | ||
|
||
fname = (results_path / "config" / test_file.stem).with_suffix(".ini") | ||
if args.debug_jit: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say this is not a problem to be solved here, LLVMJIT is rarely used anyways. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can drop the assertion warning, but we need a way to disable the jit_debug because otherwise it wouldn’t be possible to run the tests against the LLVMJIT. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does LLVMJIT complain when this option is set? from what I see here https://github.com/tum-ei-eda/etiss/blob/b24bc484d1498d6cdc4587a4dbd246adce0e5f26/JITImpl/LLVM/src/LLVMJIT.cpp#L219 debug should be supported just fine... |
||
assert args.jit != "llvm", "LLVMJIT does not support debug mode" | ||
with open(fname, "w") as f: | ||
f.write( | ||
ETISS_CFG.format( | ||
|
@@ -108,7 +118,9 @@ def run_test(test_args: "tuple[pathlib.Path, str, pathlib.Path]", args): | |
arch=arch, | ||
logaddr=logaddr, | ||
jit=args.jit.upper(), | ||
trace_enable="" if args.trace else ";", | ||
trace_instr_enable="" if args.trace & TraceMode.INSTR else ";", | ||
trace_mem_enable="" if args.trace & TraceMode.MEM else ";", | ||
debug_jit_disable="" if not args.debug_jit else ";", | ||
exit_on_loop=str(args.exit_on_loop) | ||
) | ||
) | ||
|
@@ -151,12 +163,14 @@ def main(): | |
p.add_argument("--timeout", default=10, type=int, help="Timeout to complete a test run, exceeding the timeout marks the test as failed.") | ||
p.add_argument("-j", "--threads", type=int, help="Number of parallel threads to start. Assume CPU core count if no value is provided.") | ||
p.add_argument("--jit", choices=["tcc", "gcc", "llvm"], default="tcc", help="Which ETISS JIT compiler to use.") | ||
p.add_argument("--keep-output", choices=[x.name.lower() for x in KeepLogType], default=KeepLogType.NONE.name.lower(), help="Save ETISS stdout/stderr to files") | ||
p.add_argument("--trace", action="store_true", help="Generate an instruction trace. Helpful for debugging.") | ||
p.add_argument("--keep-output", choices=[x.name.lower() for x in KeepLogType] + ["both"], default=KeepLogType.NONE.name.lower(), help="Save ETISS stdout/stderr to files") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest implementing this iteration with the |
||
p.add_argument("--trace", choices=["none", "instr", "mem", "both"], default=TraceMode.NONE.name.lower(), help="Generate an instr/mem trace. Helpful for debugging.") | ||
p.add_argument("--debug-jit", action="store_true", help="Enable jit.debug (gcc/tcc jit only)") | ||
p.add_argument("--exit-on-loop", action="store_true", help="Instruct the simulator to terminate when a loop-to-self instruction sequence is detected.") | ||
|
||
args = p.parse_args() | ||
args.keep_output = KeepLogType[args.keep_output.upper()] | ||
args.trace = TraceMode[args.trace.upper()] | ||
|
||
begin = datetime.datetime.now().strftime("%y%m%d_%H%M%S") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the change to
IntFlag
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I though pt that it would be more convenient, as it also allows
x & KeepLogType.STDERR
if x is and int, but since we convert the arguments toKeepLogType
anyways it has no real benefit.