gpu

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gpu hosts the vendor-neutral GPU types — [Device], [Snapshot], and the SamplerI interface — that [sysmetrics.Bundle] wires for cross-vendor consumers. Vendor-specific richness (per-engine breakdown for Intel, encoder utilization for NVIDIA, ...) stays in the per- vendor sub-packages under this directory.

The flow is:

  • The richer per-vendor [Collector] returns a vendor-specific Snapshot from its Sample method.
  • A `GenericSampler` adapter (e.g. [intel.GenericSampler]) wraps the collector and exposes a gpu.SamplerI-shaped Sample that returns the unified [Snapshot]. Vendor-specific fields are collapsed (Intel per-engine busy% becomes a single BusyPercent equal to the max across engines).
  • Bundle wires the adapter via [sysmetrics.BundleOptions.GPU].

Build-tag-gated vendor packages (gpu/intel under `gpu_intel`, etc.) implement the adapter only under their tag; the unified types in this package compile under the default tag set.

[intel.GenericSampler]: ../intel/ [sysmetrics.Bundle]: ../../bundle.go [sysmetrics.BundleOptions.GPU]: ../../bundle.go

Index

Constants

This section is empty.

Variables

View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMCompiles,
	WASMJS:           packageprops.WASMCompiles,
	WASMFreestanding: packageprops.WASMCompiles,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `boxer code analysis golang wasmsurvey props generate`; curate by hand. The same group's `props verify` reconciles it.

Functions

This section is empty.

Types

type SamplerI

type SamplerI interface {
	Sample(ctx context.Context) (snap sysmsnap.GPUSnapshot, err error)
	io.Closer
}

SamplerI is the vendor-agnostic surface that [sysmetrics.Bundle] wires. Vendor packages implement adapters (e.g. intel.GenericSampler) that lossy-convert their richer Snapshot into the unified sysmsnap.GPUSnapshot.

Adapters embed io.Closer so the Bundle can release per-vendor resources (perf-event fds, NVML / ROCm-SMI handles) at shutdown.

Jump to

Keyboard shortcuts

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