acc

package
v0.0.0-...-2fe1034 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileCompoundKernel

func CompileCompoundKernel(randState DeviceAllocation, args []backends.Value) (
	[]TypeArg, []KernelArgument, *AccTensor, int, int, bool)

func ContiguousStrides

func ContiguousStrides(shape []int) []int

func HashTypeArgs

func HashTypeArgs(typeArgs []TypeArg) string

func IsSimpleStack

func IsSimpleStack(stack backends.Stack) bool

Types

type AccGenerator

type AccGenerator interface {
	generators.Generator
	Assign(out *AccTensor, value backends.Value) backends.Value
	MemAlloc(nbytes int) DeviceAllocation
	MemsetD8Async(dest DeviceAllocation, data uint8, count int)
	MemsetD16Async(dest DeviceAllocation, data uint16, count int)
	MemsetD32Async(dest DeviceAllocation, data uint32, count int)
	MemcpyDtodAsync(dest DeviceAllocation, src DeviceAllocation, size int)
	GetInt(src DeviceAllocation, size int) string
	GetFloat(src DeviceAllocation, size int) string
}

type AccGeneratorBase

type AccGeneratorBase struct {
	generators.GeneratorBase
	// contains filtered or unexported fields
}

func (*AccGeneratorBase) BufFree

func (b *AccGeneratorBase) BufFree()

func (*AccGeneratorBase) BufMalloc

func (b *AccGeneratorBase) BufMalloc(shape []int) *AccTensor

func (*AccGeneratorBase) GetRandStateDev

func (b *AccGeneratorBase) GetRandStateDev() DeviceAllocation

func (*AccGeneratorBase) Init

func (b *AccGeneratorBase) Init(
	self generators.Generator,
	rngSeed int,
	defaultDtype base.Dtype,
	stochasticRound int,
	histBins int,
	histOffset int,
	compatMode backends.CompatMode)

func (*AccGeneratorBase) NewTensor

func (b *AccGeneratorBase) NewTensor(shape []int, dtype base.Dtype) backends.Tensor

func (*AccGeneratorBase) SetHistBuffers

func (b *AccGeneratorBase) SetHistBuffers(histBins int, histOffset int)

func (*AccGeneratorBase) SplitToStacks

func (b *AccGeneratorBase) SplitToStacks(optree *backends.OpTreeNode) []backends.Stack

type AccTensor

type AccTensor struct {
	backends.TensorBase
	// contains filtered or unexported fields
}

func NewAccTensor

func NewAccTensor(
	backend AccGenerator,
	shape []int,
	dtype base.Dtype,
	name string,
	persistValues bool,
	tbase *AccTensor,
	accdata DeviceAllocation,
	strides []int,
	takeArray *TakeArray,
	isTrans bool,
	rounding int) *AccTensor

func (*AccTensor) AccData

func (t *AccTensor) AccData() DeviceAllocation

func (*AccTensor) Assign

func (t *AccTensor) Assign(value backends.Value) backends.Tensor

func (*AccTensor) Base

func (t *AccTensor) Base() backends.Tensor

func (*AccTensor) Copy

func (*AccTensor) Fill

func (t *AccTensor) Fill(value interface{}) backends.Tensor

func (*AccTensor) GetItem

func (t *AccTensor) GetItem(index backends.Slice) backends.Tensor

func (*AccTensor) GetScalar

func (t *AccTensor) GetScalar() backends.Value

func (*AccTensor) Init

func (t *AccTensor) Init(
	self backends.Value,
	backend AccGenerator,
	shape []int,
	dtype base.Dtype,
	name string,
	persistValues bool,
	tbase *AccTensor,
	accdata DeviceAllocation,
	strides []int,
	takeArray *TakeArray,
	isTrans bool,
	rounding int)

func (*AccTensor) IsContiguous

func (t *AccTensor) IsContiguous() bool

func (*AccTensor) IsTrans

func (t *AccTensor) IsTrans() bool

func (*AccTensor) Len

func (t *AccTensor) Len() int

func (*AccTensor) Reshape

func (t *AccTensor) Reshape(shape []int) backends.Tensor

func (*AccTensor) Rounding

func (t *AccTensor) Rounding() int

func (*AccTensor) SetItem

func (t *AccTensor) SetItem(index backends.Slice, value backends.Tensor)

