Help us shape the future of Go! Take the 2026 Go Developer Survey

parcagpu

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package parcagpu reads GPU events from the eBPF profiler's cupti_events ringbuf, marries them with symbolized CUDA stack traces from the profiler's interpreter/gpu package, and reports the completed traces directly via a TraceReporter. CUDA stack traces from the profiler are diverted into the GPU fixer via a Wrap'd reporter that the tracer is configured with as its TraceReporter.

Every event in the ringbuf begins with a u32 event_type discriminator at offset 0; the reader loop dispatches by tag to handlers for kernel timing, cubin-loaded notifications, PC samples, stall-reason maps, and BPF errors.

Index

Constants

View Source
const NvtxScope = "parca-agent.nvtx"

NvtxScope is the instrumentation scope of NVTX spans, and of the log records for marks made outside any range.

Variables

This section is empty.

Functions

func Start

Start drains the cupti_events ringbuf. NVTX events go to nvtxRep (see NvtxTracer); pass nil to drop them.

func Wrap added in v0.49.0

Wrap returns a TraceReporter that intercepts CUDA-origin traces, runs them through the GPU fixer, and forwards the resulting completed traces (zero or more per input) to inner. Non-CUDA traces are forwarded to inner unchanged. Pair with Start to drain the cupti_events ringbuf for kernel-timing, cubin-loaded, PC-sample, and stall-reason events.

Types

type LogExportFunc added in v0.50.1

type LogExportFunc func(context.Context, plog.Logs) error

LogExportFunc sends one batch of log records.

func NewOTLPLogExport added in v0.50.1

func NewOTLPLogExport(conn *grpc.ClientConn) LogExportFunc

NewOTLPLogExport returns a LogExportFunc that sends over conn.

type NvtxTracer added in v0.50.1

type NvtxTracer struct {
	// contains filtered or unexported fields
}

NvtxTracer turns NVTX events into OTLP spans. Each top-level range on a thread starts a trace; ranges opened inside it are its descendants. Push/pop ranges nest per thread; start/end ranges pair by range id and may end on another thread. A mark becomes an event on the innermost open range of its thread, or a log record if no range is open. Spans and log records are exported under the process's own resource, like its profiles.

It implements reporter.NvtxReporter. Events are queued and processed in order by Run, so ReportNvtxEvent never blocks the ringbuf reader.

func NewNvtxTracer added in v0.50.1

func NewNvtxTracer(cfg NvtxTracerConfig, resourcer ProcessResourcer, export TraceExportFunc,
	exportLog LogExportFunc,
) *NvtxTracer

NewNvtxTracer returns a tracer exporting spans through export and marks made outside any range through exportLog, which may be nil to drop them.

func (*NvtxTracer) ReportNvtxEvent added in v0.50.1

func (t *NvtxTracer) ReportNvtxEvent(ev *samples.NvtxEvent) error

ReportNvtxEvent implements reporter.NvtxReporter.

func (*NvtxTracer) ReportNvtxResourceName added in v0.50.1

func (t *NvtxTracer) ReportNvtxResourceName(ev *samples.NvtxResourceNameEvent) error

ReportNvtxResourceName implements reporter.NvtxReporter.

func (*NvtxTracer) Run added in v0.50.1

func (t *NvtxTracer) Run(ctx context.Context)

Run processes events until ctx is done, then closes every open range and exports what is left.

type NvtxTracerConfig added in v0.50.1

type NvtxTracerConfig struct {
	// MaxSpansPerSec is each process's span budget. Whole traces are kept or
	// dropped when their top-level range opens; 0 means unlimited.
	MaxSpansPerSec float64
}

NvtxTracerConfig configures an NvtxTracer.

type ProcessResourcer added in v0.50.1

type ProcessResourcer interface {
	PutResource(pid uint32, attrs pcommon.Map) bool
}

ProcessResourcer renders a process's OTLP resource attributes; see gpumetrics.ProcessResourcer, which this matches so NVTX spans carry the same resource as the process's profiles.

type TraceExportFunc added in v0.50.1

type TraceExportFunc func(context.Context, ptrace.Traces) error

TraceExportFunc sends one batch of spans.

func NewOTLPTraceExport added in v0.50.1

func NewOTLPTraceExport(conn *grpc.ClientConn) TraceExportFunc

NewOTLPTraceExport returns a TraceExportFunc that sends over conn.

Jump to

Keyboard shortcuts

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