Skip to content

Add unit tests for TraceLens.TreePerf - #920

Merged
gabeweisz merged 9 commits into
mainfrom
feat/gw_treeperf_tests
Aug 12, 2026
Merged

Add unit tests for TraceLens.TreePerf#920
gabeweisz merged 9 commits into
mainfrom
feat/gw_treeperf_tests

Conversation

@gabeweisz

@gabeweisz gabeweisz commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add tests/test_treeperf.py covering GPUEventAnalyser, JaxAnalyses, TreePerfAnalyzer, and JaxTreePerfAnalyzer with synthetic CPU-safe traces.
  • Include optional @pytest.mark.gpu live-profile tests (skipped in CPU-only CI via importorskip + CUDA check).

Test plan

  • pytest tests/test_treeperf.py -m "not gpu" (48 passed)
  • black and ruff pass
  • CI unit tests pass

Made with Cursor

After #905

gabeweisz and others added 5 commits August 7, 2026 06:06
Cover GPUEventAnalyser, JaxAnalyses, TreePerfAnalyzer helpers, and
JaxTreePerfAnalyzer metadata paths with CPU-only synthetic traces.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Cover tree_perf.py, jax_analyses.py, and gpu_event_analyser.py with
CPU-safe synthetic tests plus @pytest.mark.gpu live CUDA profile tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The @pytest.mark.gpu registration belongs in #905; TreePerf GPU tests
already skip via importorskip and CUDA availability checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov-commenter

codecov-commenter commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@ajassani

Copy link
Copy Markdown
Collaborator

test_gpu_event_analyser_compute_metrics_on_live_trace is always skipped in the current unit-test job because PyTorch is not installed, so it contributes no CI coverage. Since the repository already has committed trace-based tests for the analyzer path, can we remove this test? If we want to preserve the current-PyTorch-profiler compatibility check, it would be more useful in a dedicated GPU integration suite that installs PyTorch and actually runs it.

@gabeweisz

Copy link
Copy Markdown
Collaborator Author

I was adding so it is ready when we actually do have GPUs for CI. But if you want we can remove it - it might interfere with the codecov

The test always skipped in CI because PyTorch is not installed in the
unit-test job, so it added no coverage. GPUEventAnalyser is already
covered by synthetic trace-based tests in this file.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ajassani

ajassani commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Agreed—let’s keep it for future GPU CI. It shouldn’t materially affect Codecov because TraceLens post-processes profiler output, and the stored-trace tests already cover the same analyzer paths. When GPU CI arrives, we should centralize live-trace generation rather than duplicate profiler setup here; EventReplay already has the profile_resnet trace-generation function that we can reuse or generalize.

Comment thread tests/test_treeperf.py Outdated
@gabeweisz

Copy link
Copy Markdown
Collaborator Author

Agreed—let’s keep it for future GPU CI. It shouldn’t materially affect Codecov because TraceLens post-processes profiler output, and the stored-trace tests already cover the same analyzer paths. When GPU CI arrives, we should centralize live-trace generation rather than duplicate profiler setup here; EventReplay already has the profile_resnet trace-generation function that we can reuse or generalize.

I already removed it but we can recreate later

Use the committed SGLang prefill/decode trace to validate
build_nn_module_latency_tree against a real nested module hierarchy
instead of a synthetic test that was always skipped in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gabeweisz
gabeweisz requested a review from ajassani August 12, 2026 00:50
Verify recursive GPU time attribution for Qwen3DecoderLayer and
Qwen3Attention children, including non-module GPU time on leaf modules.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gabeweisz
gabeweisz merged commit abedc2c into main Aug 12, 2026
5 checks passed
@gabeweisz
gabeweisz deleted the feat/gw_treeperf_tests branch August 12, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants