internal

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package internal provides support for the driver implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	ID            int
	Type          DeviceType
	UnifiedGPUIDs []int
	ActualGPUs    []*Device
	// contains filtered or unexported fields
}

A device is a CPU or GPU managed by the driver.

func (*Device) SetTotalMemSize

func (d *Device) SetTotalMemSize(size uint64)

type DeviceType

type DeviceType int

DeviceType marks the type of a device.

const (
	DeviceTypeInvalid DeviceType = iota
	DeviceTypeCPU
	DeviceTypeGPU
	DeviceTypeUnifiedGPU
)

Defines supported devices.

type MemoryAllocator

type MemoryAllocator interface {
	RegisterDevice(device *Device)
	GetDeviceIDByPAddr(pAddr uint64) int
	Allocate(pid ca.PID, byteSize uint64, deviceID int) uint64
	AllocateUnified(pid ca.PID, byteSize uint64) uint64
	Free(vAddr uint64)
	Remap(pid ca.PID, pageVAddr, byteSize uint64, deviceID int)
	RemovePage(vAddr uint64)
	AllocatePageWithGivenVAddr(
		pid ca.PID,
		deviceID int,
		vAddr uint64,
		unified bool,
	) vm.Page
}

A MemoryAllocator can allocate memory on the CPU and GPUs

func NewMemoryAllocator

func NewMemoryAllocator(
	pageTable vm.PageTable,
	log2PageSize uint64,
) MemoryAllocator

NewMemoryAllocator creates a new memory allocator.

Jump to

Keyboard shortcuts

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