Skip to content

Bounded deep-profiling window + PC sampling collection fixes - #136

Merged
CodingInAVan merged 13 commits into
mainfrom
deep-window
Jul 26, 2026
Merged

Bounded deep-profiling window + PC sampling collection fixes#136
CodingInAVan merged 13 commits into
mainfrom
deep-window

Conversation

@CodingInAVan

@CodingInAVan CodingInAVan commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a bounded deep-profiling window and fixes the PC sampling bugs found while validating it.

Deep window

gpufl::deepWindow() plus gpufl trace --deep-after/--deep-for/--deep-launches/--deep-cooldown,
so a long-running job can be deeply profiled for a slice of its life without editing its source.
Includes unit tests, CLI parse tests, and an e2e script + gpufl-agnostic CUDA target.

PC sampling fixes

Two independent bugs, both of which made --passes PcSampling collect nothing:

  • Reading while armed destroys the data. cuptiPCSamplingGetData on an armed sampler returns
    nothing and discards the buffer. The sampler is now armed once and read once, with sampling
    stopped, at scope end. There is no working mid-run collect: stop/read/restart every second also
    returns 0 and makes the target ~100x slower.
  • Allocating between Enable and configure breaks the session. Doing the buffer allocation in
    that window made SetConfigurationAttribute — and then every later PC sampling call on the
    context — return INVALID_OPERATION, which was being swallowed as benign and logged as success.
    Buffers are now allocated before Enable; configure failures are fatal and name the rejected
    attribute.

Also corrects the guidance: collection scales with kernel-launch count, not wall time
(same 8s window: 876 launches → 0 samples, 2002 → 87.8M), so the 0-sample message and the
--deep-* help now point at --deep-launches. The old message's advice was counterproductive —
a "heavier" workload means fewer launches, and a finer --pc-sample-period cut launches covered
from 992 to 58.

Type of Change

  • Bug fix
  • New feature
  • Documentation update

Testing

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@CodingInAVan
CodingInAVan merged commit f8ff830 into main Jul 26, 2026
4 checks passed
@CodingInAVan
CodingInAVan deleted the deep-window branch July 26, 2026 06:06
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.

1 participant