kernels

package
v3.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package kernels provides basic data definitions related to GPU kernels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadProgram

func LoadProgram(filePath, kernelName string) *insts.HsaCo

LoadProgram loads program

func LoadProgramFromMemory

func LoadProgramFromMemory(data []byte, kernelName string) *insts.HsaCo

LoadProgramFromMemory loads program

Types

type Grid

type Grid struct {
	CodeObject    *insts.HsaCo
	Packet        *HsaKernelDispatchPacket
	PacketAddress uint64

	WorkGroups []*WorkGroup
	WorkItems  []*WorkItem
}

A Grid is a running instance of a kernel.

func NewGrid

func NewGrid() *Grid

NewGrid creates and returns a new grid object.

type GridBuilder

type GridBuilder interface {
	SetKernel(info KernelLaunchInfo)
	NumWG() int
	NextWG() *WorkGroup
	Skip(n int)
}

A GridBuilder is the unit that can build a grid and its internal structure from a kernel and its launch parameters.

func NewGridBuilder

func NewGridBuilder() GridBuilder

NewGridBuilder creates a default grid builder

type HsaKernelDispatchPacket

type HsaKernelDispatchPacket struct {
	Header         uint16
	Setup          uint16
	WorkgroupSizeX uint16
	WorkgroupSizeY uint16
	WorkgroupSizeZ uint16

	GridSizeX          uint32
	GridSizeY          uint32
	GridSizeZ          uint32
	PrivateSegmentSize uint32
	GroupSegmentSize   uint32
	KernelObject       uint64
	KernargAddress     uint64

	CompletionSignal uint64
	// contains filtered or unexported fields
}

An HsaKernelDispatchPacket is an AQL packet for launching a kernel on a GPU.

type KernelLaunchInfo

type KernelLaunchInfo struct {
	CodeObject *insts.HsaCo
	Packet     *HsaKernelDispatchPacket
	PacketAddr uint64
	WGFilter   WGFilterFunc
}

KernelLaunchInfo includes the necessary information to launch a kernel.

type WGFilterFunc

type WGFilterFunc func(
	*HsaKernelDispatchPacket,
	*WorkGroup,
) bool

WGFilterFunc is a filter

type Wavefront

type Wavefront struct {
	UID           string
	CodeObject    *insts.HsaCo
	Packet        *HsaKernelDispatchPacket
	PacketAddress uint64
	FirstWiFlatID int
	WG            *WorkGroup
	InitExecMask  uint64

	WorkItems []*WorkItem
}

A Wavefront is a collection of work-items.

func NewWavefront

func NewWavefront() *Wavefront

NewWavefront returns a new Wavefront.

type WorkGroup

type WorkGroup struct {
	UID                             string
	CodeObject                      *insts.HsaCo
	Packet                          *HsaKernelDispatchPacket
	PacketAddress                   uint64
	SizeX, SizeY, SizeZ             int
	IDX, IDY, IDZ                   int
	CurrSizeX, CurrSizeY, CurrSizeZ int

	Wavefronts []*Wavefront
	WorkItems  []*WorkItem
}

A WorkGroup is part of the kernel that runs on one ComputeUnit.

func NewWorkGroup

func NewWorkGroup() *WorkGroup

NewWorkGroup creates a workgroup object.

type WorkItem

type WorkItem struct {
	WG            *WorkGroup
	IDX, IDY, IDZ int
}

A WorkItem defines a set of vector registers.

func (*WorkItem) FlattenedID

func (wi *WorkItem) FlattenedID() int

FlattenedID returns the work-item flattened ID.

Jump to

Keyboard shortcuts

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