Documentation ¶
Overview ¶
Package emu emulates GCN3 instructions. It also implement a emulation-only Compute Unit.
Index ¶
- type ALU
- type ALUImpl
- type ComputeUnit
- func (cu *ComputeUnit) ControlPort() sim.Port
- func (cu *ComputeUnit) DispatchingPort() sim.Port
- func (cu *ComputeUnit) Handle(evt sim.Event) error
- func (cu *ComputeUnit) LDSBytes() int
- func (cu *ComputeUnit) SRegCount() int
- func (cu *ComputeUnit) Tick(now sim.VTimeInSec) bool
- func (cu *ComputeUnit) VRegCounts() []int
- func (cu *ComputeUnit) WfPoolSizes() []int
- type DSLayout
- type Decoder
- type FlatLayout
- type ISADebugger
- type InstEmuState
- type SMEMLayout
- type SOP1Layout
- type SOP2Layout
- type SOPCLayout
- type SOPKLayout
- type SOPPLayout
- type Scratchpad
- func (sp Scratchpad) AsDS() *DSLayout
- func (sp Scratchpad) AsFlat() *FlatLayout
- func (sp Scratchpad) AsSMEM() *SMEMLayout
- func (sp Scratchpad) AsSOP1() *SOP1Layout
- func (sp Scratchpad) AsSOP2() *SOP2Layout
- func (sp Scratchpad) AsSOPC() *SOPCLayout
- func (sp Scratchpad) AsSOPK() *SOPKLayout
- func (sp Scratchpad) AsSOPP() *SOPPLayout
- func (sp Scratchpad) AsVOP1() *VOP1Layout
- func (sp Scratchpad) AsVOP2() *VOP2Layout
- func (sp Scratchpad) AsVOP3A() *VOP3ALayout
- func (sp Scratchpad) AsVOP3B() *VOP3BLayout
- func (sp Scratchpad) AsVOPC() *VOPCLayout
- type ScratchpadPreparer
- type ScratchpadPreparerImpl
- type VOP1Layout
- type VOP2Layout
- type VOP3ALayout
- type VOP3BLayout
- type VOPCLayout
- type WGCompleteEvent
- type Wavefront
- func (wf *Wavefront) Inst() *insts.Inst
- func (wf *Wavefront) PID() ca.PID
- func (wf *Wavefront) ReadReg(reg *insts.Reg, regCount int, laneID int) []byte
- func (wf *Wavefront) SRegValue(i int) uint32
- func (wf *Wavefront) Scratchpad() Scratchpad
- func (wf *Wavefront) VRegValue(lane int, i int) uint32
- func (wf *Wavefront) WriteReg(reg *insts.Reg, regCount int, laneID int, data []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ALU ¶
type ALU interface { Run(state InstEmuState) SetLDS(lds []byte) LDS() []byte }
ALU does its jobs
type ALUImpl ¶
type ALUImpl struct {
// contains filtered or unexported fields
}
ALUImpl is where the instructions get executed.
func NewALU ¶
func NewALU(storageAccessor *storageAccessor) *ALUImpl
NewALU creates a new ALU with a storage as a dependency.
func (*ALUImpl) Run ¶
func (u *ALUImpl) Run(state InstEmuState)
Run executes the instruction in the scatchpad of the InstEmuState
type ComputeUnit ¶
type ComputeUnit struct { *sim.TickingComponent LDSStorage []byte GlobalMemStorage *mem.Storage ToDispatcher sim.Port // contains filtered or unexported fields }
A ComputeUnit in the emu package is a component that omit the pipeline design but can still run the GCN3 instructions.
ToDispatcher <=> The port that connect the CU with the dispatcher
func BuildComputeUnit ¶
func BuildComputeUnit( name string, engine sim.Engine, decoder Decoder, pageTable vm.PageTable, log2PageSize uint64, storage *mem.Storage, addrConverter idealmemcontroller.AddressConverter, ) *ComputeUnit
BuildComputeUnit build a compute unit
func NewComputeUnit ¶
func NewComputeUnit( name string, engine sim.Engine, decoder Decoder, scratchpadPreparer ScratchpadPreparer, alu ALU, sAccessor *storageAccessor, ) *ComputeUnit
NewComputeUnit creates a new ComputeUnit with the given name
func (*ComputeUnit) ControlPort ¶
func (cu *ComputeUnit) ControlPort() sim.Port
ControlPort returns the port that can receive controlling messages from the Command Processor.
func (*ComputeUnit) DispatchingPort ¶
func (cu *ComputeUnit) DispatchingPort() sim.Port
DispatchingPort returns the port that the dispatcher can use to dispatch work-groups to the CU.
func (*ComputeUnit) Handle ¶
func (cu *ComputeUnit) Handle(evt sim.Event) error
Handle defines the behavior on event scheduled on the ComputeUnit
func (*ComputeUnit) LDSBytes ¶
func (cu *ComputeUnit) LDSBytes() int
LDSBytes returns the number of bytes in the LDS of the CU.
func (*ComputeUnit) SRegCount ¶
func (cu *ComputeUnit) SRegCount() int
SRegCount returns the number of scalar register in the Compute Unit.
func (*ComputeUnit) VRegCounts ¶
func (cu *ComputeUnit) VRegCounts() []int
VRegCounts returns an array of the numbers of vector regsiters in each SIMD unit.
func (*ComputeUnit) WfPoolSizes ¶
func (cu *ComputeUnit) WfPoolSizes() []int
WfPoolSizes returns an array of the numbers of wavefronts that each SIMD unit can execute.
type DSLayout ¶
type DSLayout struct { EXEC uint64 ADDR [64]uint32 DATA [256]uint32 DATA1 [256]uint32 DST [256]uint32 }
DSLayout represents the scratchpad layout for DS instructions
type FlatLayout ¶
type FlatLayout struct { EXEC uint64 ADDR [64]uint64 DATA [256]uint32 // 256 to consider the X4 instructions DST [256]uint32 }
FlatLayout represents the scratchpad layout for Flat instructions
type ISADebugger ¶
type ISADebugger struct { sim.LogHookBase // contains filtered or unexported fields }
ISADebugger is a hook that hooks to a emulator computeunit for each intruction
func NewISADebugger ¶
func NewISADebugger(logger *log.Logger) *ISADebugger
NewISADebugger returns a new ISADebugger that keeps instruction log in logger
func (*ISADebugger) Func ¶
func (h *ISADebugger) Func(ctx sim.HookCtx)
Func defines the behavior of the tracer when the tracer is invoked.
type InstEmuState ¶
type InstEmuState interface { PID() ca.PID Inst() *insts.Inst Scratchpad() Scratchpad }
InstEmuState is the interface used by the emulator to track the instruction execution status.
type SMEMLayout ¶
type SMEMLayout struct { DATA [4]uint32 // 0:16 Offset uint64 // 16:24 Base uint64 // 24:32 DST [16]uint32 // 32:96 }
SMEMLayout reqpresents the scratchpad layout for SMEM instructions
type SOP1Layout ¶
SOP1Layout represents the scratchpad layout for SOP1 instructions
type SOP2Layout ¶
SOP2Layout represents the scratchpad layout for SOP2 instructions
type SOPCLayout ¶
SOPCLayout represents the scratchpad layout for SOPC instructions
type SOPKLayout ¶
SOPKLayout represents the scratchpad layout for SOPK instructions
type SOPPLayout ¶
SOPPLayout reqpresents the scratchpad layout for SOPP instructions
type Scratchpad ¶
type Scratchpad []byte
Scratchpad is a piece of pure memory that is use for the alu to store input and output data
func (Scratchpad) AsDS ¶
func (sp Scratchpad) AsDS() *DSLayout
AsDS returns the ScratchPad as a struct representing the DS scratchpad layout
func (Scratchpad) AsFlat ¶
func (sp Scratchpad) AsFlat() *FlatLayout
AsFlat returns the ScratchPad as a struct representing the Flat scratchpad layout
func (Scratchpad) AsSMEM ¶
func (sp Scratchpad) AsSMEM() *SMEMLayout
AsSMEM returns the ScratchPad as a struct representing the SMEM scratchpad layout
func (Scratchpad) AsSOP1 ¶
func (sp Scratchpad) AsSOP1() *SOP1Layout
AsSOP1 returns the ScratchPad as a struct representing the SOP1 scratchpad layout
func (Scratchpad) AsSOP2 ¶
func (sp Scratchpad) AsSOP2() *SOP2Layout
AsSOP2 returns the ScratchPad as a struct representing the SOP2 scratchpad layout
func (Scratchpad) AsSOPC ¶
func (sp Scratchpad) AsSOPC() *SOPCLayout
AsSOPC returns the ScratchPad as a struct representing the SOPC scratchpad layout
func (Scratchpad) AsSOPK ¶
func (sp Scratchpad) AsSOPK() *SOPKLayout
AsSOPK returns the ScratchPad as a struct representing the SOPK scratchpad layout
func (Scratchpad) AsSOPP ¶
func (sp Scratchpad) AsSOPP() *SOPPLayout
AsSOPP returns the ScratchPad as a struct representing the SOPP scratchpad layout
func (Scratchpad) AsVOP1 ¶
func (sp Scratchpad) AsVOP1() *VOP1Layout
AsVOP1 returns the ScratchPad as a struct representing the VOP1 scratchpad layout
func (Scratchpad) AsVOP2 ¶
func (sp Scratchpad) AsVOP2() *VOP2Layout
AsVOP2 returns the ScratchPad as a struct representing the VOP1 scratchpad layout
func (Scratchpad) AsVOP3A ¶
func (sp Scratchpad) AsVOP3A() *VOP3ALayout
AsVOP3A returns the ScratchPad as a struct representing the VOP3a scratchpad layout
func (Scratchpad) AsVOP3B ¶
func (sp Scratchpad) AsVOP3B() *VOP3BLayout
AsVOP3B returns the ScratchPad as a struct representing the VOP3a scratchpad layout
func (Scratchpad) AsVOPC ¶
func (sp Scratchpad) AsVOPC() *VOPCLayout
AsVOPC returns the ScratchPad as a struct representing the VOPC scratchpad layout
type ScratchpadPreparer ¶
type ScratchpadPreparer interface { // Prepare reads from the register file and write into the instruction // scratchpad Prepare(instEmuState InstEmuState, wf *Wavefront) // Commit write to the register file to reflect the change in the scratchpad Commit(instEmuState InstEmuState, wf *Wavefront) }
ScratchpadPreparer is the unit that sets the instruction scratchpad before the instruction can be emulated.
type ScratchpadPreparerImpl ¶
type ScratchpadPreparerImpl struct { }
ScratchpadPreparerImpl reads and write registers for the emulator
func NewScratchpadPreparerImpl ¶
func NewScratchpadPreparerImpl() *ScratchpadPreparerImpl
NewScratchpadPreparerImpl returns a newly created ScratchpadPreparerImpl, injecting the dependency of the RegInterface.
func (*ScratchpadPreparerImpl) Commit ¶
func (p *ScratchpadPreparerImpl) Commit( instEmuState InstEmuState, wf *Wavefront, )
Commit write to the register file according to the scratchpad layout
func (*ScratchpadPreparerImpl) Prepare ¶
func (p *ScratchpadPreparerImpl) Prepare( instEmuState InstEmuState, wf *Wavefront, )
Prepare read from the register file and sets the scratchpad layout
type VOP1Layout ¶
VOP1Layout represents the scratchpad layout for VOP1 instructions
type VOP2Layout ¶
type VOP2Layout struct { EXEC uint64 DST [64]uint64 VCC uint64 SRC0 [64]uint64 SRC1 [64]uint64 LiteralConstant uint64 }
VOP2Layout represents the scratchpad layout for VOP2 instructions
type VOP3ALayout ¶
type VOP3ALayout struct { EXEC uint64 DST [64]uint64 VCC uint64 SRC0 [64]uint64 SRC1 [64]uint64 SRC2 [64]uint64 }
VOP3ALayout represents the scratchpad layout for VOP3a instructions
type VOP3BLayout ¶
type VOP3BLayout struct { EXEC uint64 DST [64]uint64 VCC uint64 SRC0 [64]uint64 SRC1 [64]uint64 SRC2 [64]uint64 SDST uint64 }
VOP3BLayout represents the scratchpad layout for VOP3a instructions
type VOPCLayout ¶
VOPCLayout represents the scratchpad layout for the VOPC instructions
type WGCompleteEvent ¶
WGCompleteEvent is an event that marks the completion of a work-group
func NewWGCompleteEvent ¶
func NewWGCompleteEvent(t sim.VTimeInSec, handler sim.Handler, req *protocol.MapWGReq, ) *WGCompleteEvent
NewWGCompleteEvent returns a newly constructed WGCompleteEvent
type Wavefront ¶
type Wavefront struct { *kernels.Wavefront Completed bool AtBarrier bool PC uint64 Exec uint64 SCC byte VCC uint64 M0 uint32 SRegFile []byte VRegFile []byte LDS []byte // contains filtered or unexported fields }
A Wavefront in the emu package is a wrapper for the kernels.Wavefront
func NewWavefront ¶
NewWavefront returns the Wavefront that wraps the nativeWf
func (*Wavefront) Scratchpad ¶
func (wf *Wavefront) Scratchpad() Scratchpad
Scratchpad returns the scratchpad that is associated with the wavefront