Repository navigation
pretty printing #549
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
Merged
TApplencourt
merged 13 commits into
argonne-lcf:devel
from
DonAurelio:pytorch-pretty-print
Oct 14, 2026
Merged
pretty printing #549
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
293e7ea
pretty printing
DonAurelio 1892683
Remove unnecessary line break in gen_babeltrace_pytorch_lib.rb
DonAurelio 1344d77
tests
DonAurelio 723d920
tests
DonAurelio 2b4fc7c
remove old versions
DonAurelio 3a6d22e
rename test to follow Nathan naming convention
DonAurelio ed9ca86
rename test to follow Nathan naming convention
DonAurelio 124812d
Fix Non LIFO order validation, and add tests; add reentracy tests
DonAurelio b2ae099
Use btx_model from the source dir in place of build dir
DonAurelio dc828d0
Update text for valid timestamp values
DonAurelio 0e82b60
update timestamps
DonAurelio 268eb7c
Merge branch 'argonne-lcf:devel' into pytorch-pretty-print
DonAurelio b9cdd59
remove non-LIFO exit order test
DonAurelio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| require_relative '../../utils/gen_babeltrace_lib_helper' | ||
| add_babeltrace_event_callbacks(nil, File.join(SRC_DIR, 'btx_pytorch_model.yaml')) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # PyTorch Backend Tests | ||
|
|
||
| | Test | Feature | Description | | ||
| |------|---------|-------------| | ||
| | **basic_op_name-AA** | Basic tracing | Validates tracing of a simple PyTorch operation with empty overload name. | | ||
| | **basic_op_overload_name-AA** | Overload name handling | Validates that operations with overload names create qualified names (e.g., `aten::add.Tensor`). | | ||
| | **nested_ops_simple-ABBA** | LIFO stack (ABBA) | Validates LIFO stack correctly matches nested operations in ABBA order (outer→inner→inner exit→outer exit). | | ||
| | **deeply_nested_ops-ABCCBA** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | | ||
| | **multithreaded_ops-AABB** | Per-thread isolation | Validates each thread maintains its own independent LIFO stack without cross-thread interference. | | ||
| | **reentrant_op-AAAA** | Reentrancy | Validates the LIFO stack correctly handles the same op re-entering itself (aten::norm.Scalar calling aten::norm.Scalar internally). | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 1000000000, err = false } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::relu", overload_name: "" } | ||
| 12:00:01.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } |
1 change: 1 addition & 0 deletions
1
backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 1000000000, err = false } |
2 changes: 2 additions & 0 deletions
2
backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::add", overload_name: "Tensor" } | ||
| 12:00:01.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } |
3 changes: 3 additions & 0 deletions
3
backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110402000000000, backend = 10 }, { name = "aten::mm", dur = 1000000000, err = false } | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110401000000000, backend = 10 }, { name = "aten::matmul", dur = 3000000000, err = false } | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::addmm", dur = 5000000000, err = false } |
6 changes: 6 additions & 0 deletions
6
backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| 12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::addmm", overload_name: "" } | ||
| 12:00:01.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::matmul", overload_name: "" } | ||
| 12:00:02.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mm", overload_name: "" } | ||
| 12:00:03.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mm", overload_name: "" } | ||
| 12:00:04.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } | ||
| 12:00:05.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::addmm", overload_name: "" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::sigmoid", dur = 0, err = true } |
2 changes: 2 additions & 0 deletions
2
backends/pytorch/tests/exit_without_entry-A.thapi_text_pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::sigmoid", overload_name: "" } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 1000000000, err = false } | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 2, ts = 1704110400000000000, backend = 10 }, { name = "aten::tanh", dur = 2000000000, err = false } |
4 changes: 4 additions & 0 deletions
4
backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::relu", overload_name: "" } | ||
| 12:00:00.000000000 - testhost - vpid: 1, vtid: 2 - lttng_ust_pytorch:op_entry: { name: "aten::tanh", overload_name: "" } | ||
| 12:00:01.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } | ||
| 12:00:02.000000000 - testhost - vpid: 1, vtid: 2 - lttng_ust_pytorch:op_exit: { name: "aten::tanh", overload_name: "" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110401000000000, backend = 10 }, { name = "aten::matmul", dur = 1000000000, err = false } | ||
| lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::linear", dur = 3000000000, err = false } |
4 changes: 4 additions & 0 deletions
4
backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::linear", overload_name: "" } | ||
| 12:00:01.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::matmul", overload_name: "" } | ||
| 12:00:02.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } | ||
| 12:00:03.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::linear", overload_name: "" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110401000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 1000000000, err = false } | ||
| lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 3000000000, err = false } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::norm", overload_name: "Scalar" } | ||
| 12:00:01.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::norm", overload_name: "Scalar" } | ||
| 12:00:02.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::norm", overload_name: "Scalar" } | ||
| 12:00:03.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::norm", overload_name: "Scalar" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,16 @@ | ||
| bats_require_minimum_version 1.5.0 | ||
|
|
||
| @test "PyTorch: trace contains aten::empty.memory_format" { | ||
| @test "PyTorch: tally contains aten::empty.memory_format" { | ||
| iprof --backends pytorch --analysis-output ./pytorch_out.txt -- \ | ||
| python3 ./integration_tests/pytorch_example.py | ||
| grep "aten::empty.memory_format" ./pytorch_out.txt | ||
| } | ||
|
|
||
| @test "PyTorch: trace (-t) contains pretty-printed op_entry/op_exit events" { | ||
| iprof --backends pytorch -t --analysis-output ./pytorch_trace_out.txt -- \ | ||
| python3 ./integration_tests/pytorch_example.py | ||
| grep "lttng_ust_pytorch:op_entry" ./pytorch_trace_out.txt | ||
| grep "lttng_ust_pytorch:op_exit" ./pytorch_trace_out.txt | ||
| grep 'name: "aten::empty' ./pytorch_trace_out.txt | ||
| grep 'overload_name: "memory_format' ./pytorch_trace_out.txt | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.