Documentation
¶
Overview ¶
Package overview summarizes and compares GPU kernel pprof profiles against regex op-classification rules and renders self-contained, zero-CDN HTML overview reports with inline SVG breakdowns, per-op delta bars, staging memcpy callouts, top kernel tables, and SHA-256 provenance footers.
This package is outside the compatibility promise of github.com/tmc/lib/nvidia. Its API may change or be removed in patch releases.
Index ¶
- Constants
- func ClassifyKernel(kernel string, rules []OpRule) string
- func KernelKey(name string) string
- func RenderOverviewHTML(report CompareReport) string
- func RenderSingleHTML(sum ProfileSummary) string
- type CompareReport
- type KernelRow
- type OpBreakdown
- type OpDelta
- type OpRule
- type ProfileSummary
- type ReloadPoint
- type SummarizeOptions
Constants ¶
const UnmatchedOp = "(unmatched)"
UnmatchedOp is the reserved op class returned when no OpRule matches a kernel key.
Variables ¶
This section is empty.
Functions ¶
func ClassifyKernel ¶
ClassifyKernel returns the first matching op class for kernel in rules, or UnmatchedOp if no rule matches.
func KernelKey ¶
KernelKey normalizes a raw or mangled CUDA kernel symbol into a demangled key without parameter lists or template arguments.
func RenderOverviewHTML ¶
func RenderOverviewHTML(report CompareReport) string
RenderOverviewHTML renders a self-contained, zero-CDN HTML comparison report containing inline SVG stacked proportional op breakdown, per-op delta bars, staging memcpy callout, top kernels tables, optional reload history, and SHA-256 provenance footer.
func RenderSingleHTML ¶
func RenderSingleHTML(sum ProfileSummary) string
RenderSingleHTML renders a self-contained, zero-CDN HTML overview for a single ProfileSummary.
Types ¶
type CompareReport ¶
type CompareReport struct {
Title string `json:"title,omitempty"`
Baseline ProfileSummary `json:"baseline"`
Target ProfileSummary `json:"target"`
SpeedupX float64 `json:"speedup_x"`
StepDeltaUs float64 `json:"step_delta_us"`
StepDeltaPct float64 `json:"step_delta_pct"`
LaunchReductionX float64 `json:"launch_reduction_x"`
StagingSaved int64 `json:"staging_saved"`
PerOpDeltas []OpDelta `json:"per_op_deltas"`
History []ReloadPoint `json:"history,omitempty"`
}
CompareReport holds the comparison between a baseline and target ProfileSummary.
func Compare ¶
func Compare(baseline, target ProfileSummary) CompareReport
Compare computes a CompareReport contrasting baseline and target ProfileSummaries.
type KernelRow ¶
type KernelRow struct {
Kernel string `json:"kernel"`
Op string `json:"op"`
Launches int64 `json:"launches"`
TotalUs float64 `json:"total_us"`
UsPerStep float64 `json:"us_per_step"`
MeanUs float64 `json:"mean_us"`
LaunchMode string `json:"launch_mode"` // "graphed", "eager", "mixed"
}
KernelRow summarizes a single normalized CUDA kernel in a profile.
type OpBreakdown ¶
type OpBreakdown struct {
Op string `json:"op"`
UsPerStep float64 `json:"us_per_step"`
TotalUs float64 `json:"total_us"`
LaunchesPerStep float64 `json:"launches_per_step"`
Launches int64 `json:"launches"`
MeanUs float64 `json:"mean_us"`
}
OpBreakdown summarizes GPU time and launch counts for a single op class.
type OpDelta ¶
type OpDelta struct {
Op string `json:"op"`
BaselineUs float64 `json:"baseline_us"`
TargetUs float64 `json:"target_us"`
DeltaUs float64 `json:"delta_us"`
DeltaPct float64 `json:"delta_pct"`
BaselineLaunches float64 `json:"baseline_launches"`
TargetLaunches float64 `json:"target_launches"`
}
OpDelta records the per-step delta for a single op class between Baseline and Target.
type OpRule ¶
OpRule is a parsed regex-to-op mapping line from an ops rules table.
func ParseOpsRules ¶
ParseOpsRules parses first-match-wins regex-to-op mapping rules from opsText.
Blank lines, `#` comments, and combine declarations (`op = term ...`) are ignored. Each rule line consists of a Go regular expression (optionally quoted with "..." or `...`) followed by whitespace and an op name. The op name "(unmatched)" is reserved and rejected.
type ProfileSummary ¶
type ProfileSummary struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Source string `json:"source,omitempty"`
SHA256 string `json:"sha256,omitempty"`
SourceName string `json:"source_name,omitempty"`
StepUs float64 `json:"step_us"`
SummedKernelUs float64 `json:"summed_kernel_us"`
StepLaunches float64 `json:"step_launches"`
Replays int `json:"replays"`
UniqueKernels int `json:"unique_kernels"`
TotalLaunches int64 `json:"total_launches"`
EagerLaunches int64 `json:"eager_launches"`
GraphedLaunches int64 `json:"graphed_launches"`
StagingMemcpy int64 `json:"staging_memcpy"`
UnmatchedKernels []string `json:"unmatched_kernels"`
Ops []OpBreakdown `json:"ops"`
TopKernels []KernelRow `json:"top_kernels"`
}
ProfileSummary is a model-agnostic summary of a GPU kernel pprof profile.
func SummarizePprof ¶
func SummarizePprof(pprofBytes []byte, rules []OpRule) (ProfileSummary, error)
SummarizePprof parses a pprof protobuf payload and summarizes kernel op breakdowns, launch counts, graphed vs eager split, staging memcpy launches, and unmatched kernels using rules.
func SummarizePprofWithOptions ¶
func SummarizePprofWithOptions(pprofBytes []byte, rules []OpRule, opts SummarizeOptions) (ProfileSummary, error)
SummarizePprofWithOptions parses pprofBytes with explicit metadata and graph selection options.
func (ProfileSummary) Clone ¶
func (s ProfileSummary) Clone() ProfileSummary
Clone returns a deep copy of ProfileSummary.
type ReloadPoint ¶
type ReloadPoint struct {
Gen int `json:"gen"`
Timestamp string `json:"ts,omitempty"`
Outcome string `json:"outcome"` // "startup", "kept", "refused"
MsPerStep float64 `json:"ms_per_step"`
StepsPerSec float64 `json:"steps_per_sec,omitempty"`
Digest string `json:"digest,omitempty"`
SpeedupX float64 `json:"speedup_x,omitempty"`
DeltaPrevMs float64 `json:"delta_prev_ms,omitempty"`
ReloadTimeS float64 `json:"reload_time_s,omitempty"`
Note string `json:"note,omitempty"`
}
ReloadPoint captures a single hot-reload generation observation in a reload-over-reload performance trend.