You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(dynamic_batching): potential hang due to duration calculation - #2976
When the interval between two checks is less than 1 µs, the/ 1000 integer division rounds the delta down to0 , solocal_remaining_time_us_ never decreases. If the device keeps polling faster than once per microsecond, the deadline is never reached and thegather_inputs kernel can spin (hang) indefinitely.
Fix
Track remaining time in nanoseconds asint64_t local_remaining_time_ns_ .
Reviewing files that changed from the base of the PR and between eb44963 and 914d20a.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Improved timeout handling for GPU batching by tracking remaining time with finer precision. This helps batches respond more accurately to remaining time limits, including when combining locally tracked deadlines with time limits supplied by the CPU.
The dynamic batching GPU time keeper now tracks local remaining time in signed 64-bit nanoseconds. It subtracts elapsed nanoseconds and converts the CPU-provided remaining time from microseconds before comparing deadlines.
Changes: Dynamic batching timeout tracking
Layer / File(s)
Summary
Track and check remaining time cpp/src/neighbors/detail/dynamic_batching.cuh
The local remaining-time counter changes from signed 32-bit microseconds to signed 64-bit nanoseconds. Elapsed time is subtracted in nanoseconds, and CPU-provided remaining time is converted to nanoseconds before the minimum is taken. Timeout checks use the nanosecond counter.
[CI] NEIGHBORS_DYNAMIC_BATCHING_TEST flaky #2957: The issue reports flaky dynamic batching test failures. This change updates the time tracking used by the gather_inputs wait loop, but the link to the reported failures is not confirmed.
[CI] Flaky test sweep (Sep–Oct 2026): root causes and fix PRs #2783: The issue reports dynamic batching test timeouts and hangs. This change updates the timing path, but the issue says the test issue was already fixed on main, so this PR's contribution is not established.
Suggested labels:bug, C++, non-breaking
Suggested reviewers:achirkin
Merge Risk: Minimal · previous review eb449
No actionable merge-blocking risk was identified in the reviewed change.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title names the fix (a potential hang) and the component it touches (dynamic_batching). It also names the cause (a duration calculation). The raw summary confirms the change converts the remaining…
Description check
The description states the problem: gpu_time_keeper stored remaining time in int32_t microseconds. Integer division rounded sub-microsecond deltas to zero, so the deadline never decreased and gather_i…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the fix (a potential hang) and the component it touches (dynamic_batching). It also names the cause (a duration calculation). The raw summary confirms the change converts the remaining-time tracking in gpu_time_keeper from 32-bit microseconds to 64-bit nanoseconds, which addresses that calculation. The title is specific and matches the main change.
Full details: Description check
Explanation
The description states the problem: gpu_time_keeper stored remaining time in int32_t microseconds. Integer division rounded sub-microsecond deltas to zero, so the deadline never decreased and gather_inputs could spin. It also states the fix: track remaining time as int64_t local_remaining_time_ns_. This matches the file-level summary and the PR objectives.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 44df703 and eb44963.
Files selected for processing: 1
cpp/src/neighbors/detail/dynamic_batching.cuh
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gpu_time_keepertracked the remaining deadline inint32_tmicroseconds. Between twohas_time()checks the elapsed time was computed as:When the interval between two checks is less than 1 µs, the
/ 1000integer division rounds the delta down to0, solocal_remaining_time_us_never decreases. If the device keeps polling faster than once per microsecond, the deadline is never reached and thegather_inputskernel can spin (hang) indefinitely.Fix
Track remaining time in nanoseconds as
int64_t local_remaining_time_ns_.