func (*AccTensor) Share

func (t *AccTensor) Share(shape []int, dtype base.Dtype, name string) backends.Tensor

func (*AccTensor) Size

func (t *AccTensor) Size() int

func (*AccTensor) Strides

func (t *AccTensor) Strides() []int

func (*AccTensor) T

func (t *AccTensor) T() backends.Tensor

func (*AccTensor) Take

func (t *AccTensor) Take(indices backends.Tensor, axis int) backends.Tensor

func (*AccTensor) TakeArray

func (t *AccTensor) TakeArray() *TakeArray

type DeviceAllocation

type DeviceAllocation interface {
	Add(offset int) DeviceAllocation
}

type FloatTypeArg

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

func (*FloatTypeArg) Hash

func (a *FloatTypeArg) Hash() string

func (*FloatTypeArg) Indx

func (a *FloatTypeArg) Indx() int

func (*FloatTypeArg) Key

func (a *FloatTypeArg) Key() string

func (*FloatTypeArg) String

func (a *FloatTypeArg) String() string

type KernelArgument

type KernelArgument interface{}

type OpTypeArg

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

func (*OpTypeArg) Hash

func (a *OpTypeArg) Hash() string

func (*OpTypeArg) HotAxis

func (a *OpTypeArg) HotAxis() int

func (*OpTypeArg) Key

func (a *OpTypeArg) Key() string

func (*OpTypeArg) OpCnt

func (a *OpTypeArg) OpCnt() int

func (*OpTypeArg) OpName

func (a *OpTypeArg) OpName() backends.Op

func (*OpTypeArg) Rounding

func (a *OpTypeArg) Rounding() bool

func (*OpTypeArg) String

func (a *OpTypeArg) String() string

func (*OpTypeArg) Threads

func (a *OpTypeArg) Threads() int

type Stage

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

func BuildLastStage

func BuildLastStage(tree *TreeNode) Stage

func BuildStages

func BuildStages(typeArgs []TypeArg) []Stage

func SplitStages

func SplitStages(
	node *TreeNode,
	duplicates map[string]TypeArg,
	aliases map[TypeArg]bool,
	stages []Stage,
	parents []*TreeNode) []Stage

func (*Stage) Kind

func (s *Stage) Kind() string

func (*Stage) Stack

func (s *Stage) Stack() []TypeArg

type SymbolTypeArg

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

func (*SymbolTypeArg) Hash

func (a *SymbolTypeArg) Hash() string

func (*SymbolTypeArg) Indx

func (a *SymbolTypeArg) Indx() int

func (*SymbolTypeArg) Key

func (a *SymbolTypeArg) Key() string

func (*SymbolTypeArg) String

func (a *SymbolTypeArg) String() string

type TakeArray

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

func NewTakeArray

func NewTakeArray(indices *AccTensor, axis int) *TakeArray

func (*TakeArray) Axis

func (a *TakeArray) Axis() int

func (*TakeArray) Indices

func (a *TakeArray) Indices() *AccTensor

type TensorTypeArg

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

func (*TensorTypeArg) Dtype

func (a *TensorTypeArg) Dtype() base.Dtype

func (*TensorTypeArg) Hash

func (a *TensorTypeArg) Hash() string

func (*TensorTypeArg) Indx

func (a *TensorTypeArg) Indx() int

func (*TensorTypeArg) Key

func (a *TensorTypeArg) Key() string

func (*TensorTypeArg) String

func (a *TensorTypeArg) String() string

func (*TensorTypeArg) TakeAxis

func (a *TensorTypeArg) TakeAxis() int

func (*TensorTypeArg) UnitShape

func (a *TensorTypeArg) UnitShape() bool

type TreeNode

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

func BuildTree

func BuildTree(typeArgs []TypeArg) *TreeNode

func (*TreeNode) String

func (n *TreeNode) String() string

type TypeArg

type TypeArg interface {
	String() string
	Key() string
	Hash() string
}

func PostOrder

func PostOrder(node *TreeNode, stack []TypeArg) []TypeArg

func ProcessNode

func ProcessNode(
	node *TreeNode,
	aliases map[TypeArg]bool,
	duplicates map[string]TypeArg) []TypeArg

Jump to

Keyboard shortcuts

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