Skip to content

Fix missing CUDA coverage note for default profiling activities - #170

Open
huawanrr wants to merge 1 commit into
InferMatrixLab:mainfrom
huawanrr:fix-profile-cuda-coverage-note
Open

huawanrr wants to merge 1 commit into
InferMatrixLab:mainfrom
huawanrr:fix-profile-cuda-coverage-note

Conversation

@huawanrr

@huawanrr huawanrr commented Nov 4, 2026

Copy link
Copy Markdown

Required human contributor answers

1. What outcome are you trying to achieve?

Make default and explicit profiling configurations produce consistent coverage notes under the same collection conditions, so users can interpret the results clearly.

2. What is the highest-leverage variable for that outcome?

Correctly distinguish None, which requests automatic activity selection, from the activities that were actually selected for the session.

3. How will this work move that variable rather than create busywork?

Use the resolved activities when deciding whether missing CUDA device events require a coverage note. This lets automatically selected CUDA collection receive the same diagnostic as explicit CUDA collection.

4. Who is the customer or user, and what do they actually need?

The users are developers inspecting profiling results. They need a clear indication of whether their capture contains GPU device events.

PR necessity and bugfix evidence

A PR is needed: the default configuration omits an existing diagnostic that explicit CUDA activities correctly produce. Requiring explicit activities would leave the default path incorrect.

The contributor reproduced the failure and verified the fix on a rented Linux GPU server using the same script and environment. See the before/after results below; the accompanying evidence archive contains both complete captures and the exact reproducer. This is real GPU collection, not a replay of old traces.

Purpose

When activities are omitted on a CUDA device, ProfileSession resolves them to CPU and CUDA, but config.activities remains null. The summary parser checks that raw setting and misses the note when the capture contains no device events.

Use the top-level resolved activities. Fall back to config.activities only if that field is absent, preserving older metadata. A present empty list remains authoritative. CPU-only collection remains exempt; kernel, gpu_memcpy, and gpu_memset events suppress the note as before.

Scope: one diagnostic condition in vllm_rlt/profiling_artifacts.py and a parameterized CPU regression in tests/test_profiling.py. No capture, scheduling, model execution, or event timing changes.

Test Plan

  • Exercise 12 metadata configurations against four device-event cases (48 CPU regression cases), including defaults, explicit settings, precedence, empty/missing fields, and kernel/memcpy/memset presence.
  • Run the same real ProfileSession reproducer on the baseline and fix: six isolated capture cases per revision.
  • Independently verify archive and member hashes, raw trace counts, summary notes, metadata, successful completion, and source identity.
  • Run profiling tests, Ruff, the full CPU suite, and pre-commit; disclose the baseline-reproducible failure below.

vllm-rlt Version / Commit:

  • Baseline: 989921a.
  • Fix: 588c687.
  • Script SHA256: 8588c92435624e943b85723a541fe28c404ca101f7b726c0e4733ccf142f5aec.

Test Result

GPU runs on 2026-11-04: NVIDIA GeForce RTX 4090 D, driver 570.124.06, Python 3.12.3, PyTorch 2.6.0a0+ecf3bae40a.nv25.01, CUDA runtime 12.8. Both recorded working trees were clean; the script and source hashes remained unchanged during each run.

Case Device events before / after Coverage note before / after Result before / after
Default CUDA, CPU work 0 / 0 Missing / Present FAIL / PASS
Explicit CPU + CUDA, CPU work 0 / 0 Present / Present PASS / PASS
CPU-only activities on CUDA 0 / 0 Absent / Absent PASS / PASS
Default CPU 0 / 0 Absent / Absent PASS / PASS
Default CUDA, GPU work 20 / 20 valid kernels Absent / Absent PASS / PASS
Explicit CPU + CUDA, GPU work 20 / 20 valid kernels Absent / Absent PASS / PASS

Baseline: REPRODUCED, exit 1 (the reproducer's intentional bug-detected code). Fix: NOT_REPRODUCED, exit 0, all six cases passed. Independent raw event counts matched the summaries in all 12 captures, and all archive/member checksums passed.

CPU validation previously run at this same fix, with retained logs (Windows, Python 3.13.3, PyTorch 2.14.0+cpu, pytest 9.1.1, Ruff 0.13.2):

  • New regression on baseline: 4 failed, 44 passed (default omission and three resolved-field precedence checks).
  • Profiling tests: 69 passed.
  • Ruff lint and format: passed.
  • Full CPU suite: 958 passed, 584 skipped, 1 failed.
  • pre-commit: Ruff passed; CPU hook had the same failure. This run is not fully green.

The failure is tests/test_ouro.py::test_packed_prefill_matches_dense_at_every_depth[2]. The same test failed on an unmodified baseline in the same environment with identical differences: 2/160 elements, maximum absolute difference 7.033348083496094e-06 and relative difference 0.0001258739794138819. No tolerances were changed. Skipped tests are not validated. Linux CI for this PR remains to be checked.

Performance review: this adds one metadata lookup per parsed trace in artifact postprocessing. It adds no GPU work or inference-loop operation. No throughput/latency improvement is claimed; inference performance benchmarking is not applicable to this diagnostic-only fix.

Code-quality review: reuse the session's resolved configuration (R02/R14), retain explicit compatibility, and keep the change local (R01/R08). Inferring collection intent from the CUDA device alone would incorrectly warn for explicit CPU-only collection. No additional abstraction or unrelated refactor was warranted.

profiling-cuda-warning-evidence.zip

Copilot AI balanced review requested due to automatic review settings November 4, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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