cuda

package
v0.0.0-...-c68ee8d Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cuda provides helpers for CUDA binary parsing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CubinKernel

type CubinKernel struct {
	Name string // Name of the kernel

	SymtabIndex int    // Index of this kernel in the ELF symbol table
	KernelSize  uint64 // Size of the kernel in bytes
	SharedMem   uint64 // Size of the shared memory used by the kernel
	ConstantMem uint64 // Size of the constant memory used by the kernel
	// contains filtered or unexported fields
}

CubinKernel holds the information of a CUDA kernel

type CubinKernelKey

type CubinKernelKey struct {
	Name      string
	SmVersion uint32
}

CubinKernelKey is the key to identify a kernel in a fatbin

type Fatbin

type Fatbin struct {

	// CompressedPayloads is the number of compressed payloads found in the fatbin
	CompressedPayloads int

	// UncompressedPayloads is the number of uncompressed payloads found in the fatbin
	UncompressedPayloads int
	// contains filtered or unexported fields
}

Fatbin holds all CUDA binaries found in one fatbin package

func NewFatbin

func NewFatbin() *Fatbin

NewFatbin creates a new Fatbin instance

func ParseFatbinFromELFFile

func ParseFatbinFromELFFile(elfFile *safeelf.File) (*Fatbin, error)

ParseFatbinFromELFFile parses the fatbin sections of the given ELF file and returns the information found in it

func ParseFatbinFromELFFilePath

func ParseFatbinFromELFFilePath(path string) (*Fatbin, error)

ParseFatbinFromELFFilePath opens the given path and parses the resulting ELF for CUDA kernels

func (*Fatbin) AddKernel

func (fb *Fatbin) AddKernel(key CubinKernelKey, kernel *CubinKernel)

AddKernel adds a kernel to the fatbin and updates internal indexes

func (*Fatbin) GetKernel

func (fb *Fatbin) GetKernel(name string, smVersion uint32) *CubinKernel

GetKernel returns the kernel with the given name and SM version from the fatbin

func (*Fatbin) GetKernels

func (fb *Fatbin) GetKernels() iter.Seq[*CubinKernel]

GetKernels returns an iterator over the kernels in the fatbin

func (*Fatbin) HasKernelWithName

func (fb *Fatbin) HasKernelWithName(name string) bool

HasKernelWithName returns true if the fatbin has a kernel with the given name

func (*Fatbin) NumKernels

func (fb *Fatbin) NumKernels() int

NumKernels returns the number of kernels in the fatbin

type Symbols

type Symbols struct {
	SymbolTable map[uint64]string
	Fatbin      *Fatbin
}

Symbols holds all necessary data from a CUDA executable for getting necessary CUDA kernel data. That is, the symbol table which maps addresses to symbol names and the fatbin data with all the CUDA kernels available in the binary and their metadata.

func GetSymbols

func GetSymbols(path string) (*Symbols, error)

GetSymbols reads an ELF file from the given path and return the parsed CUDA data

Jump to

Keyboard shortcuts

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