Add unit tests for TraceLens.TreePerf - #920
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
|
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>
|
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 |
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>
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>
Summary
tests/test_treeperf.pycoveringGPUEventAnalyser,JaxAnalyses,TreePerfAnalyzer, andJaxTreePerfAnalyzerwith synthetic CPU-safe traces.@pytest.mark.gpulive-profile tests (skipped in CPU-only CI viaimportorskip+ CUDA check).Test plan
pytest tests/test_treeperf.py -m "not gpu"(48 passed)Made with Cursor
After #905