Skip to content

Conversation

@meheff
Copy link
Collaborator

@meheff meheff commented Sep 12, 2025

The newly defined DslxInterpreterEvents gathers assert and trace messages from the DSLX interpreter replacing the previous trace hook mechanism. It stores information in the same proto as the IR interpreter does which enables easier comparison of behavior between the interpreters and the sharing of tools. Also augment the proto with additional information like source information.

Also add a utility dump_call_trace which reads an events proto and prints a structured trace of the calls.

};

// Create a results proto if requested and plumb it through options.
xls::EvaluatorResultsProto results_proto;
Copy link
Member

Choose a reason for hiding this comment

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

yay structured logs \o/

@proppy proppy requested a review from richmckeever October 7, 2025 06:18
@meheff meheff force-pushed the meheff/2025-08-29-dslx-call-trace branch from cf36eee to bd7bdf3 Compare October 7, 2025 17:03
@meheff
Copy link
Collaborator Author

meheff commented Oct 15, 2025

Any progress on this? Thanks.

@proppy
Copy link
Member

proppy commented Oct 15, 2025

@richmckeever: ping for review ?
adding @cdleary too.

@proppy proppy requested a review from cdleary October 15, 2025 15:49
@ericastor
Copy link
Contributor

@meheff Please rebase this when you can; we can't pull it in for final review until conflicts are resolved.

@meheff meheff force-pushed the meheff/2025-08-29-dslx-call-trace branch from bd7bdf3 to f4868dd Compare November 5, 2025 22:30
@meheff
Copy link
Collaborator Author

meheff commented Nov 5, 2025

Rebased to head... and changed my notifications for the XLS repo to my personal email account as I kept missing responses on my PRs (my work email might as well be /dev/null).

Copy link
Contributor

@ericastor ericastor left a comment

Choose a reason for hiding this comment

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

Approving to try to kick off the import.

@mikex-oss
Copy link
Collaborator

@meheff sorry, I missed this. Can you please add Apache license headers? The migration is failing with:

error: Error validating 'verify_match 'Licensed under the Apache
License, Version 2.0'': xls/dev_tools/dump_call_trace.cc - Expected string
was not present.

Error validating 'verify_match 'Licensed under the Apache License, Version
2.0'': xls/dev_tools/dump_call_trace_test.py - Expected string was not
present.

@meheff meheff force-pushed the meheff/2025-08-29-dslx-call-trace branch from f4868dd to c22d749 Compare November 7, 2025 23:54
@meheff
Copy link
Collaborator Author

meheff commented Nov 7, 2025

Added licenses.

Copy link
Collaborator

@mikex-oss mikex-oss left a comment

Choose a reason for hiding this comment

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

@meheff I tried patching this internally (most of the comments are just FYI), but I don't actually know why the tests have different start indices. Any ideas?

],
)

py_test(
Copy link
Collaborator

@mikex-oss mikex-oss Nov 8, 2025

Choose a reason for hiding this comment

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

For future reference, please ensure you load py_test from rules_python, as the builtin is deprecated.

You can also use pytype_strict_contrib_test from https://github.com/google/xls/blob/main/xls/build_rules/py_oss_defs.bzl, which might make sense here, since you added type annotations in the test file.

from typing import List

from absl.testing import absltest
from textwrap import dedent
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI, this causes an error in the internal linter. Don't import functions.

http://google.github.io/styleguide/pyguide.html#22-imports

out = _run_dump(path)
dslx = self._proto_path('prog.x')
expected = dedent(f"""
{dslx}:6:0: call_trace_test(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm this is failing internally.

AssertionError: 
- /tmp/tmpu3fpyo24/prog.x:5:0: call_trace_test(
?                         ^
+ /tmp/tmpu3fpyo24/prog.x:6:0: call_trace_test(
?                         ^

Haven't looked more closely.

out = _run_dump(out_path)
dslx = self._proto_path('prog.x')
expected = dedent(f"""
{dslx}:4:0: for_loop_inside_test(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar here:

AssertionError:

  • /tmp/tmp1n5rbetg/prog.x:3:0: for_loop_inside_test(
    ? ^
  • /tmp/tmp1n5rbetg/prog.x:4:0: for_loop_inside_test(
    ? ^

import os
import subprocess
import tempfile
from typing import List
Copy link
Collaborator

Choose a reason for hiding this comment

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

For future reference, this is deprecated, since list works for type annotations.

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
Copy link
Collaborator

Choose a reason for hiding this comment

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

This appears to be unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants