Documentation
¶
Index ¶
- func BinaryOpTable(B, W, L, Q, X func(Op, Op), VEX func(Op, Op, Op)) []func(Op, Op)
- func GenerateCopy(name, doc string, transform []func(Op, Op))
- func GetRegister(size int) (r Register)
- func JumpIfFeature(jmp string, f cpuid.FeatureID)
- func JumpUnlessFeature(jmp string, f cpuid.FeatureID)
- func ReduceAnd(a, b Register) Register
- func ReduceOr(a, b Register) Register
- func VecBroadcast(ir Op, xyz Register) Register
- func VecList(s Spec, max int) []VecPhysical
- type Memory
- type VariableLengthBytes
- type VectorAlloc
- type VectorLane
- type Vectorizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryOpTable ¶
func BinaryOpTable(B, W, L, Q, X func(Op, Op), VEX func(Op, Op, Op)) []func(Op, Op)
func GenerateCopy ¶
func GenerateCopy(name, doc string, transform []func(Op, Op))
func GetRegister ¶
func GetRegister(size int) (r Register)
func JumpIfFeature ¶
JumpIfFeature constructs a jump sequence that tests for one or more feature flags. If all flags are matched, jump to the target label.
func JumpUnlessFeature ¶
JumpUnlessFeature constructs a jump sequence that tests for one or more feature flags. Unless all flags are matched, jump to the target label.
func ReduceAnd ¶
func ReduceAnd(a, b Register) Register
ReduceAnd performs a bitwise AND between two registers and returns the result. This can be used as the reducer for a Vectorizer.
func ReduceOr ¶
func ReduceOr(a, b Register) Register
ReduceOr performs a bitwise OR between two registers and returns the result. This can be used as the reducer for a Vectorizer.
func VecBroadcast ¶
func VecBroadcast(ir Op, xyz Register) Register
VecBroadcast broadcasts an immediate or general purpose register into a vector register. The broadcast size is based on the input operand size. If the input is a register, it may be necessary to convert it to the desired size. For example:
reg := GP32() XORL(reg, reg) MOVB(U8(0x7F), reg.As8()) mask := VecBroadcast(reg, XMM()) // will broadcast 0x0000007F0000007F0000007F0000007F mask := VecBroadcast(reg.As8(), XMM()) // will broadcast 0x7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F
If the `reg` register isn't needed, it would preferrable to use:
mask := VecBroadcast(U8(0x7F), XMM())
Types ¶
type VariableLengthBytes ¶
type VariableLengthBytes struct { SetupXMM func() SetupYMM func() Process func(inputs []Register, memory ...Memory) Unroll int }
func (VariableLengthBytes) Generate ¶
func (v VariableLengthBytes) Generate(inputs []Register, n Register)
type VectorAlloc ¶
type VectorAlloc struct {
// contains filtered or unexported fields
}
VectorAlloc is a lower-level lane-driven register allocator. This pulls registers from a fixed list of physical registers for a given number of lanes. Registers are allocated in distinct blocks; one block for each lane.
func NewVectorAlloc ¶
func NewVectorAlloc(vec []VecPhysical, lanes int) *VectorAlloc
NewVectorAlloc creates a new VectorAlloc instance.
func (*VectorAlloc) Alloc ¶
func (a *VectorAlloc) Alloc() Register
Alloc implements the VectorLane interface. This allocates a register for the current lane.
func (*VectorAlloc) NextLane ¶
func (a *VectorAlloc) NextLane() bool
NextLane is used to advance the allocator to the next lane available lane. This returns false when no more lanes are available.
func (*VectorAlloc) Offset ¶
func (a *VectorAlloc) Offset(mem Mem) Mem
Offset implements the VectorLane interface. This calculates the next register-sized memory offset. Each offset within a single lane will refer to adjacent memory regions. Subsequent lanes will obtain an offset of adjacent memory after the last offset of the prior lane.
func (*VectorAlloc) Read ¶
func (a *VectorAlloc) Read(mem Mem) Register
Read implements the VectorLane interface. This reads the next register-sized memory region. Each read within a single lane will load adjacent memory regions. Subsequent lanes will read adjacent memory after the last read of the prior lane. This has special handling so that all reads are batched together. Because of this, Read calls should appear first in the mapper.
type VectorLane ¶
type VectorLane interface { Read(Mem) Register Offset(Mem) Mem Alloc() Register }
VectorLane is an interface for abstracting allocating and loading memory into vector registers. This is used during the map phase of the Vectorizer.
type Vectorizer ¶
type Vectorizer struct {
// contains filtered or unexported fields
}
Vectorizer is a map/reduce-based helper for constructing parallelized instruction pipelines.
func NewVectorizer ¶
func NewVectorizer(max int, mapper func(VectorLane) Register) *Vectorizer
NewVectorizer creates a new vectorizing utility utilizing a max number of registers and a mapper function.
func (*Vectorizer) Compile ¶
func (v *Vectorizer) Compile(spec Spec, lanes int) []Register
Compile runs the map and reduce phases for the given register size and parallel lane count. This can be called multiple times using different configurations to produce separate execution strides. The returned slice is dependent on the presence of a reducer. If no reducer is used, the slice will be all of the output registers from the map phase. If a reducer is defined, the result is slice containing the final reduced register.
func (*Vectorizer) Reduce ¶
func (v *Vectorizer) Reduce(h func(a, b Register) Register) *Vectorizer
Reduce sets the reducer function in the Vectorizer.