Skip to content

bench: the PC-sampling overhead harness (numbers outstanding) - #91

Open
dpsoft wants to merge 1 commit into
mainfrom
feat/pc-sampling-overhead
Open

bench: the PC-sampling overhead harness (numbers outstanding)#91
dpsoft wants to merge 1 commit into
mainfrom
feat/pc-sampling-overhead

Conversation

@dpsoft

@dpsoft dpsoft commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Task 12 of the GPU PC sampling plan. The harness, not the verdict — CapEff: 0 and no GPU here, and the plan is explicit that "this task cannot be completed without hardware, and no part of the tier decision may be made without it." Every number is outstanding; no arm of this benchmark has ever executed.

A second workload, not an extension

shim/nvidia/testdata/cuda_concurrent.cu (new, make -C shim nvidia-concurrent). cuda_workload.cu stays as it is: it is the serial fixture the adapter, the join, source resolution and the hardware gate's source-line assertions are all proven against, and reshaping it would change what those gates measure. It is also the wrong instrument — a serial loop gives serialization nothing to destroy.

The new one runs N non-blocking streams whose kernel duration comes from a dependency chain rather than a large grid, so they occupy a fraction of the device and genuinely co-reside. Its computation is the exact identity, so max_abs_err must be 0. Compiled here (nvcc 13.3 is on this box) and verified with cuobjdump -sass that the loops survive: exactly two FFMAs, each inside its own backward branch — nothing folded or unrolled.

Realism is measured, not claimed. Concurrency (Σ exec duration / span) and mean kernel duration are computed from the profile, and the run fails if the baseline arm is near-serial or its kernels are microseconds long.

Every arm proves its own mode, from two ends that can disagree

The adapter's stderr report line and the consumer's counters, both recorded in the JSON. Off ⇒ zero PC samples, windows and bursts. Tier B ⇒ samples and no window. Tier A ⇒ bursts ≥ floor, windows reconciling as 2N/2N−1, no start/stop failures, no graph execs, achieved duty inside a bound derived from the burst timer's tick, and at least one execution actually marked serialized. Cross-arm: a lower duty must open strictly fewer bursts.

Any failure withholds the decision object and exits 3. Tier A gaps are pinned from both sides so the clamp interval collapses to a point and an arm cannot drift to a duty nobody configured.

A benchmark arm that silently did not enable the tier it claims would be this project's signature defect wearing a stopwatch.

A flaw in the thresholds, found without any data

cost ÷ duty > 2 is the same statement as cost > 200 × duty percent — so at 2.5% duty it is exactly the 5% wall-clock bar. TIER_A_DEEP_DIVE_ONLY requires ratio > 2 at every duty tested, which includes 2.5%, so it strictly implies TIER_A_UNSHIPPABLE: on the plan's three duties the deep-dive outcome is unreachable whatever the numbers.

No threshold was adjusted — deciding thresholds after seeing their structure is the same error as deciding them after seeing data. The harness applies them as written and prints the coincidence whenever both fire. Adding a 1%-duty arm would make the distinction real; that is a decision for whoever runs it.

The reassuring half is pinned too: on the plan's duties the decision is total — opt-in, smaller-duty, or unshippable — never indeterminate.

Verification

45 offline unit tests: the parsers, medians, the ratio, all four clauses fired and not-fired including exactly-at-the-bar, each arm assertion shown red, the concurrency measurement, and all four skip branches. Without caps: BENCH_SKIPPED: missing required capabilities (CAP_BPF, CAP_PERFMON, CAP_CHECKPOINT_RESTORE)…, exit 0, no output file — and the message names gpuprobe's own set, deliberately not CAP_SYS_ADMIN.

go build, go vet, go test ./... -count=1, golangci-lint all clean; make -C shim test unaffected.

To run it on the 3090

make -C shim nvidia nvidia-concurrent && make bench-build
sudo setcap cap_bpf,cap_perfmon,cap_checkpoint_restore+ep ./bench/cmd/scenario/scenario
make bench-gpu-pc-overhead

~26 fixed-work runs, 15–25 min. Exit 0 means the measurement completed — an honest TIER_A_UNSHIPPABLE is a successful run. Exit 3 means an arm could not prove what it measured, and the numbers are not a decision.

…nd the decision it takes

Plan Task 12. This produces the instrument, not the verdict: the implementer
has CapEff 0 and no GPU, so every number is outstanding and the tier decision
is not made. See .superpowers/sdd/task-12-overhead-report.md.

The baseline arm is the shipping Phase 4 configuration with PC sampling OFF,
not an uninjected run — spec 9.1 already measured injection and the activity
path and those costs are paid either way. An uninjected run is taken once
before the arms, labelled "calibration", never used as a baseline.

The workload is a SECOND one, shim/nvidia/testdata/cuda_concurrent.cu, rather
than a change to cuda_workload.cu: that file is the serial fixture the adapter,
the join and the source resolution are proven against and the hardware gate
asserts against its source lines, and a serial loop gives serialization nothing
to destroy. The new one runs several non-blocking streams of non-trivial
kernels whose duration comes from a dependency chain rather than a large grid,
so they co-reside; its computation is the exact identity, so max_abs_err must
be 0 and an arm that perturbed the result fails the run.

Realism is measured, not claimed: the harness computes kernel concurrency and
mean kernel duration out of the profile and refuses to report anything if the
baseline arm is near-serial or its kernels are microseconds long.

Every arm proves it ran in the mode it claims, from the producer's own report
line and the consumer's counters independently — off means zero PC samples,
zero windows and zero bursts; Tier B means samples and no window at all; Tier A
means bursts, windows reconciling as 2N or 2N-1, an achieved duty inside a
bound derived from the burst timer's tick, and at least one execution actually
marked serialized. Cross-arm, a lower duty must open strictly fewer bursts, or
the three Tier A arms are one arm under three names. Any failure withholds the
decision and exits 3.

The four pre-committed clauses are applied mechanically and the fired ones are
printed. One finding, reported rather than resolved: cost/duty > 2 is the same
statement as cost > 200*duty percent, so at 2.5% duty it is exactly the 5% wall
bar — on the plan's own duties the deep-dive-only clause strictly implies the
unshippable one and can never be the verdict. The harness says so whenever both
fire instead of letting a reader think the branch was considered.

Offline: 45 unit tests over the parsers, medians, ratio, all four clauses, the
arm assertions each shown red, the concurrency measurement and all four skip
branches. Without caps the scenario reports BENCH_SKIPPED, exits 0 and writes
no file.
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