Skip to content

Commit

Permalink
fix lint problem
Browse files Browse the repository at this point in the history
  • Loading branch information
gongchen618 committed Dec 6, 2023
1 parent 6426b2a commit 520d885
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 22 deletions.
2 changes: 2 additions & 0 deletions accelsim_tracing/alu/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package alu contains the ALU implementation
package alu
2 changes: 1 addition & 1 deletion accelsim_tracing/benchmark/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (bm *BenchMark) WithTraceDirPath(path string) *BenchMark {

func (bm *BenchMark) Build() error {
if bm.fromTrace == false {
return errors.New("No trace dir path specified")
return errors.New("no trace dir path specified")
}
bm.trace = trace.NewTrace().WithTraceDirPath(bm.traceDirPath)
bm.trace.Build()
Expand Down
2 changes: 2 additions & 0 deletions accelsim_tracing/benchmark/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package benchmark contains the driver which links traces and the simulator
package benchmark
12 changes: 8 additions & 4 deletions accelsim_tracing/gpc/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,14 @@ func (g *GPC) Build() {
g.buildDispatcher()
g.sms = make([]*sm.SM, g.meta.smNum)
for i := 0; i < int(g.meta.smNum); i++ {
g.sms[i] = sm.NewSM().WithSMStrategy(g.meta.smStrategy).
WithSMUnitNum(g.meta.smUnitNum).WithSMUnitStrategy(g.meta.smUnitStrategy).
WithL1CacheSize(g.meta.l1CacheSize).WithL0CacheSize(g.meta.l0CacheSize).
WithRegisterFileSize(g.meta.registerFileSize).WithLaneSize(g.meta.laneSize)
g.sms[i] = sm.NewSM().
WithSMStrategy(g.meta.smStrategy).
WithSMUnitNum(g.meta.smUnitNum).
WithSMUnitStrategy(g.meta.smUnitStrategy).
WithL1CacheSize(g.meta.l1CacheSize).
WithL0CacheSize(g.meta.l0CacheSize).
WithRegisterFileSize(g.meta.registerFileSize).
WithLaneSize(g.meta.laneSize)
for _, alu := range g.meta.alus {
g.sms[i].WithALU(alu.aluType, alu.aluNum)
}
Expand Down
2 changes: 2 additions & 0 deletions accelsim_tracing/gpc/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package gpc implements the simulation components for the GPC Level.
package gpc
16 changes: 11 additions & 5 deletions accelsim_tracing/gpu/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,17 @@ func (g *GPU) Build() {
g.buildDispatcher()
g.gpcs = make([]*gpc.GPC, g.meta.gpcNum)
for i := 0; i < int(g.meta.gpcNum); i++ {
g.gpcs[i] = gpc.NewGPC().WithSMNum(g.meta.smNum).WithSMUnitNum(g.meta.smUnitNum).
WithGPCStrategy(g.meta.gpcStrategy).WithSMStrategy(g.meta.smStrategy).
WithSMUnitStrategy(g.meta.smUnitStrategy).WithL2CacheSize(g.meta.l2CacheSize).
WithL1CacheSize(g.meta.l1CacheSize).WithL0CacheSize(g.meta.l0CacheSize).
WithRegisterFileSize(g.meta.registerFileSize).WithLaneSize(g.meta.laneSize)
g.gpcs[i] = gpc.NewGPC().
WithSMNum(g.meta.smNum).
WithSMUnitNum(g.meta.smUnitNum).
WithGPCStrategy(g.meta.gpcStrategy).
WithSMStrategy(g.meta.smStrategy).
WithSMUnitStrategy(g.meta.smUnitStrategy).
WithL2CacheSize(g.meta.l2CacheSize).
WithL1CacheSize(g.meta.l1CacheSize).
WithL0CacheSize(g.meta.l0CacheSize).
WithRegisterFileSize(g.meta.registerFileSize).
WithLaneSize(g.meta.laneSize)
for _, alu := range g.meta.alus {
g.gpcs[i].WithALU(alu.aluType, alu.aluNum)
}
Expand Down
2 changes: 2 additions & 0 deletions accelsim_tracing/gpu/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package gpu implements the simulation components for the GPU level.
package gpu
2 changes: 2 additions & 0 deletions accelsim_tracing/nvidia/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package nvidia includes basic const, types and structs for nvidia tracing
package nvidia
6 changes: 3 additions & 3 deletions accelsim_tracing/nvidia/opcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package nvidia

import "log"

// [todo] how to construct these?
// VariableType [todo] how to construct these?
type VariableType int32

const (
Expand All @@ -18,7 +18,7 @@ type OpCodeType int32
const (
OpCodeDefault OpCodeType = iota
OpCodeError
IMAD_MOV_U32
IMADMOVU32
)

type Opcode struct {
Expand Down Expand Up @@ -53,5 +53,5 @@ var opcodeTable map[string]Opcode
func init() {
opcodeTable = make(map[string]Opcode)

opcodeTable["IMAD.MOV.U32"] = Opcode{"IMAD.MOV.U32", IMAD_MOV_U32, VariableINT32}
opcodeTable["IMAD.MOV.U32"] = Opcode{"IMAD.MOV.U32", IMADMOVU32, VariableINT32}
}
6 changes: 4 additions & 2 deletions accelsim_tracing/sm/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ func (s *SM) Build() {
s.buildDispatcher()
s.smUnits = make([]*smunit.SMUnit, s.meta.smUnitNum)
for i := 0; i < int(s.meta.smUnitNum); i++ {
s.smUnits[i] = smunit.NewSMUnit().WithSMUnitStrategy(s.meta.smUnitStrategy).
s.smUnits[i] = smunit.NewSMUnit().
WithSMUnitStrategy(s.meta.smUnitStrategy).
WithL0CacheSize(s.meta.l0CacheSize).
WithRegisterFileSize(s.meta.registerFileSize).WithLaneSize(s.meta.laneSize)
WithRegisterFileSize(s.meta.registerFileSize).
WithLaneSize(s.meta.laneSize)
for _, alu := range s.meta.alus {
s.smUnits[i].WithALU(alu.aluType, alu.aluNum)
}
Expand Down
2 changes: 2 additions & 0 deletions accelsim_tracing/sm/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package sm implements the simulation components for the SM level.
package sm
4 changes: 3 additions & 1 deletion accelsim_tracing/smunit/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func (s *SMUnit) Build() {
s.buildRegisterFile(s.meta.registerFileSize, s.meta.laneSize)
s.aluGroup = make([]*alu.ALUGroup, len(s.meta.alus))
for i, a := range s.meta.alus {
s.aluGroup[i] = alu.NewALUGroup().WithALUType(a.aluType).WithALUNum(a.aluNum)
s.aluGroup[i] = alu.NewALUGroup().
WithALUType(a.aluType).
WithALUNum(a.aluNum)
s.aluGroup[i].Build()
}
}
Expand Down
2 changes: 2 additions & 0 deletions accelsim_tracing/smunit/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package smunit implements the simulation components for the SM Unit level.
package smunit
2 changes: 1 addition & 1 deletion accelsim_tracing/smunit/registerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ func (r *RegisterFile) Write(offset int32, width int32) {
func (s *SMUnit) buildRegisterFile(size int32, sizePerLane int32) {
s.registerFile = &RegisterFile{
buf: make([]byte, size),
byteSizePerLane: int32(sizePerLane),
byteSizePerLane: sizePerLane,
}
}
2 changes: 2 additions & 0 deletions accelsim_tracing/trace/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package trace deals with trace parsing
package trace
18 changes: 13 additions & 5 deletions accelsim_tracing/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ func getInputArguments() *inputArguments {
}

func buildAmpereGPU() *gpu.GPU {
gpu := gpu.NewGPU().WithGPUStrategy("default").
WithGPCNum(8).WithGPCStrategy("default").WithL2CacheSize(4*1024*1024*nvidia.BYTE).
WithSMNum(16).WithSMStrategy("default").WithL1CacheSize(192*1024*nvidia.BYTE).
WithSMUnitNum(4).WithSMUnitStrategy("default").WithL0CacheSize(16*1024*nvidia.BYTE).
WithRegisterFileSize(256*1024*nvidia.BYTE).WithLaneSize(4*nvidia.BYTE).
gpu := gpu.NewGPU().
WithGPUStrategy("default").
WithGPCNum(8).
WithSMNum(16).
WithSMUnitNum(4).
WithGPCStrategy("default").
WithSMStrategy("default").
WithSMUnitStrategy("default").
WithL2CacheSize(4*1024*1024*nvidia.BYTE).
WithL1CacheSize(192*1024*nvidia.BYTE).
WithL0CacheSize(16*1024*nvidia.BYTE).
WithRegisterFileSize(256*1024*nvidia.BYTE).
WithLaneSize(4*nvidia.BYTE).
WithALU("int32", 16)
gpu.Build()
return gpu
Expand Down

0 comments on commit 520d885

Please sign in to comment.