Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug fixed]: fixed a bug in timing/cu/issuearbiter.go; this bug cause… #21

Merged
merged 10 commits into from
Dec 18, 2023
56 changes: 28 additions & 28 deletions tests/acceptance/cases.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,32 +801,32 @@ var benchmarks = []benchmark{
{gpus: []int{1, 2, 3, 4}, timing: true, parallel: true, unifiedGPU: true, unifiedMemory: true},
},
},
{
benchmarkPath: "",
executablePath: "../../samples/concurrentkernel",
executable: "concurrentkernel",
sizeArgs: []string{},
cases: []benchmarkCase{
{gpus: []int{1}, timing: false, parallel: false, unifiedGPU: false, unifiedMemory: false},
{gpus: []int{1}, timing: false, parallel: true, unifiedGPU: false, unifiedMemory: false},
{gpus: []int{1}, timing: true, parallel: false, unifiedGPU: false, unifiedMemory: false},
{gpus: []int{1}, timing: true, parallel: true, unifiedGPU: false, unifiedMemory: false},
},
},
{
benchmarkPath: "",
executablePath: "../../samples/concurrentworkload",
executable: "concurrentworkload",
sizeArgs: []string{},
cases: []benchmarkCase{
{gpus: []int{1, 2, 3, 4}, timing: false, parallel: false, unifiedGPU: false, unifiedMemory: false},
{gpus: []int{1, 2, 3, 4}, timing: false, parallel: true, unifiedGPU: false, unifiedMemory: false},
{gpus: []int{1, 2, 3, 4}, timing: true, parallel: false, unifiedGPU: false, unifiedMemory: false},
{gpus: []int{1, 2, 3, 4}, timing: true, parallel: true, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1, 2, 3, 4}, timing: false, parallel: false, unifiedGPU: false, unifiedMemory: true},
// {gpus: []int{1, 2, 3, 4}, timing: false, parallel: true, unifiedGPU: false, unifiedMemory: true},
// {gpus: []int{1, 2, 3, 4}, timing: true, parallel: false, unifiedGPU: false, unifiedMemory: true},
// {gpus: []int{1, 2, 3, 4}, timing: true, parallel: true, unifiedGPU: false, unifiedMemory: true},
},
},
// {
// benchmarkPath: "",
// executablePath: "../../samples/concurrentkernel",
// executable: "concurrentkernel",
// sizeArgs: []string{},
// cases: []benchmarkCase{
// {gpus: []int{1}, timing: false, parallel: false, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1}, timing: false, parallel: true, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1}, timing: true, parallel: false, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1}, timing: true, parallel: true, unifiedGPU: false, unifiedMemory: false},
// },
// },
// {
// benchmarkPath: "",
// executablePath: "../../samples/concurrentworkload",
// executable: "concurrentworkload",
// sizeArgs: []string{},
// cases: []benchmarkCase{
// {gpus: []int{1, 2, 3, 4}, timing: false, parallel: false, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1, 2, 3, 4}, timing: false, parallel: true, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1, 2, 3, 4}, timing: true, parallel: false, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1, 2, 3, 4}, timing: true, parallel: true, unifiedGPU: false, unifiedMemory: false},
// {gpus: []int{1, 2, 3, 4}, timing: false, parallel: false, unifiedGPU: false, unifiedMemory: true},
// {gpus: []int{1, 2, 3, 4}, timing: false, parallel: true, unifiedGPU: false, unifiedMemory: true},
// {gpus: []int{1, 2, 3, 4}, timing: true, parallel: false, unifiedGPU: false, unifiedMemory: true},
// {gpus: []int{1, 2, 3, 4}, timing: true, parallel: true, unifiedGPU: false, unifiedMemory: true},
// },
// },
}
35 changes: 20 additions & 15 deletions timing/cu/issuearbiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type IssueArbiter struct {
// NewIssueArbiter returns a newly created IssueArbiter
func NewIssueArbiter() *IssueArbiter {
a := new(IssueArbiter)
a.lastSIMDID = -1
a.lastSIMDID = 0
return a
}

Expand All @@ -23,25 +23,30 @@ func (a *IssueArbiter) Arbitrate(
return []*wavefront.Wavefront{}
}

a.moveToNextSIMD(wfPools)
for len(wfPools[a.lastSIMDID].wfs) == 0 {
a.moveToNextSIMD(wfPools)
}
wfToIssue := make([]*wavefront.Wavefront, 0)
for i := 0; i < len(wfPools); i++ {
simdID := (a.lastSIMDID + i) % len(wfPools)

typeMask := make([]bool, 7)
wfPool := wfPools[simdID]
for _, wf := range wfPool.wfs {
if wf.State != wavefront.WfReady || wf.InstToIssue == nil {
continue
}

typeMask := make([]bool, 7)
wfPool := wfPools[a.lastSIMDID]
list := make([]*wavefront.Wavefront, 0)
for _, wf := range wfPool.wfs {
if wf.State != wavefront.WfReady || wf.InstToIssue == nil {
continue
if typeMask[wf.InstToIssue.ExeUnit] == false {
wfToIssue = append(wfToIssue, wf)
typeMask[wf.InstToIssue.ExeUnit] = true
}
}

if typeMask[wf.InstToIssue.ExeUnit] == false {
list = append(list, wf)
typeMask[wf.InstToIssue.ExeUnit] = true
if len(wfToIssue) != 0 {
a.lastSIMDID = simdID
break
}
}
return list

return wfToIssue
}

func (a *IssueArbiter) moveToNextSIMD(wfPools []*WavefrontPool) {
Expand Down
3 changes: 2 additions & 1 deletion timing/cu/vectormemoryunit.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (u *VectorMemoryUnit) insertTransactionToPipeline(
}

func (u *VectorMemoryUnit) execute(now sim.VTimeInSec) (madeProgress bool) {
item := u.postInstructionPipelineBuffer.Pop()
item := u.postInstructionPipelineBuffer.Peek()
if item == nil {
return false
}
Expand All @@ -126,6 +126,7 @@ func (u *VectorMemoryUnit) execute(now sim.VTimeInSec) (madeProgress bool) {
log.Panicf("running inst %s in vector memory unit is not supported", inst.String(nil))
}

u.postInstructionPipelineBuffer.Pop()
u.cu.UpdatePCAndSetReady(wave)
u.numInstInFlight--

Expand Down
2 changes: 2 additions & 0 deletions timing/cu/vectormemoryunit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ var _ = Describe("Vector Memory Unit", func() {
transactions[i].Read = read
}
coalescer.EXPECT().generateMemTransactions(wave).Return(transactions)
instBuffer.EXPECT().Peek().Return(vectorMemInst{wavefront: wave})
instBuffer.EXPECT().Pop().Return(vectorMemInst{wavefront: wave})

madeProgress := vecMemUnit.instToTransaction(10)
Expand Down Expand Up @@ -122,6 +123,7 @@ var _ = Describe("Vector Memory Unit", func() {
transactions[i].Write = write
}
coalescer.EXPECT().generateMemTransactions(wave).Return(transactions)
instBuffer.EXPECT().Peek().Return(vectorMemInst{wavefront: wave})
instBuffer.EXPECT().Pop().Return(vectorMemInst{wavefront: wave})

madeProgress := vecMemUnit.instToTransaction(10)
Expand Down
Loading