test: add comprehensive Diagnostics integration tests - #777
Conversation
Add 98 integration tests for the Diagnostics module covering: MemoryTracker: - Enable/disable functionality - Snapshot creation and comparison - History tracking - Reset functionality - Memory pressure level detection - Memory estimation ProfilerSession: - Enable/disable functionality - Scope-based profiling - Timer-based profiling - Reset functionality - Report generation - Statistics calculation ProfileReport: - JSON/CSV/Markdown export - Report comparison - Operation statistics Integration scenarios: - Memory tracking during allocations - Profiling during simulated workloads - Combined memory and profiler usage Fixes #653 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughA comprehensive integration test suite for the Diagnostics module is introduced, validating MemoryTracker, MemorySnapshot, MemoryDiff, MemoryPressureLevel, ProfilerSession, ProfilingConfig, and profiling report generation across multiple formats, statistics computation, profile comparison, and multi-threaded scenarios. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
…t NHWC) Engine.GridSample is uniformly NCHW (PyTorch F.grid_sample convention, standardized in Tensors #777): both CPU overloads, the GPU override, and GridSampleGpu all take [N,C,H,W] and return [N,C,outH,outW]. All seven callers wrongly permuted their image/feature input to NHWC before sampling (a stale assumption from when the engine was NHWC, flipped by #777), which re-labelled the H dim as "channels". Most passed loose invariants with geometrically-wrong warps; BasicVSR++/SpyNet threw IndexOutOfRange at the degenerate 2x2 pyramid level (3-channel frame warped into 2 "channels"). Fix: pass the channels-first tensor directly; the grid is [B,outH,outW,2] regardless of image layout, so it is unchanged. SpatialTransformer's CPU and GPU forward paths are reworked to channels-first (localization reduces over the channel axis; output permuted to NHWC only for channel-last callers). SpyNet also drops its redundant private _engine (which pinned it to CpuEngine) in favour of the base LayerBase.Engine property. Verified (net10.0, GPU disabled): BasicVSR++ 27/27, FILM 27/27, RIFE 27/27, UPRNet 27/27, RAFT 27/27, SpyNet 10/10, SpatialTransformer 10/10. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…t NHWC) Engine.GridSample is uniformly NCHW (PyTorch F.grid_sample convention, standardized in Tensors #777): both CPU overloads, the GPU override, and GridSampleGpu all take [N,C,H,W] and return [N,C,outH,outW]. All seven callers wrongly permuted their image/feature input to NHWC before sampling (a stale assumption from when the engine was NHWC, flipped by #777), which re-labelled the H dim as "channels". Most passed loose invariants with geometrically-wrong warps; BasicVSR++/SpyNet threw IndexOutOfRange at the degenerate 2x2 pyramid level (3-channel frame warped into 2 "channels"). Fix: pass the channels-first tensor directly; the grid is [B,outH,outW,2] regardless of image layout, so it is unchanged. SpatialTransformer's CPU and GPU forward paths are reworked to channels-first (localization reduces over the channel axis; output permuted to NHWC only for channel-last callers). SpyNet also drops its redundant private _engine (which pinned it to CpuEngine) in favour of the base LayerBase.Engine property. Verified (net10.0, GPU disabled): BasicVSR++ 27/27, FILM 27/27, RIFE 27/27, UPRNet 27/27, RAFT 27/27, SpyNet 10/10, SpatialTransformer 10/10. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>



Summary
Test Coverage
MemoryTracker (24 tests)
MemorySnapshot & MemoryDiff (12 tests)
ProfilerSession (25 tests)
ProfileReport (20 tests)
Integration Scenarios (17 tests)
Test Results
Fixes #653
🤖 Generated with Claude Code