Skip to content

[https://nvbugs/6337231][fix] Replace all 9 self._is_stats_dummy_request(req) calls with…#15489

Open
tensorrt-cicd wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6337231
Open

[https://nvbugs/6337231][fix] Replace all 9 self._is_stats_dummy_request(req) calls with…#15489
tensorrt-cicd wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6337231

Conversation

@tensorrt-cicd

@tensorrt-cicd tensorrt-cicd commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: _is_stats_dummy_request is a @staticmethod but call sites used self._is_stats_dummy_request(req); with the unit test's MagicMock fake self, that returns a truthy child Mock, so every request was filtered as a dummy and KV-token counters became 0.
  • Fix: Replace all 9 self._is_stats_dummy_request(req) calls with PyExecutor._is_stats_dummy_request(req) — the conventional class-level access for staticmethods, identical behavior in production, and lets the unbound _update_iter_stats(fake_self, ...) tests exercise the real predicate.
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Summary by CodeRabbit

  • Refactor
    • Standardized internal statistics tracking for request processing across context, generation, and batching execution paths to ensure consistent accounting.

…agicMock dispatch

The predicate _is_stats_dummy_request was promoted from a closure to a
@staticmethod in PR NVIDIA#14922 but call sites still invoke it via
self._is_stats_dummy_request(req). This works in production because Python's
descriptor protocol resolves the staticmethod on a real PyExecutor instance.

The unit tests in tests/unittest/pyexecutor/test_iter_stats_populate.py call
PyExecutor._update_iter_stats unbound against a MagicMock fake self. With
MagicMock, self._is_stats_dummy_request(req) auto-generates a child Mock and
returns another truthy Mock, so every request is filtered as a dummy and the
KV-token-weighted counters (num_ctx_kv_tokens, num_gen_kv_tokens,
num_paused_kv_tokens) end up 0.

Replace all 9 call sites with PyExecutor._is_stats_dummy_request(req). This
is the conventional way to access a staticmethod, decouples it from self,
and lets the regression-guard tests exercise the real predicate without
patching every internal helper name on the mock.

Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d8362e82-5018-493a-80ba-16b48c66651d

📥 Commits

Reviewing files that changed from the base of the PR and between 2a18bd4 and e4e9fd2.

📒 Files selected for processing (1)
  • tensorrt_llm/_torch/pyexecutor/py_executor.py

📝 Walkthrough

Walkthrough

In py_executor.py, five stat aggregation call sites are updated to invoke PyExecutor._is_stats_dummy_request as a static method rather than through self. The affected paths cover request counting in schedule_batch, inflight batch counters under attention-DP, and KV token accumulation loops for context, generation, and paused requests.

Changes

Dummy Request Filtering — Static Helper Substitution

Layer / File(s) Summary
Static helper substitution across all stat aggregation paths
tensorrt_llm/_torch/pyexecutor/py_executor.py
schedule_batch request counters (context, generation, paused), attention-DP inflight batch counters, and KV token accumulation loops (ctx, gen, paused) all replace self._is_stats_dummy_request with PyExecutor._is_stats_dummy_request.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title references the main change (replacing 9 calls to self._is_stats_dummy_request with PyExecutor._is_stats_dummy_request) and includes the NVBugs ticket and [fix] type tag following the repository template.
Description check ✅ Passed The description provides a clear root cause analysis, explains the fix, lists test verification steps, and includes bug links. However, it is missing the formal Description and Test Coverage sections specified in the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants