Skip to content

Commit

Permalink
xls/dslx/interpreter_main: default compare to none
Browse files Browse the repository at this point in the history
- default flag to "none"
- update doc

PiperOrigin-RevId: 669232425
  • Loading branch information
proppy authored and copybara-github committed Aug 30, 2024
1 parent 7d6274f commit 6d4f276
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs_src/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ BOM_KIND_COMPARISON,ne,25,1,1
Interpreter for DSLX code and test-runner.
When tests are run this also cross-checks that the conversion to IR and JIT
compilation of the IR produces the same values.
The `--compare` flag allows to also cross-checks that the conversion to IR and
JIT compilation of the IR produces the same values.
```
$ bazel run -c opt //xls/dslx:interpreter_main -- $PWD/xls/dslx/stdlib/std.x
Expand Down
2 changes: 1 addition & 1 deletion xls/dslx/interpreter_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ABSL_FLAG(
"`trace!`, `{}` format strings in `trace_fmt!`, traced channel values, "
"`assert_*` statements and elsewhere. Valid values: binary|hex|decimal");
ABSL_FLAG(bool, execute, true, "Execute tests within the entry module.");
ABSL_FLAG(std::string, compare, "jit",
ABSL_FLAG(std::string, compare, "none",
"Compare DSL-interpreted results with an IR execution for each"
" function for consistency checking; options: none|jit|interpreter.");
ABSL_FLAG(
Expand Down
6 changes: 6 additions & 0 deletions xls/dslx/tests/errors/error_modules_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def _run(
path_is_runfile: bool = True,
alsologtostderr: bool = False,
*,
compare: Optional[
str
] = 'jit', # default on comparing to catch IR onversion and JIT errors.
enable_warnings: Optional[Set[str]] = None,
) -> str:
cmd = [
Expand All @@ -44,6 +47,9 @@ def _run(
'--warnings_as_errors={}'.format(str(warnings_as_errors).lower()),
]

if compare:
cmd.append('--compare=' + compare)

if enable_warnings:
cmd.append('--enable_warnings=' + ','.join(sorted(enable_warnings)))

Expand Down

0 comments on commit 6d4f276

Please sign in to comment.