Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
M
MGPUSim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Akita
MGPUSim
Commits
55b66545
Commit
55b66545
authored
5 years ago
by
Yifan Sun
Browse files
Options
Downloads
Patches
Plain Diff
Update emu package
parent
267056b8
No related branches found
No related tags found
Loading
Pipeline
#55441705
failed
5 years ago
Stage: build
Stage: test
Stage: acceptance_test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
emu/computeunit.go
+16
-4
16 additions, 4 deletions
emu/computeunit.go
emu/isadebugger.go
+13
-21
13 additions, 21 deletions
emu/isadebugger.go
with
29 additions
and
25 deletions
emu/computeunit.go
+
16
−
4
View file @
55b66545
...
@@ -52,7 +52,6 @@ func (cu *ComputeUnit) NotifyPortFree(now akita.VTimeInSec, port akita.Port) {
...
@@ -52,7 +52,6 @@ func (cu *ComputeUnit) NotifyPortFree(now akita.VTimeInSec, port akita.Port) {
// Handle defines the behavior on event scheduled on the ComputeUnit
// Handle defines the behavior on event scheduled on the ComputeUnit
func
(
cu
*
ComputeUnit
)
Handle
(
evt
akita
.
Event
)
error
{
func
(
cu
*
ComputeUnit
)
Handle
(
evt
akita
.
Event
)
error
{
cu
.
Lock
()
cu
.
Lock
()
defer
cu
.
Unlock
()
switch
evt
:=
evt
.
(
type
)
{
switch
evt
:=
evt
.
(
type
)
{
case
*
gcn3
.
MapWGReq
:
case
*
gcn3
.
MapWGReq
:
...
@@ -64,6 +63,9 @@ func (cu *ComputeUnit) Handle(evt akita.Event) error {
...
@@ -64,6 +63,9 @@ func (cu *ComputeUnit) Handle(evt akita.Event) error {
default
:
default
:
log
.
Panicf
(
"cannot handle event %s"
,
reflect
.
TypeOf
(
evt
))
log
.
Panicf
(
"cannot handle event %s"
,
reflect
.
TypeOf
(
evt
))
}
}
cu
.
Unlock
()
return
nil
return
nil
}
}
...
@@ -285,23 +287,33 @@ func (cu *ComputeUnit) runWfUntilBarrier(wf *Wavefront) error {
...
@@ -285,23 +287,33 @@ func (cu *ComputeUnit) runWfUntilBarrier(wf *Wavefront) error {
if
inst
.
FormatType
==
insts
.
SOPP
&&
inst
.
Opcode
==
10
{
// S_ENDPGM
if
inst
.
FormatType
==
insts
.
SOPP
&&
inst
.
Opcode
==
10
{
// S_ENDPGM
wf
.
AtBarrier
=
true
wf
.
AtBarrier
=
true
cu
.
InvokeHook
(
wf
,
cu
,
akita
.
AnyHookPos
,
inst
)
cu
.
logInst
(
wf
,
inst
)
break
break
}
}
if
inst
.
FormatType
==
insts
.
SOPP
&&
inst
.
Opcode
==
1
{
// S_BARRIER
if
inst
.
FormatType
==
insts
.
SOPP
&&
inst
.
Opcode
==
1
{
// S_BARRIER
wf
.
Completed
=
true
wf
.
Completed
=
true
cu
.
InvokeHook
(
wf
,
cu
,
akita
.
AnyHookPos
,
inst
)
cu
.
logInst
(
wf
,
inst
)
break
break
}
}
cu
.
executeInst
(
wf
)
cu
.
executeInst
(
wf
)
cu
.
InvokeHook
(
wf
,
cu
,
akita
.
AnyHookPos
,
inst
)
cu
.
logInst
(
wf
,
inst
)
}
}
return
nil
return
nil
}
}
func
(
cu
*
ComputeUnit
)
logInst
(
wf
*
Wavefront
,
inst
*
insts
.
Inst
)
{
ctx
:=
akita
.
HookCtx
{
Domain
:
cu
,
Now
:
0
,
Item
:
wf
,
Detail
:
inst
,
}
cu
.
InvokeHook
(
&
ctx
)
}
func
(
cu
*
ComputeUnit
)
executeInst
(
wf
*
Wavefront
)
{
func
(
cu
*
ComputeUnit
)
executeInst
(
wf
*
Wavefront
)
{
cu
.
scratchpadPreparer
.
Prepare
(
wf
,
wf
)
cu
.
scratchpadPreparer
.
Prepare
(
wf
,
wf
)
cu
.
alu
.
Run
(
wf
)
cu
.
alu
.
Run
(
wf
)
...
...
This diff is collapsed.
Click to expand it.
emu/
wfhook
.go
→
emu/
isadebugger
.go
+
13
−
21
View file @
55b66545
...
@@ -3,39 +3,31 @@ package emu
...
@@ -3,39 +3,31 @@ package emu
import
(
import
(
"fmt"
"fmt"
"log"
"log"
"reflect"
"gitlab.com/akita/akita"
"gitlab.com/akita/akita"
"gitlab.com/akita/gcn3/insts"
"gitlab.com/akita/gcn3/insts"
)
)
//
WfHook
is a hook that hooks to a emulator computeunit for each intruction
//
ISADebugger
is a hook that hooks to a emulator computeunit for each intruction
type
WfHook
struct
{
type
ISADebugger
struct
{
akita
.
LogHookBase
akita
.
LogHookBase
prevWf
*
Wavefront
prevWf
*
Wavefront
}
}
// New
WfHook
returns a new
WfHook
that keeps instruction log in logger
// New
ISADebugger
returns a new
ISADebugger
that keeps instruction log in logger
func
New
WfHook
(
logger
*
log
.
Logger
)
*
WfHook
{
func
New
ISADebugger
(
logger
*
log
.
Logger
)
*
ISADebugger
{
h
:=
new
(
WfHook
)
h
:=
new
(
ISADebugger
)
h
.
Logger
=
logger
h
.
Logger
=
logger
return
h
return
h
}
}
// Type of WfHook claims the inst tracer is hooking to the emu.Wavefront type
func
(
h
*
WfHook
)
Type
()
reflect
.
Type
{
return
reflect
.
TypeOf
((
*
Wavefront
)(
nil
))
}
// Pos of WfHook returns akita.Any.
func
(
h
*
WfHook
)
Pos
()
akita
.
HookPos
{
return
akita
.
AnyHookPos
}
// Func defines the behavior of the tracer when the tracer is invoked.
// Func defines the behavior of the tracer when the tracer is invoked.
func
(
h
*
WfHook
)
Func
(
item
interface
{},
domain
akita
.
Hookable
,
info
interface
{})
{
func
(
h
*
ISADebugger
)
Func
(
ctx
*
akita
.
HookCtx
)
{
wf
:=
item
.
(
*
Wavefront
)
wf
,
ok
:=
ctx
.
Item
.
(
*
Wavefront
)
if
!
ok
{
return
}
// For debugging
// For debugging
// if wf.FirstWiFlatID != 0 {
// if wf.FirstWiFlatID != 0 {
...
@@ -52,7 +44,7 @@ func (h *WfHook) Func(item interface{}, domain akita.Hookable, info interface{})
...
@@ -52,7 +44,7 @@ func (h *WfHook) Func(item interface{}, domain akita.Hookable, info interface{})
h
.
stubWf
(
wf
)
h
.
stubWf
(
wf
)
}
}
func
(
h
*
WfHook
)
logWholeWf
(
wf
*
Wavefront
)
{
func
(
h
*
ISADebugger
)
logWholeWf
(
wf
*
Wavefront
)
{
output
:=
fmt
.
Sprintf
(
"
\n\t
wg - (%d, %d, %d), wf - %d
\n
"
,
output
:=
fmt
.
Sprintf
(
"
\n\t
wg - (%d, %d, %d), wf - %d
\n
"
,
wf
.
WG
.
IDX
,
wf
.
WG
.
IDY
,
wf
.
WG
.
IDZ
,
wf
.
FirstWiFlatID
)
wf
.
WG
.
IDX
,
wf
.
WG
.
IDY
,
wf
.
WG
.
IDZ
,
wf
.
FirstWiFlatID
)
output
+=
fmt
.
Sprintf
(
"
\t
Inst: %s
\n
"
,
wf
.
Inst
()
.
String
(
nil
))
output
+=
fmt
.
Sprintf
(
"
\t
Inst: %s
\n
"
,
wf
.
Inst
()
.
String
(
nil
))
...
@@ -80,7 +72,7 @@ func (h *WfHook) logWholeWf(wf *Wavefront) {
...
@@ -80,7 +72,7 @@ func (h *WfHook) logWholeWf(wf *Wavefront) {
h
.
Logger
.
Print
(
output
)
h
.
Logger
.
Print
(
output
)
}
}
func
(
h
*
WfHook
)
logDiffWf
(
wf
*
Wavefront
)
{
func
(
h
*
ISADebugger
)
logDiffWf
(
wf
*
Wavefront
)
{
output
:=
fmt
.
Sprintf
(
"
\n\t
wg - (%d, %d, %d), wf - %d
\n
"
,
output
:=
fmt
.
Sprintf
(
"
\n\t
wg - (%d, %d, %d), wf - %d
\n
"
,
wf
.
WG
.
IDX
,
wf
.
WG
.
IDY
,
wf
.
WG
.
IDZ
,
wf
.
FirstWiFlatID
)
wf
.
WG
.
IDX
,
wf
.
WG
.
IDY
,
wf
.
WG
.
IDZ
,
wf
.
FirstWiFlatID
)
output
+=
fmt
.
Sprintf
(
"
\t
Inst: %s
\n
"
,
wf
.
Inst
()
.
String
(
nil
))
output
+=
fmt
.
Sprintf
(
"
\t
Inst: %s
\n
"
,
wf
.
Inst
()
.
String
(
nil
))
...
@@ -132,7 +124,7 @@ func (h *WfHook) logDiffWf(wf *Wavefront) {
...
@@ -132,7 +124,7 @@ func (h *WfHook) logDiffWf(wf *Wavefront) {
h
.
Logger
.
Print
(
output
)
h
.
Logger
.
Print
(
output
)
}
}
func
(
h
*
WfHook
)
stubWf
(
wf
*
Wavefront
)
{
func
(
h
*
ISADebugger
)
stubWf
(
wf
*
Wavefront
)
{
h
.
prevWf
=
NewWavefront
(
wf
.
Wavefront
)
h
.
prevWf
=
NewWavefront
(
wf
.
Wavefront
)
h
.
prevWf
.
SRegFile
=
make
([]
byte
,
len
(
wf
.
SRegFile
))
h
.
prevWf
.
SRegFile
=
make
([]
byte
,
len
(
wf
.
SRegFile
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment