overview

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func ClassifyKernel(kernel string, rules []OpRule) string

ClassifyKernel returns the first matching op class for kernel in rules, or UnmatchedOp if no rule matches.

func KernelKey

func KernelKey(name string) string

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"`
	SharePct   float64 `json:"share_pct"`
	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"`
	SharePct        float64 `json:"share_pct"`
}

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"`
	BaselineSharePct float64 `json:"baseline_share_pct"`
	TargetSharePct   float64 `json:"target_share_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

type OpRule struct {
	Line    int
	Pattern string
	Op      string
	// contains filtered or unexported fields
}

OpRule is a parsed regex-to-op mapping line from an ops rules table.

func ParseOpsRules

func ParseOpsRules(opsText string) ([]OpRule, error)

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.

func (OpRule) Match

func (r OpRule) Match(kernel string) bool

Match reports whether r matches kernel.

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.

type SummarizeOptions

type SummarizeOptions struct {
	ID                   string
	Name                 string
	Source               string
	PrimaryGraphID       int
	IncludeAllInOps      bool
	AllowLabelOpFallback bool
}

SummarizeOptions customizes SummarizePprofWithOptions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL