Skip to content
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

Open
wants to merge 2 commits into
base: gottagofast
Choose a base branch
from
Open

Conversation

PhilippvK
Copy link
Contributor

Summary:

  • Starting with Python v3.12, the behavior of Flag/IntFlag iterators changed. As BOTH = 3 is an alias for STDOUT | STDERR, it will not be included in iterators. Hence we need to add the "both" choice manually to argparse.
  • If ETISS timeouts, the memory trace can get pretty large. Hence I exposed a --trace {instr,mem,both} flag
  • Add --debug-jit flag (Disable by default as LLVM JIT does not support -g?)

@PhilippvK PhilippvK added the enhancement New feature or request label Oct 30, 2024
@PhilippvK PhilippvK self-assigned this Oct 30, 2024
@@ -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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest implementing this iteration with the __members__ property of enums.Flag: https://docs.python.org/3/library/enum.html#enum.EnumType.__members__

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):
Copy link
Collaborator

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?

Copy link
Contributor Author

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 to KeepLogType anyways it has no real benefit.

@@ -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:
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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...

@wysiwyng
Copy link
Collaborator

If ETISS timeouts, the memory trace can get pretty large. Hence I exposed a --trace {instr,mem,both} flag

If ETISS timeouts running tests, from experience the cause is an error handler implemented as loop to self. If tests are known to do that (i.e. rvXXsi-p-dirty), --exit-on-loop will prevent the timeout and throw a proper error. Note however that --exit-on-loop might mask other more severe errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants