resource

package
v3.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package resource manages the Compute Unit resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CUResource

type CUResource interface {
	ReserveResourceForWG(wg *kernels.WorkGroup) (
		locations []WfLocation,
		ok bool,
	)
	FreeResourcesForWG(wg *kernels.WorkGroup)
	DispatchingPort() sim.Port
}

CUResource handle CU resources

type CUResourceImpl

type CUResourceImpl struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CUResourceImpl implements CUResource

func (*CUResourceImpl) DispatchingPort

func (r *CUResourceImpl) DispatchingPort() sim.Port

DispatchingPort returns the port that the dispatcher send message to.

func (*CUResourceImpl) FreeResourcesForWG

func (r *CUResourceImpl) FreeResourcesForWG(wg *kernels.WorkGroup)

FreeResourcesForWG marks all the resources used by a work-group available.

func (*CUResourceImpl) ReserveResourceForWG

func (r *CUResourceImpl) ReserveResourceForWG(wg *kernels.WorkGroup) (
	locations []WfLocation,
	ok bool,
)

ReserveResourceForWG checks if there is space to hold the work-group. If so, this function reserves the resouces for the work-group and returns how the resources are allocated.

type CUResourcePool

type CUResourcePool interface {
	NumCU() int
	GetCU(i int) CUResource
	RegisterCU(cu DispatchableCU)
}

CUResourcePool centralized all the CU resources.

type CUResourcePoolImpl

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

CUResourcePoolImpl centralizes the resources of CUs.

func NewCUResourcePool

func NewCUResourcePool() *CUResourcePoolImpl

NewCUResourcePool returns a CUResourcePoll

func (*CUResourcePoolImpl) GetCU

func (p *CUResourcePoolImpl) GetCU(i int) CUResource

GetCU returns the i-th CU.

func (*CUResourcePoolImpl) NumCU

func (p *CUResourcePoolImpl) NumCU() int

NumCU returns the total number of Compute Units.

func (*CUResourcePoolImpl) RegisterCU

func (p *CUResourcePoolImpl) RegisterCU(cu DispatchableCU)

RegisterCU puts the CU's resources into the resource pool.

type DispatchableCU

type DispatchableCU interface {
	// DispatchingPort returns the port that the dispatcher can dispatch workgroups to.
	DispatchingPort() sim.Port

	// WfPoolSizes returns an array of how many wavefront each wavefront pool
	// can hold. -1 is unlimited.
	WfPoolSizes() []int

	// VRegCounts returns how many vector registers are there in a vector
	// register file. It returns an array as the numbers represent the number of
	// vector registers in each SIMD unit. The size returned by this function
	// must equal to the size from the WfPoolSizes. -1 is unlimited.
	VRegCounts() []int

	// SRegCount returns the number of scalar registers. -1 means unlimited.
	SRegCount() int

	// LDSBytes returns the number of bytes in the LDS storage. -1 is unlimited.
	LDSBytes() int
}

DispatchableCU handles dispatch resource

type WfLocation

type WfLocation struct {
	Wavefront  *kernels.Wavefront
	SIMDID     int
	VGPROffset int
	SGPROffset int
	LDSOffset  int
}

WfLocation defines where the wavefront should be placed.

Jump to

Keyboard shortcuts

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