Fix: recover unflushed scope stats records#1054
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughImplements host-side recovery of un-flushed ChangesScopeStats Abnormal-Exit Buffer Recovery
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the profiling framework, specifically the ScopeStatsCollector and TensorDumpCollector, to recover un-flushed current buffers host-side during abnormal exits instead of performing purely passive sanity checks. It also includes corresponding documentation updates and a new unit test suite. The review feedback suggests adding an assertion in the unit test to verify that the read JSONL buffer is not empty before performing substring checks.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/dfx/tensor-dump.md`:
- Around line 604-605: The documentation has contradictory descriptions of
reconcile_counters behavior across multiple sections. In docs/dfx/tensor-dump.md
at lines 604-605, reconcile_counters is described as actively recovering
leftover current_buf_ptr and handling dropped accounting, but the comparison
section at lines 619-623 (and any earlier lifecycle wording it references) still
describes reconcile_counters as passive or identical in behavior. Update the
comparison section at lines 619-623 and any related lifecycle descriptions to
consistently characterize reconcile_counters as an active recovery mechanism
that handles leftover buffers and dropped accounting, matching the description
at the anchor location (lines 604-605).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 80cbad4b-7329-4410-88cb-711363441608
📒 Files selected for processing (9)
docs/dfx/scope-stats.mddocs/dfx/tensor-dump.mddocs/profiling-framework.mdsrc/common/platform/include/host/scope_stats_collector.hsrc/common/platform/include/host/tensor_dump_collector.hsrc/common/platform/shared/host/scope_stats_collector.cppsrc/common/platform/shared/host/tensor_dump_collector.cpptests/ut/cpp/CMakeLists.txttests/ut/cpp/common/test_scope_stats_collector.cpp
f0e3a3f to
26397c3
Compare
- Recover a non-empty current scope_stats buffer during host reconcile so abnormal exits can still export already-recorded samples. - Add a C++ unit test that simulates an unflushed current buffer and verifies recovery is not duplicated. - Update profiling docs and stale tensor dump comments to reflect host-side recovery behavior.
26397c3 to
fcf0d3b
Compare
- Recover a non-empty current scope_stats buffer during host reconcile so abnormal exits can still export already-recorded samples. - Add a C++ unit test that simulates an unflushed current buffer and verifies recovery is not duplicated. - Update profiling docs and stale tensor dump comments to reflect host-side recovery behavior. Co-authored-by: zm <zhaomin88@huawei.com>
Summary
Testing
Fixes #1038