Skip to content

fix: preserve bounded counter requests across retries - #238

Open
0z5a wants to merge 1 commit into
NVIDIA:mainfrom
0z5a:fix-bounded-counter-retry
Open

0z5a wants to merge 1 commit into
NVIDIA:mainfrom
0z5a:fix-bounded-counter-retry

Conversation

@0z5a

@0z5a 0z5a commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

A failed compare-and-exchange in add_bounded or sub_bounded can permanently reduce the requested amount before the operation retries. If capacity changes again, a successful retry can leave usable capacity unclaimed. The add path feeds host, device, and disk reserve_upto operations.

Recalculate the bounded amount from the original request on every retry and publish the actual amount only after a successful exchange. Include <algorithm> for the std::min dependency; this overlaps the independent header fix in #236.

Fixes #237.

Validation

  • A concurrent CPU stress reproduction observed an underfilled addition with the original implementation on Clang 21/libc++; five million attempts on the patched implementation showed none. The failure is schedule-dependent, so a passing run is not a proof of absence.
  • A Catch2 regression exercises the add and subtract invariants concurrently and passed when compiled with GCC 13 on Linux. The same stress test did not reproduce the original failure in one Linux run.
  • clang-format passed for the changed C++ files and git diff --check passed. No GPU workload, full project build, or reservation throughput benchmark was run.

Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
@copy-pr-bot

copy-pr-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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.

Bounded counter retries can unnecessarily shrink reservations

1 participant