amdgpu

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDevIdsFromTopology added in v1.1.1

func GetDevIdsFromTopology(fs FileSystem, topoRootParam ...string) map[int]string

GetDevIdsFromTopology returns a map of render minor numbers to unique_ids

func GetUniqueIdToDeviceIndexMap added in v1.2.0

func GetUniqueIdToDeviceIndexMap() (map[string][]int, error)

GetUniqueIdToDeviceIndexMap returns a map of unique_id (as hex string) to device indices

func GetUniqueIdToDeviceIndexMapWithFS added in v1.2.0

func GetUniqueIdToDeviceIndexMapWithFS(fs FileSystem) (map[string][]int, error)

GetUniqueIdToDeviceIndexMapWithFS creates a mapping from unique_id (hex format) to device indices

func ParseTopologyProperties added in v1.1.1

func ParseTopologyProperties(fs FileSystem, path string, re *regexp.Regexp) (int64, error)

ParseTopologyProperties parses for a property value in kfd topology file as int64 The format is usually one entry per line <name> <value>.

func ParseTopologyPropertiesString added in v1.1.1

func ParseTopologyPropertiesString(fs FileSystem, path string, re *regexp.Regexp) (string, error)

ParseTopologyPropertiesString parses for a property value in kfd topology file as string The format is usually one entry per line <name> <value>.

Types

type AMDGPU

type AMDGPU struct {
	Path     string
	Major    int64
	Minor    int64
	FileMode os.FileMode
	Gid      uint32
	Uid      uint32
	Allow    bool
	DevType  string
	Access   string
}

AMDGPU collects device information of GPU

func GetAMDGPU

func GetAMDGPU(dev string) (AMDGPU, error)

GetAMDGPU returns device information for the given GPU

func GetAMDGPUWithFS added in v1.1.1

func GetAMDGPUWithFS(fs FileSystem, dev string) (AMDGPU, error)

type DefaultFS added in v1.1.1

type DefaultFS struct{}

DefaultFS implements FileSystem using actual filesystem operations

func (*DefaultFS) GetDeviceStat added in v1.1.1

func (fs *DefaultFS) GetDeviceStat(dev string, format string) (string, error)

func (*DefaultFS) Glob added in v1.1.1

func (fs *DefaultFS) Glob(pattern string) ([]string, error)

func (*DefaultFS) ReadFile added in v1.1.1

func (fs *DefaultFS) ReadFile(name string) ([]byte, error)

func (*DefaultFS) Stat added in v1.1.1

func (fs *DefaultFS) Stat(name string) (os.FileInfo, error)

type DeviceInfo added in v1.2.0

type DeviceInfo struct {
	DrmDevices    []string
	PartitionType string
}

func GetAMDGPUs

func GetAMDGPUs() ([]DeviceInfo, error)

GetAMDGPUs returns the lists of all the GPU devices on the system. All devices under the same "pci:amdgpu/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]:*" directory are in a single list. There are as many such lists as the number of gpu directories under "pci:amdgpu/".

func GetAMDGPUsWithFS added in v1.1.1

func GetAMDGPUsWithFS(fs FileSystem) ([]DeviceInfo, error)

GetAMDGPUsWithFS is the internal implementation that takes a FileSystem interface. This split allows for better testability by enabling mock filesystem operations in unit tests, while keeping the public API simple with GetAMDGPUs.

type FileSystem added in v1.1.1

type FileSystem interface {
	Stat(name string) (os.FileInfo, error)
	Glob(pattern string) ([]string, error)
	ReadFile(name string) ([]byte, error)
	GetDeviceStat(dev string, format string) (string, error)
}

FileSystem interface for mocking filesystem operations

Jump to

Keyboard shortcuts

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