From 293e7eaa1b8fdb28fa17b850bab8c89f7aa4f573 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Wed, 30 Sep 2026 13:05:02 +0000 Subject: [PATCH 01/12] pretty printing --- backends/pytorch/Makefile.am | 18 ++++++++++++++++++ backends/pytorch/gen_babeltrace_pytorch_lib.rb | 3 +++ integration_tests/backend_pytorch.bats | 11 ++++++++++- utils/babeltrace_thapi.in | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 backends/pytorch/gen_babeltrace_pytorch_lib.rb diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index 96192d5f2..0f1759cf8 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -112,3 +112,21 @@ libPyTorchInterval_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module bt2dir = $(pkglibdir)/bt2 bt2_LTLIBRARIES = libPyTorchInterval.la + +# +# ---------------------------------------------------------------------- +# Enable pretty.print in babeltrace_thapi +# ---------------------------------------------------------------------- +# + +babeltrace_pytorch_lib.rb: $(srcdir)/gen_babeltrace_pytorch_lib.rb $(top_srcdir)/utils/gen_babeltrace_lib_helper.rb $(top_srcdir)/utils/gen_probe_base.rb $(srcdir)/btx_pytorch_model.yaml + SRC_DIR=$(srcdir) $(RUBY) $< > $@ + +EXTRA_DIST += \ + gen_babeltrace_pytorch_lib.rb + +CLEANFILES += \ + babeltrace_pytorch_lib.rb + +data_DATA = \ + babeltrace_pytorch_lib.rb diff --git a/backends/pytorch/gen_babeltrace_pytorch_lib.rb b/backends/pytorch/gen_babeltrace_pytorch_lib.rb new file mode 100644 index 000000000..97baefc79 --- /dev/null +++ b/backends/pytorch/gen_babeltrace_pytorch_lib.rb @@ -0,0 +1,3 @@ +require_relative '../../utils/gen_babeltrace_lib_helper' + +add_babeltrace_event_callbacks(nil, File.join(SRC_DIR, 'btx_pytorch_model.yaml')) diff --git a/integration_tests/backend_pytorch.bats b/integration_tests/backend_pytorch.bats index fe86d31aa..00f8bfac1 100644 --- a/integration_tests/backend_pytorch.bats +++ b/integration_tests/backend_pytorch.bats @@ -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 +} diff --git a/utils/babeltrace_thapi.in b/utils/babeltrace_thapi.in index 0544b9a7c..f051112f8 100755 --- a/utils/babeltrace_thapi.in +++ b/utils/babeltrace_thapi.in @@ -159,6 +159,7 @@ def get_components(names) require 'babeltrace_cuda_lib' if $options[:'backend-names'].include?('cuda') require 'babeltrace_hip_lib' if $options[:'backend-names'].include?('hip') require 'babeltrace_itt_lib' if $options[:'backend-names'].include?('itt') + require 'babeltrace_pytorch_lib' if $options[:'backend-names'].include?('pytorch') f = lambda { |iterator, _| iterator.next_messages.each do |m| next unless m.type == :BT_MESSAGE_TYPE_EVENT From 18926830daff329946df70fbfbb4d704b911a9d7 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Wed, 30 Sep 2026 08:14:25 -0500 Subject: [PATCH 02/12] Remove unnecessary line break in gen_babeltrace_pytorch_lib.rb --- backends/pytorch/gen_babeltrace_pytorch_lib.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/backends/pytorch/gen_babeltrace_pytorch_lib.rb b/backends/pytorch/gen_babeltrace_pytorch_lib.rb index 97baefc79..ddb0655b6 100644 --- a/backends/pytorch/gen_babeltrace_pytorch_lib.rb +++ b/backends/pytorch/gen_babeltrace_pytorch_lib.rb @@ -1,3 +1,2 @@ require_relative '../../utils/gen_babeltrace_lib_helper' - add_babeltrace_event_callbacks(nil, File.join(SRC_DIR, 'btx_pytorch_model.yaml')) From 1344d77bf7f2118517cd2d695c93c6ca376d1dd3 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 12 Oct 2026 20:46:38 +0000 Subject: [PATCH 03/12] tests --- backends/pytorch/Makefile.am | 54 +++++++++++++++++-- backends/pytorch/tests/README.md | 11 ++++ .../tests/basic_op_name.thapi_text_pretty | 3 ++ .../basic_op_overload_name.thapi_text_pretty | 3 ++ .../tests/deeply_nested_ops.thapi_text_pretty | 7 +++ .../exit_without_entry.thapi_text_pretty | 2 + .../tests/multithreaded_ops.thapi_text_pretty | 5 ++ .../nested_ops_interleaved.thapi_text_pretty | 5 ++ .../tests/nested_ops_simple.thapi_text_pretty | 5 ++ .../pytorch/tests/op_name.thapi_text_pretty | 2 + .../tests/op_overload_name.thapi_text_pretty | 2 + 11 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 backends/pytorch/tests/README.md create mode 100644 backends/pytorch/tests/basic_op_name.thapi_text_pretty create mode 100644 backends/pytorch/tests/basic_op_overload_name.thapi_text_pretty create mode 100644 backends/pytorch/tests/deeply_nested_ops.thapi_text_pretty create mode 100644 backends/pytorch/tests/exit_without_entry.thapi_text_pretty create mode 100644 backends/pytorch/tests/multithreaded_ops.thapi_text_pretty create mode 100644 backends/pytorch/tests/nested_ops_interleaved.thapi_text_pretty create mode 100644 backends/pytorch/tests/nested_ops_simple.thapi_text_pretty create mode 100644 backends/pytorch/tests/op_name.thapi_text_pretty create mode 100644 backends/pytorch/tests/op_overload_name.thapi_text_pretty diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index 0f1759cf8..1d1f4638c 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -41,9 +41,7 @@ CLEANFILES = \ BUILT_SOURCES = \ $(PYTORCH_STATIC_PROBES_INCL) -# Only -ltorch_cpu is needed: at::addGlobalCallback, at::RecordFunction::name -# and at::RecordFuntion::overload_name symbols must be resolved to register -# entry/exit callbacks at load time. +# -ltorch_cpu resolves at::addGlobalCallback, at::RecordFunction::name, at::RecordFuntion::overload_name. DUMMY_TORCH_LIBS = \ dummy_libs/libtorch_cpu.so @@ -130,3 +128,53 @@ CLEANFILES += \ data_DATA = \ babeltrace_pytorch_lib.rb + +# +# ---------------------------------------------------------------------- +# Tests +# ---------------------------------------------------------------------- +# + +TRACE_COMMON = \ + tests/basic_op_name.thapi_text_pretty \ + tests/basic_op_overload_name.thapi_text_pretty \ + tests/nested_ops_simple.thapi_text_pretty \ + tests/nested_ops_interleaved.thapi_text_pretty \ + tests/deeply_nested_ops.thapi_text_pretty \ + tests/exit_without_entry.thapi_text_pretty \ + tests/multithreaded_ops.thapi_text_pretty + +BTX_PYTORCH_GENERATED_SOURCE_TEST = \ + btx_source_pytorch_test/metababel/metababel.h \ + btx_source_pytorch_test/metababel/btx_component.h \ + btx_source_pytorch_test/metababel/btx_component.c \ + btx_source_pytorch_test/metababel/btx_downstream.h \ + btx_source_pytorch_test/metababel/btx_downstream.c \ + btx_source_pytorch_test/btx_main.c + +$(BTX_PYTORCH_GENERATED_SOURCE_TEST) &: btx_pytorch_model.yaml + $(METABABEL) -d btx_pytorch_model.yaml -t SOURCE -o btx_source_pytorch_test -p pytorchtest -c test + +noinst_LTLIBRARIES += libtestpytorchsource.la +nodist_libtestpytorchsource_la_SOURCES = $(BTX_PYTORCH_GENERATED_SOURCE_TEST) +libtestpytorchsource_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I./btx_source_pytorch_test/ +libtestpytorchsource_la_CFLAGS = -fPIC -Wall -Wextra -Wno-unused-parameter $(WERROR) $(BABELTRACE2_CFLAGS) + +TRACE_OUT = $(TRACE_COMMON:.thapi_text_pretty=.bt_text_pretty) + +TESTS = $(TRACE_COMMON) + +TEST_EXTENSIONS = .thapi_text_pretty +THAPI_TEXT_PRETTY_LOG_COMPILER = $(top_builddir)/utils/test_wrapper_thapi_text_pretty.sh +AM_THAPI_TEXT_PRETTY_LOG_FLAGS = backends/pytorch pytorch ./btx_source_pytorch_test/ .libs/libtestpytorchsource.a + +check_DATA = \ + $(TRACE_COMMON) \ + $(TRACE_OUT) + +EXTRA_DIST += \ + $(TRACE_COMMON) \ + $(TRACE_OUT) + +CLEANFILES += \ + $(BTX_PYTORCH_GENERATED_SOURCE_TEST) diff --git a/backends/pytorch/tests/README.md b/backends/pytorch/tests/README.md new file mode 100644 index 000000000..5df867b75 --- /dev/null +++ b/backends/pytorch/tests/README.md @@ -0,0 +1,11 @@ +# PyTorch Backend Tests + +| Test | Feature | Description | +|------|---------|-------------| +| **basic_op_name** | Basic tracing | Validates tracing of a simple PyTorch operation with empty overload name. | +| **basic_op_overload_name** | Overload name handling | Validates that operations with overload names create qualified names (e.g., `aten::add.Tensor`). | +| **nested_ops_simple** | LIFO stack (AABB) | Validates LIFO stack correctly matches nested operations in AABB order (outer→inner→inner exit→outer exit). | +| **nested_ops_interleaved** | LIFO stack error handling (ABAB) | Validates error flag is set when exit events arrive in non-LIFO order (ABAB pattern), testing stack mismatch detection. | +| **deeply_nested_ops** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | +| **exit_without_entry** | Stack underflow | Validates error flag is set when an exit event arrives with no matching entry on the stack. | +| **multithreaded_ops** | Per-thread isolation | Validates each thread maintains its own independent LIFO stack without cross-thread interference. | diff --git a/backends/pytorch/tests/basic_op_name.thapi_text_pretty b/backends/pytorch/tests/basic_op_name.thapi_text_pretty new file mode 100644 index 000000000..74030314b --- /dev/null +++ b/backends/pytorch/tests/basic_op_name.thapi_text_pretty @@ -0,0 +1,3 @@ +12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::relu", overload_name: "" } +12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } + diff --git a/backends/pytorch/tests/basic_op_overload_name.thapi_text_pretty b/backends/pytorch/tests/basic_op_overload_name.thapi_text_pretty new file mode 100644 index 000000000..e2edc8aa6 --- /dev/null +++ b/backends/pytorch/tests/basic_op_overload_name.thapi_text_pretty @@ -0,0 +1,3 @@ +12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::add", overload_name: "Tensor" } +12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } + diff --git a/backends/pytorch/tests/deeply_nested_ops.thapi_text_pretty b/backends/pytorch/tests/deeply_nested_ops.thapi_text_pretty new file mode 100644 index 000000000..1ce419fba --- /dev/null +++ b/backends/pytorch/tests/deeply_nested_ops.thapi_text_pretty @@ -0,0 +1,7 @@ +12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::addmm", overload_name: "" } +12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::matmul", overload_name: "" } +12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mm", overload_name: "" } +12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mm", overload_name: "" } +12:00:00.000000040 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } +12:00:00.000000050 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::addmm", overload_name: "" } + diff --git a/backends/pytorch/tests/exit_without_entry.thapi_text_pretty b/backends/pytorch/tests/exit_without_entry.thapi_text_pretty new file mode 100644 index 000000000..03b5c6d1f --- /dev/null +++ b/backends/pytorch/tests/exit_without_entry.thapi_text_pretty @@ -0,0 +1,2 @@ +12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::sigmoid", overload_name: "" } + diff --git a/backends/pytorch/tests/multithreaded_ops.thapi_text_pretty b/backends/pytorch/tests/multithreaded_ops.thapi_text_pretty new file mode 100644 index 000000000..2c49d75a9 --- /dev/null +++ b/backends/pytorch/tests/multithreaded_ops.thapi_text_pretty @@ -0,0 +1,5 @@ +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:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } +12:00:00.000000020 - testhost - vpid: 1, vtid: 2 - lttng_ust_pytorch:op_exit: { name: "aten::tanh", overload_name: "" } + diff --git a/backends/pytorch/tests/nested_ops_interleaved.thapi_text_pretty b/backends/pytorch/tests/nested_ops_interleaved.thapi_text_pretty new file mode 100644 index 000000000..3623cee83 --- /dev/null +++ b/backends/pytorch/tests/nested_ops_interleaved.thapi_text_pretty @@ -0,0 +1,5 @@ +12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::add", overload_name: "Tensor" } +12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mul", overload_name: "Tensor" } +12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } +12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mul", overload_name: "Tensor" } + diff --git a/backends/pytorch/tests/nested_ops_simple.thapi_text_pretty b/backends/pytorch/tests/nested_ops_simple.thapi_text_pretty new file mode 100644 index 000000000..2b8193cce --- /dev/null +++ b/backends/pytorch/tests/nested_ops_simple.thapi_text_pretty @@ -0,0 +1,5 @@ +12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::linear", overload_name: "" } +12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::matmul", overload_name: "" } +12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } +12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::linear", overload_name: "" } + diff --git a/backends/pytorch/tests/op_name.thapi_text_pretty b/backends/pytorch/tests/op_name.thapi_text_pretty new file mode 100644 index 000000000..7a633ac09 --- /dev/null +++ b/backends/pytorch/tests/op_name.thapi_text_pretty @@ -0,0 +1,2 @@ +12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "op_name", overload_name: "" } +12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "op_name", overload_name: "" } diff --git a/backends/pytorch/tests/op_overload_name.thapi_text_pretty b/backends/pytorch/tests/op_overload_name.thapi_text_pretty new file mode 100644 index 000000000..43b980d73 --- /dev/null +++ b/backends/pytorch/tests/op_overload_name.thapi_text_pretty @@ -0,0 +1,2 @@ +12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "op_name", overload_name: "op_overload_name" } +12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "op_name", overload_name: "op_overload_name" } From 723d920048c9dfef86f1fd247702f4e2a44742e9 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 12 Oct 2026 21:41:04 +0000 Subject: [PATCH 04/12] tests --- backends/pytorch/Makefile.am | 16 ++++++++-------- .../pytorch/tests/basic_op_name.bt_text_pretty | 1 + .../tests/basic_op_overload_name.bt_text_pretty | 1 + .../tests/deeply_nested_ops.bt_text_pretty | 3 +++ .../tests/exit_without_entry.bt_text_pretty | 1 + .../tests/multithreaded_ops.bt_text_pretty | 2 ++ .../tests/nested_ops_interleaved.bt_text_pretty | 2 ++ .../tests/nested_ops_simple.bt_text_pretty | 2 ++ backends/pytorch/tests/op_name.bt_text_pretty | 1 + .../tests/op_overload_name.bt_text_pretty | 1 + 10 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 backends/pytorch/tests/basic_op_name.bt_text_pretty create mode 100644 backends/pytorch/tests/basic_op_overload_name.bt_text_pretty create mode 100644 backends/pytorch/tests/deeply_nested_ops.bt_text_pretty create mode 100644 backends/pytorch/tests/exit_without_entry.bt_text_pretty create mode 100644 backends/pytorch/tests/multithreaded_ops.bt_text_pretty create mode 100644 backends/pytorch/tests/nested_ops_interleaved.bt_text_pretty create mode 100644 backends/pytorch/tests/nested_ops_simple.bt_text_pretty create mode 100644 backends/pytorch/tests/op_name.bt_text_pretty create mode 100644 backends/pytorch/tests/op_overload_name.bt_text_pretty diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index 1d1f4638c..996aa20c4 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -41,7 +41,7 @@ CLEANFILES = \ BUILT_SOURCES = \ $(PYTORCH_STATIC_PROBES_INCL) -# -ltorch_cpu resolves at::addGlobalCallback, at::RecordFunction::name, at::RecordFuntion::overload_name. +# -ltorch_cpu resolves at::addGlobalCallback, at::RecordFunction::name, at::RecordFuntion::overload_name. DUMMY_TORCH_LIBS = \ dummy_libs/libtorch_cpu.so @@ -97,19 +97,19 @@ CLEANFILES += \ BUILT_SOURCES += \ $(BTX_PYTORCH_GENERATED) -nodist_libPyTorchInterval_la_SOURCES = \ +nodist_libPYTORCHInterval_la_SOURCES = \ $(BTX_PYTORCH_GENERATED) -libPyTorchInterval_la_SOURCES = \ +libPYTORCHInterval_la_SOURCES = \ btx_pytorchinterval_callbacks.cpp -libPyTorchInterval_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I./ -I./btx_filter_pytorch -libPyTorchInterval_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter $(WERROR) $(BABELTRACE2_CFLAGS) -libPyTorchInterval_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter $(WERROR) $(BABELTRACE2_CFLAGS) -libPyTorchInterval_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module +libPYTORCHInterval_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(top_srcdir)/utils/include -I./ -I./btx_filter_pytorch +libPYTORCHInterval_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter $(WERROR) $(BABELTRACE2_CFLAGS) +libPYTORCHInterval_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter $(WERROR) $(BABELTRACE2_CFLAGS) +libPYTORCHInterval_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module bt2dir = $(pkglibdir)/bt2 -bt2_LTLIBRARIES = libPyTorchInterval.la +bt2_LTLIBRARIES = libPYTORCHInterval.la # # ---------------------------------------------------------------------- diff --git a/backends/pytorch/tests/basic_op_name.bt_text_pretty b/backends/pytorch/tests/basic_op_name.bt_text_pretty new file mode 100644 index 000000000..4e758d3b5 --- /dev/null +++ b/backends/pytorch/tests/basic_op_name.bt_text_pretty @@ -0,0 +1 @@ +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 0, err = false } diff --git a/backends/pytorch/tests/basic_op_overload_name.bt_text_pretty b/backends/pytorch/tests/basic_op_overload_name.bt_text_pretty new file mode 100644 index 000000000..915752537 --- /dev/null +++ b/backends/pytorch/tests/basic_op_overload_name.bt_text_pretty @@ -0,0 +1 @@ +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 0, err = false } diff --git a/backends/pytorch/tests/deeply_nested_ops.bt_text_pretty b/backends/pytorch/tests/deeply_nested_ops.bt_text_pretty new file mode 100644 index 000000000..0f13235bb --- /dev/null +++ b/backends/pytorch/tests/deeply_nested_ops.bt_text_pretty @@ -0,0 +1,3 @@ +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mm", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::matmul", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::addmm", dur = 0, err = false } diff --git a/backends/pytorch/tests/exit_without_entry.bt_text_pretty b/backends/pytorch/tests/exit_without_entry.bt_text_pretty new file mode 100644 index 000000000..f1a85b2f6 --- /dev/null +++ b/backends/pytorch/tests/exit_without_entry.bt_text_pretty @@ -0,0 +1 @@ +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::sigmoid", dur = 0, err = true } diff --git a/backends/pytorch/tests/multithreaded_ops.bt_text_pretty b/backends/pytorch/tests/multithreaded_ops.bt_text_pretty new file mode 100644 index 000000000..45ec4ff3b --- /dev/null +++ b/backends/pytorch/tests/multithreaded_ops.bt_text_pretty @@ -0,0 +1,2 @@ +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 2, ts = 1704110400000000000, backend = 10 }, { name = "aten::tanh", dur = 0, err = false } diff --git a/backends/pytorch/tests/nested_ops_interleaved.bt_text_pretty b/backends/pytorch/tests/nested_ops_interleaved.bt_text_pretty new file mode 100644 index 000000000..5082d3ae3 --- /dev/null +++ b/backends/pytorch/tests/nested_ops_interleaved.bt_text_pretty @@ -0,0 +1,2 @@ +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 0, err = false } diff --git a/backends/pytorch/tests/nested_ops_simple.bt_text_pretty b/backends/pytorch/tests/nested_ops_simple.bt_text_pretty new file mode 100644 index 000000000..ea2d8a390 --- /dev/null +++ b/backends/pytorch/tests/nested_ops_simple.bt_text_pretty @@ -0,0 +1,2 @@ +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::matmul", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::linear", dur = 0, err = false } diff --git a/backends/pytorch/tests/op_name.bt_text_pretty b/backends/pytorch/tests/op_name.bt_text_pretty new file mode 100644 index 000000000..939dd929e --- /dev/null +++ b/backends/pytorch/tests/op_name.bt_text_pretty @@ -0,0 +1 @@ +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "op_name", dur = 0, err = false } diff --git a/backends/pytorch/tests/op_overload_name.bt_text_pretty b/backends/pytorch/tests/op_overload_name.bt_text_pretty new file mode 100644 index 000000000..eab23d924 --- /dev/null +++ b/backends/pytorch/tests/op_overload_name.bt_text_pretty @@ -0,0 +1 @@ +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "op_name.op_overload_name", dur = 0, err = false } From 2b4fc7c41b7f7b73d80137192845b7151cf74793 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 12 Oct 2026 22:16:18 +0000 Subject: [PATCH 05/12] remove old versions --- backends/pytorch/tests/op_name.bt_text_pretty | 1 - backends/pytorch/tests/op_name.thapi_text_pretty | 2 -- backends/pytorch/tests/op_overload_name.bt_text_pretty | 1 - backends/pytorch/tests/op_overload_name.thapi_text_pretty | 2 -- 4 files changed, 6 deletions(-) delete mode 100644 backends/pytorch/tests/op_name.bt_text_pretty delete mode 100644 backends/pytorch/tests/op_name.thapi_text_pretty delete mode 100644 backends/pytorch/tests/op_overload_name.bt_text_pretty delete mode 100644 backends/pytorch/tests/op_overload_name.thapi_text_pretty diff --git a/backends/pytorch/tests/op_name.bt_text_pretty b/backends/pytorch/tests/op_name.bt_text_pretty deleted file mode 100644 index 939dd929e..000000000 --- a/backends/pytorch/tests/op_name.bt_text_pretty +++ /dev/null @@ -1 +0,0 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "op_name", dur = 0, err = false } diff --git a/backends/pytorch/tests/op_name.thapi_text_pretty b/backends/pytorch/tests/op_name.thapi_text_pretty deleted file mode 100644 index 7a633ac09..000000000 --- a/backends/pytorch/tests/op_name.thapi_text_pretty +++ /dev/null @@ -1,2 +0,0 @@ -12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "op_name", overload_name: "" } -12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "op_name", overload_name: "" } diff --git a/backends/pytorch/tests/op_overload_name.bt_text_pretty b/backends/pytorch/tests/op_overload_name.bt_text_pretty deleted file mode 100644 index eab23d924..000000000 --- a/backends/pytorch/tests/op_overload_name.bt_text_pretty +++ /dev/null @@ -1 +0,0 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "op_name.op_overload_name", dur = 0, err = false } diff --git a/backends/pytorch/tests/op_overload_name.thapi_text_pretty b/backends/pytorch/tests/op_overload_name.thapi_text_pretty deleted file mode 100644 index 43b980d73..000000000 --- a/backends/pytorch/tests/op_overload_name.thapi_text_pretty +++ /dev/null @@ -1,2 +0,0 @@ -12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "op_name", overload_name: "op_overload_name" } -12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "op_name", overload_name: "op_overload_name" } From 3a6d22eaef8566473078355985d3905fff484cdb Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 12 Oct 2026 22:27:47 +0000 Subject: [PATCH 06/12] rename test to follow Nathan naming convention --- backends/pytorch/Makefile.am | 14 +++++++------- backends/pytorch/tests/README.md | 14 +++++++------- ...text_pretty => basic_op_name-Aa.bt_text_pretty} | 0 ...t_pretty => basic_op_name-Aa.thapi_text_pretty} | 0 ...ty => basic_op_overload_name-Aa.bt_text_pretty} | 0 ...=> basic_op_overload_name-Aa.thapi_text_pretty} | 0 ...tty => deeply_nested_ops-ABCcba.bt_text_pretty} | 0 ... => deeply_nested_ops-ABCcba.thapi_text_pretty} | 0 ..._pretty => exit_without_entry-a.bt_text_pretty} | 0 ...etty => exit_without_entry-a.thapi_text_pretty} | 0 ...retty => multithreaded_ops-AaBb.bt_text_pretty} | 0 ...ty => multithreaded_ops-AaBb.thapi_text_pretty} | 0 ... => nested_ops_interleaved-ABab.bt_text_pretty} | 0 ... nested_ops_interleaved-ABab.thapi_text_pretty} | 0 ...retty => nested_ops_simple-ABba.bt_text_pretty} | 0 ...ty => nested_ops_simple-ABba.thapi_text_pretty} | 0 16 files changed, 14 insertions(+), 14 deletions(-) rename backends/pytorch/tests/{basic_op_name.bt_text_pretty => basic_op_name-Aa.bt_text_pretty} (100%) rename backends/pytorch/tests/{basic_op_name.thapi_text_pretty => basic_op_name-Aa.thapi_text_pretty} (100%) rename backends/pytorch/tests/{basic_op_overload_name.bt_text_pretty => basic_op_overload_name-Aa.bt_text_pretty} (100%) rename backends/pytorch/tests/{basic_op_overload_name.thapi_text_pretty => basic_op_overload_name-Aa.thapi_text_pretty} (100%) rename backends/pytorch/tests/{deeply_nested_ops.bt_text_pretty => deeply_nested_ops-ABCcba.bt_text_pretty} (100%) rename backends/pytorch/tests/{deeply_nested_ops.thapi_text_pretty => deeply_nested_ops-ABCcba.thapi_text_pretty} (100%) rename backends/pytorch/tests/{exit_without_entry.bt_text_pretty => exit_without_entry-a.bt_text_pretty} (100%) rename backends/pytorch/tests/{exit_without_entry.thapi_text_pretty => exit_without_entry-a.thapi_text_pretty} (100%) rename backends/pytorch/tests/{multithreaded_ops.bt_text_pretty => multithreaded_ops-AaBb.bt_text_pretty} (100%) rename backends/pytorch/tests/{multithreaded_ops.thapi_text_pretty => multithreaded_ops-AaBb.thapi_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_interleaved.bt_text_pretty => nested_ops_interleaved-ABab.bt_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_interleaved.thapi_text_pretty => nested_ops_interleaved-ABab.thapi_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_simple.bt_text_pretty => nested_ops_simple-ABba.bt_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_simple.thapi_text_pretty => nested_ops_simple-ABba.thapi_text_pretty} (100%) diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index 996aa20c4..c30d318d8 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -136,13 +136,13 @@ data_DATA = \ # TRACE_COMMON = \ - tests/basic_op_name.thapi_text_pretty \ - tests/basic_op_overload_name.thapi_text_pretty \ - tests/nested_ops_simple.thapi_text_pretty \ - tests/nested_ops_interleaved.thapi_text_pretty \ - tests/deeply_nested_ops.thapi_text_pretty \ - tests/exit_without_entry.thapi_text_pretty \ - tests/multithreaded_ops.thapi_text_pretty + tests/basic_op_name-Aa.thapi_text_pretty \ + tests/basic_op_overload_name-Aa.thapi_text_pretty \ + tests/nested_ops_simple-ABba.thapi_text_pretty \ + tests/nested_ops_interleaved-ABab.thapi_text_pretty \ + tests/deeply_nested_ops-ABCcba.thapi_text_pretty \ + tests/exit_without_entry-a.thapi_text_pretty \ + tests/multithreaded_ops-AaBb.thapi_text_pretty BTX_PYTORCH_GENERATED_SOURCE_TEST = \ btx_source_pytorch_test/metababel/metababel.h \ diff --git a/backends/pytorch/tests/README.md b/backends/pytorch/tests/README.md index 5df867b75..507d1c9f9 100644 --- a/backends/pytorch/tests/README.md +++ b/backends/pytorch/tests/README.md @@ -2,10 +2,10 @@ | Test | Feature | Description | |------|---------|-------------| -| **basic_op_name** | Basic tracing | Validates tracing of a simple PyTorch operation with empty overload name. | -| **basic_op_overload_name** | Overload name handling | Validates that operations with overload names create qualified names (e.g., `aten::add.Tensor`). | -| **nested_ops_simple** | LIFO stack (AABB) | Validates LIFO stack correctly matches nested operations in AABB order (outer→inner→inner exit→outer exit). | -| **nested_ops_interleaved** | LIFO stack error handling (ABAB) | Validates error flag is set when exit events arrive in non-LIFO order (ABAB pattern), testing stack mismatch detection. | -| **deeply_nested_ops** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | -| **exit_without_entry** | Stack underflow | Validates error flag is set when an exit event arrives with no matching entry on the stack. | -| **multithreaded_ops** | Per-thread isolation | Validates each thread maintains its own independent LIFO stack without cross-thread interference. | +| **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). | +| **nested_ops_interleaved-ABab** | LIFO stack error handling (ABAB) | Validates error flag is set when exit events arrive in non-LIFO order (ABAB pattern), testing stack mismatch detection. | +| **deeply_nested_ops-ABCcba** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | +| **exit_without_entry-a** | Stack underflow | Validates error flag is set when an exit event arrives with no matching entry on the stack. | +| **multithreaded_ops-AaBb** | Per-thread isolation | Validates each thread maintains its own independent LIFO stack without cross-thread interference. | diff --git a/backends/pytorch/tests/basic_op_name.bt_text_pretty b/backends/pytorch/tests/basic_op_name-Aa.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_name.bt_text_pretty rename to backends/pytorch/tests/basic_op_name-Aa.bt_text_pretty diff --git a/backends/pytorch/tests/basic_op_name.thapi_text_pretty b/backends/pytorch/tests/basic_op_name-Aa.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_name.thapi_text_pretty rename to backends/pytorch/tests/basic_op_name-Aa.thapi_text_pretty diff --git a/backends/pytorch/tests/basic_op_overload_name.bt_text_pretty b/backends/pytorch/tests/basic_op_overload_name-Aa.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_overload_name.bt_text_pretty rename to backends/pytorch/tests/basic_op_overload_name-Aa.bt_text_pretty diff --git a/backends/pytorch/tests/basic_op_overload_name.thapi_text_pretty b/backends/pytorch/tests/basic_op_overload_name-Aa.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_overload_name.thapi_text_pretty rename to backends/pytorch/tests/basic_op_overload_name-Aa.thapi_text_pretty diff --git a/backends/pytorch/tests/deeply_nested_ops.bt_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCcba.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/deeply_nested_ops.bt_text_pretty rename to backends/pytorch/tests/deeply_nested_ops-ABCcba.bt_text_pretty diff --git a/backends/pytorch/tests/deeply_nested_ops.thapi_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCcba.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/deeply_nested_ops.thapi_text_pretty rename to backends/pytorch/tests/deeply_nested_ops-ABCcba.thapi_text_pretty diff --git a/backends/pytorch/tests/exit_without_entry.bt_text_pretty b/backends/pytorch/tests/exit_without_entry-a.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/exit_without_entry.bt_text_pretty rename to backends/pytorch/tests/exit_without_entry-a.bt_text_pretty diff --git a/backends/pytorch/tests/exit_without_entry.thapi_text_pretty b/backends/pytorch/tests/exit_without_entry-a.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/exit_without_entry.thapi_text_pretty rename to backends/pytorch/tests/exit_without_entry-a.thapi_text_pretty diff --git a/backends/pytorch/tests/multithreaded_ops.bt_text_pretty b/backends/pytorch/tests/multithreaded_ops-AaBb.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/multithreaded_ops.bt_text_pretty rename to backends/pytorch/tests/multithreaded_ops-AaBb.bt_text_pretty diff --git a/backends/pytorch/tests/multithreaded_ops.thapi_text_pretty b/backends/pytorch/tests/multithreaded_ops-AaBb.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/multithreaded_ops.thapi_text_pretty rename to backends/pytorch/tests/multithreaded_ops-AaBb.thapi_text_pretty diff --git a/backends/pytorch/tests/nested_ops_interleaved.bt_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABab.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_interleaved.bt_text_pretty rename to backends/pytorch/tests/nested_ops_interleaved-ABab.bt_text_pretty diff --git a/backends/pytorch/tests/nested_ops_interleaved.thapi_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABab.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_interleaved.thapi_text_pretty rename to backends/pytorch/tests/nested_ops_interleaved-ABab.thapi_text_pretty diff --git a/backends/pytorch/tests/nested_ops_simple.bt_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABba.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_simple.bt_text_pretty rename to backends/pytorch/tests/nested_ops_simple-ABba.bt_text_pretty diff --git a/backends/pytorch/tests/nested_ops_simple.thapi_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABba.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_simple.thapi_text_pretty rename to backends/pytorch/tests/nested_ops_simple-ABba.thapi_text_pretty From ed9ca8659c0bc3642e4fd1564b8e9c4577a5bf09 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 12 Oct 2026 22:33:39 +0000 Subject: [PATCH 07/12] rename test to follow Nathan naming convention --- backends/pytorch/Makefile.am | 14 +++++++------- backends/pytorch/tests/README.md | 14 +++++++------- ...text_pretty => basic_op_name-AA.bt_text_pretty} | 0 ...t_pretty => basic_op_name-AA.thapi_text_pretty} | 0 ...ty => basic_op_overload_name-AA.bt_text_pretty} | 0 ...=> basic_op_overload_name-AA.thapi_text_pretty} | 0 ...tty => deeply_nested_ops-ABCCBA.bt_text_pretty} | 0 ... => deeply_nested_ops-ABCCBA.thapi_text_pretty} | 0 ..._pretty => exit_without_entry-A.bt_text_pretty} | 0 ...etty => exit_without_entry-A.thapi_text_pretty} | 0 ...retty => multithreaded_ops-AABB.bt_text_pretty} | 0 ...ty => multithreaded_ops-AABB.thapi_text_pretty} | 0 ... => nested_ops_interleaved-ABAB.bt_text_pretty} | 0 ... nested_ops_interleaved-ABAB.thapi_text_pretty} | 0 ...retty => nested_ops_simple-ABBA.bt_text_pretty} | 0 ...ty => nested_ops_simple-ABBA.thapi_text_pretty} | 0 16 files changed, 14 insertions(+), 14 deletions(-) rename backends/pytorch/tests/{basic_op_name-Aa.bt_text_pretty => basic_op_name-AA.bt_text_pretty} (100%) rename backends/pytorch/tests/{basic_op_name-Aa.thapi_text_pretty => basic_op_name-AA.thapi_text_pretty} (100%) rename backends/pytorch/tests/{basic_op_overload_name-Aa.bt_text_pretty => basic_op_overload_name-AA.bt_text_pretty} (100%) rename backends/pytorch/tests/{basic_op_overload_name-Aa.thapi_text_pretty => basic_op_overload_name-AA.thapi_text_pretty} (100%) rename backends/pytorch/tests/{deeply_nested_ops-ABCcba.bt_text_pretty => deeply_nested_ops-ABCCBA.bt_text_pretty} (100%) rename backends/pytorch/tests/{deeply_nested_ops-ABCcba.thapi_text_pretty => deeply_nested_ops-ABCCBA.thapi_text_pretty} (100%) rename backends/pytorch/tests/{exit_without_entry-a.bt_text_pretty => exit_without_entry-A.bt_text_pretty} (100%) rename backends/pytorch/tests/{exit_without_entry-a.thapi_text_pretty => exit_without_entry-A.thapi_text_pretty} (100%) rename backends/pytorch/tests/{multithreaded_ops-AaBb.bt_text_pretty => multithreaded_ops-AABB.bt_text_pretty} (100%) rename backends/pytorch/tests/{multithreaded_ops-AaBb.thapi_text_pretty => multithreaded_ops-AABB.thapi_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_interleaved-ABab.bt_text_pretty => nested_ops_interleaved-ABAB.bt_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_interleaved-ABab.thapi_text_pretty => nested_ops_interleaved-ABAB.thapi_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_simple-ABba.bt_text_pretty => nested_ops_simple-ABBA.bt_text_pretty} (100%) rename backends/pytorch/tests/{nested_ops_simple-ABba.thapi_text_pretty => nested_ops_simple-ABBA.thapi_text_pretty} (100%) diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index c30d318d8..71453a90e 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -136,13 +136,13 @@ data_DATA = \ # TRACE_COMMON = \ - tests/basic_op_name-Aa.thapi_text_pretty \ - tests/basic_op_overload_name-Aa.thapi_text_pretty \ - tests/nested_ops_simple-ABba.thapi_text_pretty \ - tests/nested_ops_interleaved-ABab.thapi_text_pretty \ - tests/deeply_nested_ops-ABCcba.thapi_text_pretty \ - tests/exit_without_entry-a.thapi_text_pretty \ - tests/multithreaded_ops-AaBb.thapi_text_pretty + tests/basic_op_name-AA.thapi_text_pretty \ + tests/basic_op_overload_name-AA.thapi_text_pretty \ + tests/nested_ops_simple-ABBA.thapi_text_pretty \ + tests/nested_ops_interleaved-ABAB.thapi_text_pretty \ + tests/deeply_nested_ops-ABCCBA.thapi_text_pretty \ + tests/exit_without_entry-A.thapi_text_pretty \ + tests/multithreaded_ops-AABB.thapi_text_pretty BTX_PYTORCH_GENERATED_SOURCE_TEST = \ btx_source_pytorch_test/metababel/metababel.h \ diff --git a/backends/pytorch/tests/README.md b/backends/pytorch/tests/README.md index 507d1c9f9..10d7438ea 100644 --- a/backends/pytorch/tests/README.md +++ b/backends/pytorch/tests/README.md @@ -2,10 +2,10 @@ | 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). | -| **nested_ops_interleaved-ABab** | LIFO stack error handling (ABAB) | Validates error flag is set when exit events arrive in non-LIFO order (ABAB pattern), testing stack mismatch detection. | -| **deeply_nested_ops-ABCcba** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | -| **exit_without_entry-a** | Stack underflow | Validates error flag is set when an exit event arrives with no matching entry on the stack. | -| **multithreaded_ops-AaBb** | Per-thread isolation | Validates each thread maintains its own independent LIFO stack without cross-thread interference. | +| **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). | +| **nested_ops_interleaved-ABAB** | LIFO stack error handling (ABAB) | Validates error flag is set when exit events arrive in non-LIFO order (ABAB pattern), testing stack mismatch detection. | +| **deeply_nested_ops-ABCCBA** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | +| **exit_without_entry-A** | Stack underflow | Validates error flag is set when an exit event arrives with no matching entry on the stack. | +| **multithreaded_ops-AABB** | Per-thread isolation | Validates each thread maintains its own independent LIFO stack without cross-thread interference. | diff --git a/backends/pytorch/tests/basic_op_name-Aa.bt_text_pretty b/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_name-Aa.bt_text_pretty rename to backends/pytorch/tests/basic_op_name-AA.bt_text_pretty diff --git a/backends/pytorch/tests/basic_op_name-Aa.thapi_text_pretty b/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_name-Aa.thapi_text_pretty rename to backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty diff --git a/backends/pytorch/tests/basic_op_overload_name-Aa.bt_text_pretty b/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_overload_name-Aa.bt_text_pretty rename to backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty diff --git a/backends/pytorch/tests/basic_op_overload_name-Aa.thapi_text_pretty b/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/basic_op_overload_name-Aa.thapi_text_pretty rename to backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty diff --git a/backends/pytorch/tests/deeply_nested_ops-ABCcba.bt_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/deeply_nested_ops-ABCcba.bt_text_pretty rename to backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty diff --git a/backends/pytorch/tests/deeply_nested_ops-ABCcba.thapi_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/deeply_nested_ops-ABCcba.thapi_text_pretty rename to backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty diff --git a/backends/pytorch/tests/exit_without_entry-a.bt_text_pretty b/backends/pytorch/tests/exit_without_entry-A.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/exit_without_entry-a.bt_text_pretty rename to backends/pytorch/tests/exit_without_entry-A.bt_text_pretty diff --git a/backends/pytorch/tests/exit_without_entry-a.thapi_text_pretty b/backends/pytorch/tests/exit_without_entry-A.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/exit_without_entry-a.thapi_text_pretty rename to backends/pytorch/tests/exit_without_entry-A.thapi_text_pretty diff --git a/backends/pytorch/tests/multithreaded_ops-AaBb.bt_text_pretty b/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/multithreaded_ops-AaBb.bt_text_pretty rename to backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty diff --git a/backends/pytorch/tests/multithreaded_ops-AaBb.thapi_text_pretty b/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/multithreaded_ops-AaBb.thapi_text_pretty rename to backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABab.bt_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_interleaved-ABab.bt_text_pretty rename to backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABab.thapi_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_interleaved-ABab.thapi_text_pretty rename to backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty diff --git a/backends/pytorch/tests/nested_ops_simple-ABba.bt_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_simple-ABba.bt_text_pretty rename to backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty diff --git a/backends/pytorch/tests/nested_ops_simple-ABba.thapi_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty similarity index 100% rename from backends/pytorch/tests/nested_ops_simple-ABba.thapi_text_pretty rename to backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty From 124812dc3584216647683d12d58dfdf6eaf8ab08 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Tue, 13 Oct 2026 13:58:54 +0000 Subject: [PATCH 08/12] Fix Non LIFO order validation, and add tests; add reentracy tests --- backends/pytorch/Makefile.am | 3 ++- .../pytorch/btx_pytorchinterval_callbacks.cpp | 27 +++++++++---------- backends/pytorch/tests/README.md | 3 ++- ...nested_ops_interleaved-ABAB.bt_text_pretty | 4 +-- .../tests/reentrant_op-AAAA.bt_text_pretty | 2 ++ .../tests/reentrant_op-AAAA.thapi_text_pretty | 5 ++++ 6 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty create mode 100644 backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index 71453a90e..bd67e4be7 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -142,7 +142,8 @@ TRACE_COMMON = \ tests/nested_ops_interleaved-ABAB.thapi_text_pretty \ tests/deeply_nested_ops-ABCCBA.thapi_text_pretty \ tests/exit_without_entry-A.thapi_text_pretty \ - tests/multithreaded_ops-AABB.thapi_text_pretty + tests/multithreaded_ops-AABB.thapi_text_pretty \ + tests/reentrant_op-AAAA.thapi_text_pretty BTX_PYTORCH_GENERATED_SOURCE_TEST = \ btx_source_pytorch_test/metababel/metababel.h \ diff --git a/backends/pytorch/btx_pytorchinterval_callbacks.cpp b/backends/pytorch/btx_pytorchinterval_callbacks.cpp index dd86900d9..0f48dd6e8 100644 --- a/backends/pytorch/btx_pytorchinterval_callbacks.cpp +++ b/backends/pytorch/btx_pytorchinterval_callbacks.cpp @@ -6,7 +6,7 @@ // PyTorch requies a per-thread LIFO stack since there is reentrace and nesting calls. struct data_s { - std::unordered_map> entry_stack; + std::unordered_map>> entry_stack; }; typedef struct data_s data_t; @@ -14,10 +14,8 @@ static void btx_initialize_component(void **usr_data) { *usr_data = new data_t; static void btx_finalize_component(void *usr_data) { delete static_cast(usr_data); } -// PyTorch identifies an operator by TWO strings: a schema name (e.g. -// "aten::abs") and an overload name (e.g. "" for the default overload, "out" -// Joining them here keeps e.g. "aten::abs" and "aten::abs.out" distinguishable -// in the trace instead of both showing up as plain "aten::abs". +// Combine schema name and overload name (e.g. "aten::abs" + "out") so +// different overloads don't collapse into the same trace entry. static std::string qualified_name(const char *name, const char *overload_name) { return (overload_name[0] == '\0') ? name : std::string(name) + "." + overload_name; } @@ -28,9 +26,10 @@ static void lttng_ust_pytorch_op_entry_callback(void *btx_handle, const char *hostname, int64_t vpid, uint64_t vtid, - char * /*name*/, - char * /*overload_name*/) { - static_cast(usr_data)->entry_stack[{hostname, vpid, vtid}].push_back(ts); + char *name, + char *overload_name) { + static_cast(usr_data)->entry_stack[{hostname, vpid, vtid}].push_back( + {qualified_name(name, overload_name), ts}); } static void lttng_ust_pytorch_op_exit_callback(void *btx_handle, @@ -44,17 +43,17 @@ static void lttng_ust_pytorch_op_exit_callback(void *btx_handle, auto *state = static_cast(usr_data); auto &stack = state->entry_stack[{hostname, vpid, vtid}]; - // Empty means an exit arrived with no matching entry - const bool err = stack.empty(); + const std::string exit_name = qualified_name(name, overload_name); + // Empty stack means underflow; name mismatch means non-LIFO exit order + const bool err = stack.empty() || stack.back().first != exit_name; int64_t entry_ts = ts; - if (!err) { - entry_ts = stack.back(); + if (!stack.empty()) { + entry_ts = stack.back().second; stack.pop_back(); } - const std::string full_name = qualified_name(name, overload_name); btx_push_message_lttng_host(btx_handle, hostname, vpid, vtid, entry_ts, BACKEND_PYTORCH, - full_name.c_str(), (ts - entry_ts), err); + exit_name.c_str(), (ts - entry_ts), err); } void btx_register_usr_callbacks(void *btx_handle) { diff --git a/backends/pytorch/tests/README.md b/backends/pytorch/tests/README.md index 10d7438ea..046b0872b 100644 --- a/backends/pytorch/tests/README.md +++ b/backends/pytorch/tests/README.md @@ -5,7 +5,8 @@ | **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). | -| **nested_ops_interleaved-ABAB** | LIFO stack error handling (ABAB) | Validates error flag is set when exit events arrive in non-LIFO order (ABAB pattern), testing stack mismatch detection. | +| **nested_ops_interleaved-ABAB** | Non LIFO stack error handling (ABAB) | Validates error flag is set when an exit name does not match the top of the stack. | | **deeply_nested_ops-ABCCBA** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | | **exit_without_entry-A** | Stack underflow | Validates error flag is set when an exit event arrives with no matching entry on the stack. | | **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). | diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty index 5082d3ae3..7917b1ab5 100644 --- a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty +++ b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 0, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 0, err = true } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 0, err = true } diff --git a/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty b/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty new file mode 100644 index 000000000..7885f2f0b --- /dev/null +++ b/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty @@ -0,0 +1,2 @@ +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 0, err = false } +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 0, err = false } diff --git a/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty b/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty new file mode 100644 index 000000000..29b0bb08b --- /dev/null +++ b/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty @@ -0,0 +1,5 @@ +12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::norm", overload_name: "Scalar" } +12:00:00.000000010 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::norm", overload_name: "Scalar" } +12:00:00.000000020 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::norm", overload_name: "Scalar" } +12:00:00.000000030 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::norm", overload_name: "Scalar" } + From b2ae099f6952bae4aecb7bdfd716c5abf9eb39dd Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Tue, 13 Oct 2026 14:39:38 +0000 Subject: [PATCH 09/12] Use btx_model from the source dir in place of build dir --- backends/pytorch/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index bd67e4be7..bad31a425 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -153,8 +153,8 @@ BTX_PYTORCH_GENERATED_SOURCE_TEST = \ btx_source_pytorch_test/metababel/btx_downstream.c \ btx_source_pytorch_test/btx_main.c -$(BTX_PYTORCH_GENERATED_SOURCE_TEST) &: btx_pytorch_model.yaml - $(METABABEL) -d btx_pytorch_model.yaml -t SOURCE -o btx_source_pytorch_test -p pytorchtest -c test +$(BTX_PYTORCH_GENERATED_SOURCE_TEST) &: $(srcdir)/btx_pytorch_model.yaml + $(METABABEL) -d $(srcdir)/btx_pytorch_model.yaml -t SOURCE -o btx_source_pytorch_test -p pytorchtest -c test noinst_LTLIBRARIES += libtestpytorchsource.la nodist_libtestpytorchsource_la_SOURCES = $(BTX_PYTORCH_GENERATED_SOURCE_TEST) From dc828d0c58132fd26e0b9d02e956f57493aa0076 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Tue, 13 Oct 2026 21:17:05 +0000 Subject: [PATCH 10/12] Update text for valid timestamp values --- backends/pytorch/Makefile.am | 10 +++++++--- backends/pytorch/tests/basic_op_name-AA.bt_text_pretty | 2 +- .../pytorch/tests/basic_op_name-AA.thapi_text_pretty | 3 +-- .../tests/basic_op_overload_name-AA.bt_text_pretty | 2 +- .../tests/basic_op_overload_name-AA.thapi_text_pretty | 3 +-- .../tests/deeply_nested_ops-ABCCBA.bt_text_pretty | 6 +++--- .../tests/deeply_nested_ops-ABCCBA.thapi_text_pretty | 1 - .../tests/multithreaded_ops-AABB.bt_text_pretty | 4 ++-- .../tests/multithreaded_ops-AABB.thapi_text_pretty | 1 - .../tests/nested_ops_interleaved-ABAB.bt_text_pretty | 4 ++-- .../nested_ops_interleaved-ABAB.thapi_text_pretty | 1 - .../tests/nested_ops_simple-ABBA.bt_text_pretty | 4 ++-- .../tests/nested_ops_simple-ABBA.thapi_text_pretty | 1 - .../pytorch/tests/reentrant_op-AAAA.bt_text_pretty | 4 ++-- .../pytorch/tests/reentrant_op-AAAA.thapi_text_pretty | 1 - 15 files changed, 22 insertions(+), 25 deletions(-) diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index bad31a425..6511364b3 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -153,8 +153,11 @@ BTX_PYTORCH_GENERATED_SOURCE_TEST = \ btx_source_pytorch_test/metababel/btx_downstream.c \ btx_source_pytorch_test/btx_main.c -$(BTX_PYTORCH_GENERATED_SOURCE_TEST) &: $(srcdir)/btx_pytorch_model.yaml - $(METABABEL) -d $(srcdir)/btx_pytorch_model.yaml -t SOURCE -o btx_source_pytorch_test -p pytorchtest -c test +$(abs_builddir)/btx_pytorch_model.yaml: $(srcdir)/btx_pytorch_model.yaml + cp $< $@ + +$(BTX_PYTORCH_GENERATED_SOURCE_TEST) &: $(abs_builddir)/btx_pytorch_model.yaml + $(METABABEL) -d $(abs_builddir)/btx_pytorch_model.yaml -t SOURCE -o btx_source_pytorch_test -p pytorchtest -c test noinst_LTLIBRARIES += libtestpytorchsource.la nodist_libtestpytorchsource_la_SOURCES = $(BTX_PYTORCH_GENERATED_SOURCE_TEST) @@ -178,4 +181,5 @@ EXTRA_DIST += \ $(TRACE_OUT) CLEANFILES += \ - $(BTX_PYTORCH_GENERATED_SOURCE_TEST) + $(BTX_PYTORCH_GENERATED_SOURCE_TEST) \ + $(abs_builddir)/btx_pytorch_model.yaml diff --git a/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty b/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty index 4e758d3b5..972b06624 100644 --- a/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty +++ b/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty @@ -1 +1 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 0, err = false } +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 10, err = false } diff --git a/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty b/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty index 74030314b..d77f8e60c 100644 --- a/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty +++ b/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty @@ -1,3 +1,2 @@ 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::relu", overload_name: "" } -12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } - +12:00:00.000000010 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } diff --git a/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty b/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty index 915752537..f603c1f8d 100644 --- a/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty +++ b/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty @@ -1 +1 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 0, err = false } +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 10, err = false } diff --git a/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty b/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty index e2edc8aa6..3f4725c4a 100644 --- a/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty +++ b/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty @@ -1,3 +1,2 @@ 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::add", overload_name: "Tensor" } -12:00:00.000000001 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } - +12:00:00.000000010 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } diff --git a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty index 0f13235bb..13d85cfea 100644 --- a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty +++ b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty @@ -1,3 +1,3 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mm", dur = 0, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::matmul", dur = 0, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::addmm", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000020, backend = 10 }, { name = "aten::mm", dur = 10, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::matmul", dur = 30, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::addmm", dur = 50, err = false } diff --git a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty index 1ce419fba..2507f95cc 100644 --- a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty +++ b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty @@ -4,4 +4,3 @@ 12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mm", overload_name: "" } 12:00:00.000000040 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } 12:00:00.000000050 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::addmm", overload_name: "" } - diff --git a/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty b/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty index 45ec4ff3b..fa2407f06 100644 --- a/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty +++ b/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 0, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 2, ts = 1704110400000000000, backend = 10 }, { name = "aten::tanh", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 10, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 2, ts = 1704110400000000000, backend = 10 }, { name = "aten::tanh", dur = 20, err = false } diff --git a/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty b/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty index 2c49d75a9..b1925a484 100644 --- a/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty +++ b/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty @@ -2,4 +2,3 @@ 12:00:00.000000000 - testhost - vpid: 1, vtid: 2 - lttng_ust_pytorch:op_entry: { name: "aten::tanh", overload_name: "" } 12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } 12:00:00.000000020 - testhost - vpid: 1, vtid: 2 - lttng_ust_pytorch:op_exit: { name: "aten::tanh", overload_name: "" } - diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty index 7917b1ab5..69e423bf1 100644 --- a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty +++ b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 0, err = true } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 0, err = true } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::add.Tensor", dur = 10, err = true } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 30, err = true } diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty index 3623cee83..23dff233f 100644 --- a/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty +++ b/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty @@ -2,4 +2,3 @@ 12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mul", overload_name: "Tensor" } 12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } 12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mul", overload_name: "Tensor" } - diff --git a/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty index ea2d8a390..0805efd21 100644 --- a/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty +++ b/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::matmul", dur = 0, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::linear", dur = 0, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::matmul", dur = 10, err = false } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::linear", dur = 30, err = false } diff --git a/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty index 2b8193cce..6169d889a 100644 --- a/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty +++ b/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty @@ -2,4 +2,3 @@ 12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::matmul", overload_name: "" } 12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } 12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::linear", overload_name: "" } - diff --git a/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty b/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty index 7885f2f0b..f5a4b5bbb 100644 --- a/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty +++ b/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 0, err = false } -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 0, err = false } +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::norm.Scalar", dur = 10, err = false } +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 30, err = false } diff --git a/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty b/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty index 29b0bb08b..bedda6ceb 100644 --- a/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty +++ b/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty @@ -2,4 +2,3 @@ 12:00:00.000000010 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::norm", overload_name: "Scalar" } 12:00:00.000000020 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::norm", overload_name: "Scalar" } 12:00:00.000000030 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::norm", overload_name: "Scalar" } - From 0e82b600773a9d6dddf4740a721d256dcb674f0e Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Tue, 13 Oct 2026 21:39:15 +0000 Subject: [PATCH 11/12] update timestamps --- backends/pytorch/tests/basic_op_name-AA.bt_text_pretty | 2 +- .../pytorch/tests/basic_op_name-AA.thapi_text_pretty | 2 +- .../tests/basic_op_overload_name-AA.bt_text_pretty | 2 +- .../tests/basic_op_overload_name-AA.thapi_text_pretty | 2 +- .../tests/deeply_nested_ops-ABCCBA.bt_text_pretty | 6 +++--- .../tests/deeply_nested_ops-ABCCBA.thapi_text_pretty | 10 +++++----- .../tests/multithreaded_ops-AABB.bt_text_pretty | 4 ++-- .../tests/multithreaded_ops-AABB.thapi_text_pretty | 4 ++-- .../tests/nested_ops_interleaved-ABAB.bt_text_pretty | 4 ++-- .../nested_ops_interleaved-ABAB.thapi_text_pretty | 6 +++--- .../tests/nested_ops_simple-ABBA.bt_text_pretty | 4 ++-- .../tests/nested_ops_simple-ABBA.thapi_text_pretty | 6 +++--- .../pytorch/tests/reentrant_op-AAAA.bt_text_pretty | 4 ++-- .../pytorch/tests/reentrant_op-AAAA.thapi_text_pretty | 6 +++--- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty b/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty index 972b06624..40701ca3c 100644 --- a/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty +++ b/backends/pytorch/tests/basic_op_name-AA.bt_text_pretty @@ -1 +1 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 10, err = false } +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 1000000000, err = false } diff --git a/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty b/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty index d77f8e60c..1501109b8 100644 --- a/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty +++ b/backends/pytorch/tests/basic_op_name-AA.thapi_text_pretty @@ -1,2 +1,2 @@ 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::relu", overload_name: "" } -12:00:00.000000010 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } +12:00:01.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } diff --git a/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty b/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty index f603c1f8d..e3d0d8566 100644 --- a/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty +++ b/backends/pytorch/tests/basic_op_overload_name-AA.bt_text_pretty @@ -1 +1 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 10, err = false } +lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 1000000000, err = false } diff --git a/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty b/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty index 3f4725c4a..300aed55a 100644 --- a/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty +++ b/backends/pytorch/tests/basic_op_overload_name-AA.thapi_text_pretty @@ -1,2 +1,2 @@ 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::add", overload_name: "Tensor" } -12:00:00.000000010 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { 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" } diff --git a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty index 13d85cfea..2721c18f6 100644 --- a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty +++ b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.bt_text_pretty @@ -1,3 +1,3 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000020, backend = 10 }, { name = "aten::mm", dur = 10, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::matmul", dur = 30, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::addmm", dur = 50, err = false } +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 } diff --git a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty index 2507f95cc..55a90dc99 100644 --- a/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty +++ b/backends/pytorch/tests/deeply_nested_ops-ABCCBA.thapi_text_pretty @@ -1,6 +1,6 @@ 12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::addmm", overload_name: "" } -12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::matmul", overload_name: "" } -12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mm", overload_name: "" } -12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mm", overload_name: "" } -12:00:00.000000040 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } -12:00:00.000000050 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { 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: "" } diff --git a/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty b/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty index fa2407f06..732cb8e5e 100644 --- a/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty +++ b/backends/pytorch/tests/multithreaded_ops-AABB.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::relu", dur = 10, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 2, ts = 1704110400000000000, backend = 10 }, { name = "aten::tanh", dur = 20, err = false } +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 } diff --git a/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty b/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty index b1925a484..92c8b724d 100644 --- a/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty +++ b/backends/pytorch/tests/multithreaded_ops-AABB.thapi_text_pretty @@ -1,4 +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:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::relu", overload_name: "" } -12:00:00.000000020 - testhost - vpid: 1, vtid: 2 - lttng_ust_pytorch:op_exit: { 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: "" } diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty index 69e423bf1..8783e2400 100644 --- a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty +++ b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::add.Tensor", dur = 10, err = true } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 30, err = true } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110401000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 1000000000, err = true } +lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 3000000000, err = true } diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty index 23dff233f..e6b481713 100644 --- a/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty +++ b/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty @@ -1,4 +1,4 @@ 12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::add", overload_name: "Tensor" } -12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mul", overload_name: "Tensor" } -12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } -12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mul", overload_name: "Tensor" } +12:00:01.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mul", overload_name: "Tensor" } +12:00:02.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } +12:00:03.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mul", overload_name: "Tensor" } diff --git a/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty index 0805efd21..65fb714de 100644 --- a/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty +++ b/backends/pytorch/tests/nested_ops_simple-ABBA.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::matmul", dur = 10, err = false } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::linear", dur = 30, err = false } +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 } diff --git a/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty b/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty index 6169d889a..534704eae 100644 --- a/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty +++ b/backends/pytorch/tests/nested_ops_simple-ABBA.thapi_text_pretty @@ -1,4 +1,4 @@ 12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::linear", overload_name: "" } -12:00:00.000000010 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::matmul", overload_name: "" } -12:00:00.000000020 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::matmul", overload_name: "" } -12:00:00.000000030 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { 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: "" } diff --git a/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty b/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty index f5a4b5bbb..6648b8ea4 100644 --- a/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty +++ b/backends/pytorch/tests/reentrant_op-AAAA.bt_text_pretty @@ -1,2 +1,2 @@ -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000010, backend = 10 }, { name = "aten::norm.Scalar", dur = 10, err = false } -lttng:host: { hostname = "testnode", vpid = 0, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::norm.Scalar", dur = 30, err = false } +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 } diff --git a/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty b/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty index bedda6ceb..c18aaaa71 100644 --- a/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty +++ b/backends/pytorch/tests/reentrant_op-AAAA.thapi_text_pretty @@ -1,4 +1,4 @@ 12:00:00.000000000 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::norm", overload_name: "Scalar" } -12:00:00.000000010 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::norm", overload_name: "Scalar" } -12:00:00.000000020 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::norm", overload_name: "Scalar" } -12:00:00.000000030 - testnode - vpid: 0, vtid: 1 - lttng_ust_pytorch:op_exit: { 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" } From b9cdd59741ea92d73280a60bb7408fcbda608b43 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Tue, 13 Oct 2026 22:44:58 +0000 Subject: [PATCH 12/12] remove non-LIFO exit order test --- backends/pytorch/Makefile.am | 2 -- .../pytorch/btx_pytorchinterval_callbacks.cpp | 19 +++++++------------ backends/pytorch/tests/README.md | 2 -- ...nested_ops_interleaved-ABAB.bt_text_pretty | 2 -- ...ted_ops_interleaved-ABAB.thapi_text_pretty | 4 ---- 5 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty delete mode 100644 backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty diff --git a/backends/pytorch/Makefile.am b/backends/pytorch/Makefile.am index 6511364b3..6f790ecdb 100644 --- a/backends/pytorch/Makefile.am +++ b/backends/pytorch/Makefile.am @@ -139,9 +139,7 @@ TRACE_COMMON = \ tests/basic_op_name-AA.thapi_text_pretty \ tests/basic_op_overload_name-AA.thapi_text_pretty \ tests/nested_ops_simple-ABBA.thapi_text_pretty \ - tests/nested_ops_interleaved-ABAB.thapi_text_pretty \ tests/deeply_nested_ops-ABCCBA.thapi_text_pretty \ - tests/exit_without_entry-A.thapi_text_pretty \ tests/multithreaded_ops-AABB.thapi_text_pretty \ tests/reentrant_op-AAAA.thapi_text_pretty diff --git a/backends/pytorch/btx_pytorchinterval_callbacks.cpp b/backends/pytorch/btx_pytorchinterval_callbacks.cpp index 0f48dd6e8..278fa8f90 100644 --- a/backends/pytorch/btx_pytorchinterval_callbacks.cpp +++ b/backends/pytorch/btx_pytorchinterval_callbacks.cpp @@ -1,4 +1,5 @@ #include "xprof_utils.hpp" +#include #include #include #include @@ -6,7 +7,7 @@ // PyTorch requies a per-thread LIFO stack since there is reentrace and nesting calls. struct data_s { - std::unordered_map>> entry_stack; + std::unordered_map> entry_stack; }; typedef struct data_s data_t; @@ -28,8 +29,7 @@ static void lttng_ust_pytorch_op_entry_callback(void *btx_handle, uint64_t vtid, char *name, char *overload_name) { - static_cast(usr_data)->entry_stack[{hostname, vpid, vtid}].push_back( - {qualified_name(name, overload_name), ts}); + static_cast(usr_data)->entry_stack[{hostname, vpid, vtid}].push_back(ts); } static void lttng_ust_pytorch_op_exit_callback(void *btx_handle, @@ -43,17 +43,12 @@ static void lttng_ust_pytorch_op_exit_callback(void *btx_handle, auto *state = static_cast(usr_data); auto &stack = state->entry_stack[{hostname, vpid, vtid}]; - const std::string exit_name = qualified_name(name, overload_name); - // Empty stack means underflow; name mismatch means non-LIFO exit order - const bool err = stack.empty() || stack.back().first != exit_name; - int64_t entry_ts = ts; - if (!stack.empty()) { - entry_ts = stack.back().second; - stack.pop_back(); - } + assert(!stack.empty() && "op_exit with no matching op_entry"); + const int64_t entry_ts = stack.back(); + stack.pop_back(); btx_push_message_lttng_host(btx_handle, hostname, vpid, vtid, entry_ts, BACKEND_PYTORCH, - exit_name.c_str(), (ts - entry_ts), err); + qualified_name(name, overload_name).c_str(), (ts - entry_ts), false); } void btx_register_usr_callbacks(void *btx_handle) { diff --git a/backends/pytorch/tests/README.md b/backends/pytorch/tests/README.md index 046b0872b..7f9215b09 100644 --- a/backends/pytorch/tests/README.md +++ b/backends/pytorch/tests/README.md @@ -5,8 +5,6 @@ | **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). | -| **nested_ops_interleaved-ABAB** | Non LIFO stack error handling (ABAB) | Validates error flag is set when an exit name does not match the top of the stack. | | **deeply_nested_ops-ABCCBA** | Stack depth handling | Validates LIFO stack correctly handles three levels of nesting (forward→linear→matmul). | -| **exit_without_entry-A** | Stack underflow | Validates error flag is set when an exit event arrives with no matching entry on the stack. | | **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). | diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty deleted file mode 100644 index 8783e2400..000000000 --- a/backends/pytorch/tests/nested_ops_interleaved-ABAB.bt_text_pretty +++ /dev/null @@ -1,2 +0,0 @@ -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110401000000000, backend = 10 }, { name = "aten::add.Tensor", dur = 1000000000, err = true } -lttng:host: { hostname = "testhost", vpid = 1, vtid = 1, ts = 1704110400000000000, backend = 10 }, { name = "aten::mul.Tensor", dur = 3000000000, err = true } diff --git a/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty b/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty deleted file mode 100644 index e6b481713..000000000 --- a/backends/pytorch/tests/nested_ops_interleaved-ABAB.thapi_text_pretty +++ /dev/null @@ -1,4 +0,0 @@ -12:00:00.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::add", overload_name: "Tensor" } -12:00:01.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_entry: { name: "aten::mul", overload_name: "Tensor" } -12:00:02.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::add", overload_name: "Tensor" } -12:00:03.000000000 - testhost - vpid: 1, vtid: 1 - lttng_ust_pytorch:op_exit: { name: "aten::mul", overload_name: "Tensor" }