instrument

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: 8 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 instrument says, for each hardware value the planners in this module read, what measures it on the device it describes.

A value is a field of github.com/tmc/lib/nvidia/x/isa/devicetable.Profile, a field of a hardware description such as tcgen05.GB300Spec or nvl72.PodSpec, or a constant of package nvl72. All lists one Measure per value: the instrument (a package and the function, method or test in it), the command that runs it, the scope it needs (one GPU, two GPUs of a node, a rack), and what the instrument reads compared with the figure the code holds. A value no instrument here measures is listed too, with Missing set and the instrument it would take, or with Scope NotMeasurable and the reason software cannot read it.

The instruments read three kinds of thing. A Reading reports the value the figure states, such as a driver attribute. An Achieved value is a rate a workload sustains: it is at most the cited peak, and it is kept beside that peak, labelled, never in its place. A Timed value is a figure that is itself a measurement, such as a copy rate, and has no datasheet peak to compare with.

The tests of this package check that every such value has a Measure, that each instrument named exists in the source tree, and that the set of missing instruments is the one written down. The runbook directory holds the script that runs the multi-GPU and rack instruments on an NVL72 node and writes the records github.com/tmc/lib/nvidia/x/isa/devicetable.ReadFacts reads.

This package is outside the compatibility promise of github.com/tmc/lib/nvidia. Its API may change or be removed in patch releases.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind is how what an instrument reads relates to the figure the code holds.

const (
	// Reading means the instrument reports the value itself: a driver
	// attribute, an occupancy query, a link version.
	Reading Kind = iota + 1

	// Achieved means the instrument times a workload, and the rate it
	// gets is at most the cited peak. It is kept beside the peak,
	// labelled, never in its place.
	Achieved

	// Timed means the figure is itself a measurement, such as a copy rate
	// or a per-launch cost, and there is no datasheet peak to compare with.
	Timed
)

func (Kind) String

func (k Kind) String() string

type Measure

type Measure struct {
	// Value names the value: "devicetable.Profile.SMs" for a field,
	// "nvl72.NVL72NVLink5GBps" for a constant.
	Value string

	Scope Scope
	Kind  Kind

	// Package is the instrument's directory below the nvidia module root,
	// such as "x/cmd/cudabin/internal/devicetablecmd", and Symbol the function, method
	// ("cudaMeter.StreamRead"), variable or test in it that measures.
	// A symbol of the form "file:name" is a shell function in file.
	// Both are empty when Scope is NotMeasurable or Missing is set.
	Package string
	Symbol  string

	// Run is the command that runs the instrument, from the module root.
	Run string

	// Reads says what the instrument reads, and how that compares with
	// the figure the code holds.
	Reads string

	// Missing is set when no instrument here measures the value, though
	// one could: Reason names the instrument it would take.
	Missing bool

	// Reason explains a NotMeasurable or Missing value.
	Reason string
}

A Measure says how one hardware value is measured.

func All

func All() []Measure

All returns a Measure for every hardware value, sorted by Value.

func Lookup

func Lookup(value string) (Measure, bool)

Lookup returns the Measure of the named value.

Example
package main

import (
	"fmt"

	"github.com/tmc/lib/nvidia/x/isa/devicetable/instrument"
)

func main() {
	m, _ := instrument.Lookup("devicetable.Profile.L2Bytes")
	fmt.Println(m.Scope, m.Kind, m.Package, m.Symbol)
}
Output:
one GPU reading x/cmd/cudabin/internal/devicetablecmd probes

type PeakFLOPSMeasurement

type PeakFLOPSMeasurement struct {
	Median         float64   `json:"median"`
	Min            float64   `json:"min"`
	Max            float64   `json:"max"`
	Samples        []float64 `json:"samples"`
	FLOPsPerLaunch uint64    `json:"flops_per_launch"`
	Grid           int       `json:"grid"`
	Block          int       `json:"block"`
	Iters          int       `json:"iters"`
	M              int       `json:"m,omitempty"`
	N              int       `json:"n,omitempty"`
	K              int       `json:"k,omitempty"`
	Opcode         string    `json:"opcode,omitempty"`
}

PeakFLOPSMeasurement reports achieved dense operation rates for one launch shape.

type PeakFLOPSReceipt

type PeakFLOPSReceipt struct {
	Schema        string               `json:"schema"`
	DeviceName    string               `json:"device_name"`
	Arch          string               `json:"arch"`
	SMCount       int                  `json:"sm_count"`
	DriverVersion string               `json:"driver_version"`
	CUDAVersion   string               `json:"cuda_version"`
	NVCCVersion   string               `json:"nvcc_version"`
	GitRev        string               `json:"git_rev"`
	MeasuredAt    *time.Time           `json:"measured_at,omitempty"`
	FP32          PeakFLOPSMeasurement `json:"fp32_fma_tflops"`
	BF16          PeakFLOPSMeasurement `json:"bf16_tcgen05_mma_tflops"`
}

PeakFLOPSReceipt records achieved FP32 and BF16 throughput on a single GB300.

func (PeakFLOPSReceipt) MarshalJSON

func (r PeakFLOPSReceipt) MarshalJSON() ([]byte, error)

MarshalJSON encodes a validated peak receipt.

func (PeakFLOPSReceipt) ToDeviceCeiling

func (r PeakFLOPSReceipt) ToDeviceCeiling() (obsmodel.Ceiling, error)

ToDeviceCeiling adds measured dense compute limits to the named device's resident ceiling.

func (*PeakFLOPSReceipt) UnmarshalJSON

func (r *PeakFLOPSReceipt) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes and validates a peak receipt before replacing r.

func (PeakFLOPSReceipt) Validate

func (r PeakFLOPSReceipt) Validate() error

Validate checks receipt provenance, workload geometry and sample summaries.

type Scope

type Scope int

Scope is what an instrument needs to run.

const (
	OneGPU        Scope = iota + 1 // one GPU of any host, such as a GB10
	TwoGPUs                        // two GPUs of one node
	Rack                           // the GPUs of an NVLink domain, or more than one node
	NotMeasurable                  // nothing in software reads it; Measure.Reason says why
)

func (Scope) String

func (s Scope) String() string

Jump to

Keyboard shortcuts

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