Skip to content

Commit

Permalink
Merge pull request #27 from sarchlab/rdma_tracing
Browse files Browse the repository at this point in the history
Separate RDMA Tracing to Inside and Outside
  • Loading branch information
syifan authored Dec 2, 2023
2 parents 384714c + 0bbfbc5 commit 7810efc
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@
"program": "${workspaceFolder}/samples/fir",
"args": [
"-timing",
"-length=64",
"-length=8192",
"-report-all",
"-gpus=1,2",
"-use-unified-memory=false",
],
},
{
Expand Down
10 changes: 4 additions & 6 deletions samples/runner/r9nanobuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,12 +745,6 @@ func (b *R9NanoGPUBuilder) populateInstMemoryHierarchy(sa *shaderArray) {
}

func (b *R9NanoGPUBuilder) buildRDMAEngine() {
// b.rdmaEngine = rdma.NewEngine(
// fmt.Sprintf("%s.RDMA", b.gpuName),
// b.engine,
// b.lowModuleFinderForL1,
// nil,
// )
name := fmt.Sprintf("%s.RDMA", b.gpuName)
b.rdmaEngine = rdma.MakeBuilder().
WithEngine(b.engine).
Expand All @@ -762,6 +756,10 @@ func (b *R9NanoGPUBuilder) buildRDMAEngine() {
if b.monitor != nil {
b.monitor.RegisterComponent(b.rdmaEngine)
}

if b.enableVisTracing {
tracing.CollectTrace(b.rdmaEngine, b.visTracer)
}
}

func (b *R9NanoGPUBuilder) buildPageMigrationController() {
Expand Down
78 changes: 70 additions & 8 deletions timing/rdma/comp.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ func (c *Comp) processReqFromL1(
if err == nil {
c.ToL1.Retrieve(now)

tracing.TraceReqReceive(req, c)
tracing.TraceReqInitiate(cloned, c, tracing.MsgIDAtReceiver(req, c))
c.traceInsideOutStart(req, cloned)

//fmt.Printf("%s req inside %s -> outside %s\n",
//e.Name(), req.GetID(), cloned.GetID())
Expand Down Expand Up @@ -247,8 +246,7 @@ func (c *Comp) processReqFromOutside(
if err == nil {
c.ToOutside.Retrieve(now)

tracing.TraceReqReceive(req, c)
tracing.TraceReqInitiate(cloned, c, tracing.MsgIDAtReceiver(req, c))
c.traceOutsideInStart(req, cloned)

//fmt.Printf("%s req outside %s -> inside %s\n",
//e.Name(), req.GetID(), cloned.GetID())
Expand Down Expand Up @@ -284,8 +282,7 @@ func (c *Comp) processRspFromL2(
//fmt.Printf("%s rsp inside %s -> outside %s\n",
//e.Name(), rsp.GetID(), rspToOutside.GetID())

tracing.TraceReqFinalize(trans.toInside, c)
tracing.TraceReqComplete(trans.fromOutside, c)
c.traceOutsideInEnd(trans)

c.transactionsFromOutside =
append(c.transactionsFromOutside[:transactionIndex],
Expand All @@ -312,8 +309,7 @@ func (c *Comp) processRspFromOutside(
if err == nil {
c.ToOutside.Retrieve(now)

tracing.TraceReqFinalize(trans.toOutside, c)
tracing.TraceReqComplete(trans.fromInside, c)
c.traceInsideOutEnd(trans)

//fmt.Printf("%s rsp outside %s -> inside %s\n",
//e.Name(), rsp.GetID(), rspToInside.GetID())
Expand Down Expand Up @@ -404,3 +400,69 @@ func (c *Comp) cloneRsp(origin mem.AccessRsp, rspTo string) mem.AccessRsp {
func (c *Comp) SetFreq(freq sim.Freq) {
c.TickingComponent.Freq = freq
}

func (c *Comp) traceInsideOutStart(req mem.AccessReq, cloned mem.AccessReq) {
if len(c.Hooks()) == 0 {
return
}

tracing.StartTaskWithSpecificLocation(
tracing.MsgIDAtReceiver(req, c),
req.Meta().ID+"_req_out",
c,
"req_in",
reflect.TypeOf(req).String(),
c.Name()+".InsideOut",
req,
)

tracing.StartTaskWithSpecificLocation(
cloned.Meta().ID+"_req_out",
tracing.MsgIDAtReceiver(req, c),
c,
"req_out",
reflect.TypeOf(req).String(),
c.Name()+".InsideOut",
cloned,
)
}

func (c *Comp) traceOutsideInStart(req mem.AccessReq, cloned mem.AccessReq) {
if len(c.Hooks()) == 0 {
return
}

tracing.StartTaskWithSpecificLocation(
tracing.MsgIDAtReceiver(req, c),
req.Meta().ID+"_req_out",
c,
"req_in",
reflect.TypeOf(req).String(),
c.Name()+".OutsideIn",
req,
)

tracing.StartTaskWithSpecificLocation(
cloned.Meta().ID+"_req_out",
tracing.MsgIDAtReceiver(req, c),
c,
"req_out",
reflect.TypeOf(req).String(),
c.Name()+".OutsideIn",
cloned,
)
}

func (c *Comp) traceInsideOutEnd(trans transaction) {
if len(c.Hooks()) == 0 {
return
}

tracing.TraceReqFinalize(trans.toOutside, c)
tracing.TraceReqComplete(trans.fromInside, c)
}

func (c *Comp) traceOutsideInEnd(trans transaction) {
tracing.TraceReqFinalize(trans.toInside, c)
tracing.TraceReqComplete(trans.fromOutside, c)
}

0 comments on commit 7810efc

Please sign in to comment.