capturefiles

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: 14 Imported by: 0 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 capturefiles reads the files a CUDA capture carries beside its profile: the PTX and SASS listings, register pressure, tileiras remarks and the capture status.

It holds the lookups that cudaprof's subcommands share with the analysis packages under x/cudaprof, so that each reads a capture's files the same way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeMissingCode

func DescribeMissingCode(missing []MissingCode) string

DescribeMissingCode summarizes missing by reason, largest group first: "2419 loaded modules, 321.6 MB: 2418 over total module budget (200.7 MB), 1 over per-module budget (121.0 MB)". It is "" when missing is empty.

A loaded module is not a used one: a PyTorch process loads a module per compiled Triton kernel and per autotuning candidate, and most never run. DescribeMissingLaunches says which of them ran.

func DescribeMissingLaunches

func DescribeMissingLaunches(missing []MissingCode, launches *ModuleLaunches) string

DescribeMissingLaunches says which of the missing modules ran captured kernel launches: "3 of those modules (23.3 MB) ran captured kernel launches; 3739 of 3904 launches (3495 in CUDA graphs) name no module and may have run from the others". It is "" when missing is empty or launches is nil.

func DescribeModuleCodeAccounting

func DescribeModuleCodeAccounting(a *ModuleCodeAccounting) string

DescribeModuleCodeAccounting formats a concise single-line summary of module code coverage (stored vs total, effective budget, filter/active mode, and exact skipped-by-filter / skipped-by-budget counts and bytes).

func Failure

func Failure(cap *cudaprof.Capture) (string, bool)

Failure reports whether an artifact records a capture that did not succeed, and describes it in terms a reader can act on: the outcome names which transport gave up, and capture_error names the stage it gave up at. "transport-failed" alone is a token, not a diagnosis.

func IKET

func IKET(cap *cudaprof.Capture) (*iket.Trace, string, error)

IKET returns the IKET trace a capture carries and the name of the file it was read from, or (nil, "", nil) when the capture carries none. If two or more candidate IKET trace files exist in cap.Files, IKET fails closed with an error naming all candidates in sorted order.

func IKETDAG

func IKETDAG(cap *cudaprof.Capture) (*iket.DAG, string, error)

IKETDAG returns the compile-time IKET dependency DAG a capture carries and the name of the file it was read from, or (nil, "", nil) when the capture carries none. If two or more candidate DAG files exist in cap.Files, IKETDAG fails closed with an error naming all candidates in sorted order.

func Instruction

func Instruction(inst sass.Instruction) string

Instruction formats inst as one line of SASS.

func LoadCode

LoadCode loads a capture's code tiers and separates a source-fusion failure from every other load failure.

Since [cudacapture.LoadCode] began returning tiers rather than all or nothing, a source-fusion failure comes back alongside a usable Code whose source attribution has been zeroed: every instruction's file is empty and its line is 0 because the binding between the PTX and the SASS was refused, not because the compiler located nothing. Those two states are indistinguishable once rendered, so a caller that discards the error prints the refusal as if it were the answer. The failure is returned separately here so each caller states it in whatever channel its own output has.

A nonnil error is every other load failure. Callers that already tolerate a nil Code keep doing so; the error is returned rather than dropped so they can say which tier they are rendering without.

func LocationPC

func LocationPC(loc *profile.Location, s *profile.Sample, code *cudaprof.Code, disasm *sass.Disassembly) (string, uint64)

LocationPC resolves a sampled location to the kernel it is in and its PC offset from that kernel's start: the sample's pc_offset label when it has one, else the location placed using code or, failing that, disasm.

func PTX

func PTX(cap *cudaprof.Capture) ([]byte, string, error)

PTX returns the PTX listing a capture carries and its file name: the file the capture's code names, else kernels.ptx, else any .ptx file. It returns nil data when there is none; the error is always nil.

func Pressure

func Pressure(cap *cudaprof.Capture) (*sass.Disassembly, error)

Pressure parses the capture's SASS listing and joins to it the register life-range counts found in a separate file or in the listing itself.

func Remarks

func Remarks(cap *cudaprof.Capture) ([]tileir.Remark, string, error)

Remarks returns the tileiras remarks a capture carries and the name of the file they were read from, or nil when it carries none.

func SASS

func SASS(cap *cudaprof.Capture) ([]byte, bool)

SASS returns the SASS listing a capture carries: the file the capture's code names, else kernels.sass, else any .sass file.

func Status

func Status(cap *cudaprof.Capture) map[string]any

Status returns the capture-status.json object carried by an artifact, unwrapping the optional "status" nesting.

Types

type MissingCode

type MissingCode struct {
	Name   string // the image's file name, when it had one
	Module uint32 // the driver's id of the module, or 0
	Bytes  int64
	Reason string
}

MissingCode is a module image a capture recorded loading and did not keep because it did not fit a budget (or was excluded by a filter).

func FilteredModuleCode

func FilteredModuleCode(cap *cudaprof.Capture) []MissingCode

FilteredModuleCode returns the module images cap skipped because of an explicit module filter or active-module filter.

func MissingModuleCode

func MissingModuleCode(cap *cudaprof.Capture) []MissingCode

MissingModuleCode returns the module images cap did not keep for a budget. The agent drops an image over its per-module limit or past its total, and records it in the status's modules list with stored false; the capture drops a CUBIN over its own file or total budget, and records it in omitted_files.

type ModuleCodeAccounting

type ModuleCodeAccounting struct {
	BudgetBytes            int64  `json:"budget_bytes"`
	MaxEntryBytes          int64  `json:"max_entry_bytes"`
	Filter                 string `json:"filter,omitempty"`
	ActiveModulesOnly      bool   `json:"active_modules_only,omitempty"`
	TotalModules           int    `json:"total_modules"`
	TotalBytes             int64  `json:"total_bytes"`
	StoredModules          int    `json:"stored_modules"`
	StoredBytes            int64  `json:"stored_bytes"`
	SkippedByFilterModules int    `json:"skipped_by_filter_modules,omitempty"`
	SkippedByFilterBytes   int64  `json:"skipped_by_filter_bytes,omitempty"`
	SkippedByBudgetModules int    `json:"skipped_by_budget_modules,omitempty"`
	SkippedByBudgetBytes   int64  `json:"skipped_by_budget_bytes,omitempty"`
	SkippedOtherModules    int    `json:"skipped_other_modules,omitempty"`
	SkippedOtherBytes      int64  `json:"skipped_other_bytes,omitempty"`
}

ModuleCodeAccounting records the effective module code capture policy and exact counts/bytes of loaded, stored, skipped-by-filter, and skipped-by-budget module images so downstream views (top, kernels, advise) report exact coverage with zero silent drops.

func ReadModuleCodeAccounting

func ReadModuleCodeAccounting(cap *cudaprof.Capture) *ModuleCodeAccounting

ReadModuleCodeAccounting returns the module_code accounting recorded in cap's capture-status.json, or nil when absent.

type ModuleLaunches

type ModuleLaunches struct {
	Total    int
	ByModule map[uint32]int

	// Unnamed counts launches whose record names no module, and Graph those
	// of them that ran as CUDA graph nodes. Such a launch may have run from
	// any module, stored or not.
	Unnamed, Graph int
}

ModuleLaunches counts a capture's kernel launch records by the module each names.

func CountModuleLaunches

func CountModuleLaunches(cap *cudaprof.Capture) (*ModuleLaunches, error)

CountModuleLaunches decodes cap's journals and counts its kernel launches by module.

Jump to

Keyboard shortcuts

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