gpu: the PC-sampling label set - #88
Merged
Merged
Conversation
Task 9 of the PC-sampling plan, minus gpu_serialized.
Every sample projected from a GPUPCSample now carries, on top of the
gpu_stall and gpu_pc it already had:
gpu_pc_attrib how the sample reached this execution - unconditional
gpu_src_status why it does or does not have a source location -
unconditional, four values, decided by ModuleStore alone
gpu_src_file the source file's BASENAME, only under "resolved"
gpu_src_line the source line, only under "resolved"
gpu_src_func the device function, only under "resolved"
The two unconditional ones are unconditional for gpu_join's reason: an
absent label must never be readable as a positive answer by a consumer
who does not know to check for its absence. A nil ModuleStore is answered
by an empty store rather than by a branch here, so the projection never
decides the enum - "no store" and "the cubin never arrived" are the same
fact and get the same answer.
gpu_src_file drops the directory. A cubin's DWARF carries build-host
absolute paths, which vary per build, cost a long string in the string
table for nothing a reader acts on, and leak the build environment's
layout into a profile that may be shared.
ProjectExecutionsWith caps distinct gpu_pc values per projection
(default 20,000 - the top of the range the design already calls
tolerable, reasoned rather than measured). Past the ceiling gpu_pc is
dropped and counted in ProjectionStats.PCLabelsSuppressed; gpu_stall,
gpu_pc_attrib and gpu_src_* survive, and the sample keeps its full share
of the execution's duration. An offset already emitted is always
readmitted - the cap bounds the string table, and a repeat costs it
nothing. JoinHealthWith raises the suppression as an anomaly, because a
profile that silently lost its PC labels looks identical to one that
never had any; both drivers were switched over so the counter is
actually printed.
Reserved names now win by ABSENCE too. The new labels are conditional,
so a producer tag named gpu_src_file would have survived untouched in
exactly the cases where this package derives no value - a forged source
location standing beside gpu_src_status="no-module". projectionLabels
clears every per-PC-sample reserved name straight after the Tags copy,
which also closes the same hole for gpu_stall when no reason was named
and for every one of these names on a no-PC-sample execution.
Frames gain nothing, asserted negatively.
gpu_serialized is deliberately not here: its three values come from Tier
A's sampling windows, which do not exist yet, and the only default it
could take is "false" - the one answer the design says must never be
reachable by accident. Absent is honest; present and meaningless is not.
Seven mutations checked, each caught. See
.superpowers/sdd/task-9-labels-report.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task 9 of the GPU PC sampling plan, minus
gpu_serialized(deferred — see below).ProjectExecutionsWith(snap, ProjectionConfig)beside the unchangedProjectExecutions, same split shape asCountingSink.Snapshot/SnapshotWith. Per PC-derived sample:gpu_pc_attribandgpu_src_statusunconditionally,gpu_src_file/_line/_funconly underresolved.gpu_pcandgpu_stallunchanged in form. Frames gain nothing — a negative test asserts no frame name containsgpu:pc,gpu:srcor any stall-reason string.The anti-forgery rule needed strengthening, and the reason is new
Overwriting reserved names was sufficient while every label was unconditional. It is not once they are conditional: a producer tag named
gpu_src_filesurvives exactly where the projection derives nothing — a forged source location sitting besidegpu_src_status="no-module".projectionLabelsnow clears all seven reserved per-sample names right after theTagscopy. Reserved names win by absence as well as by value. That also closes the same pre-existing hole forgpu_stallwhen the producer named no reason, and for all of them on an execution with no PC samples.Three decisions
A nil is answered by an empty store, not a branch. Task 4's "the store is the single place
gpu_src_statusis decided" stays structurally true, and "no store configured" yields the same honestno-moduleas "the cubin never arrived". Bothcmd/drivers are still nil today, so their profiles readno-moduleeverywhere — which points at the missing wiring instead of looking like a pre-Phase-6 profile.gpu_src_fileis the basename, viapath.Base— notfilepath.Base, because the separator belongs to the build host, not the agent. Full paths vary per build, inflate the string table for no reader benefit, and leak build-environment layout into a profile that may be shared. The fixtures resolve to/tmp/perf-agent-cubin-fixtures/single.cu, so the test fails the moment a directory survives.gpu_pc_attribrenders"unset-pc-attrib"for a PC-bearing view the join left undecided, mirroringSrcStatus's"unset-src-status". Omitting it would hide a join bug behind the one reading (exact) that claims vendor truth.The cap drops the numerous label, not the useful one
ProjectionConfig.MaxDistinctPCLabels, default 20,000 — reasoned, not measured: the top of the range the plan's own size estimate calls tolerable. Past it onlygpu_pcgives way; the sample keeps its weight and every other label, becausegpu_stallandgpu_src_*are coarser and more actionable. An offset already emitted is always readmitted, since the cap bounds the pprof string table and a repeat costs it nothing.Suppressions land in
ProjectionStats.PCLabelsSuppressed, are raised as an anomaly by the newJoinHealthWith, and both drivers were switched over so the counter is actually printed — a profile that silently lost its PC labels looks identical to one that never had them.is deferred, and absent
Not emitted, not stubbed, no placeholder. Its values come from Task 10's sampling windows, and the only default available is
"false"— which the design names as the one answer that must never be reachable by accident. Report §7 states the follow-up: it rides on every execution, so it belongs inprojectionLabels' shared map, set after theTagscopy, with the anti-forgery test extended.Verification
All four
gpu_src_statusvalues, all fourgpu_pc_attribvalues,kernel-ambiguousnever coinciding withgpu_ambiguous="true", aTagsentry losing to the derived value, the cap suppressinggpu_pcand onlygpu_pcwith an exact count, and the negative frame test.Seven mutations applied one at a time, each caught — including the cap dropping
gpu_stall, the status made conditional, the directory kept, and the reserved-name clearing removed.Cannot verify
The real distinct-value counts per label, which is what would turn the 20,000 ceiling into a measured number —
DistinctPCLabelsbesidePCLabelCapis the instrument.Inherited and load-bearing: that
functionIndexis the.symtabindex, and thatpcOffsetis function-relative in the sense the line table is — the one failure in this set that is not self-announcing, because a wrongresolvedline looks exactly like a right one.