From dffb55e8cb39a4de37c3afaf8d8bf6b247a58ca2 Mon Sep 17 00:00:00 2001 From: mengyang Date: Fri, 23 Aug 2024 23:41:01 -0400 Subject: [PATCH] fix test bugs --- driver/driver_test.go | 204 ++++++++++-------- driver/mock_sim_test.go | 98 +++++---- go.mod | 24 +-- go.sum | 79 +++---- protocol/cuprotocol.go | 28 +-- protocol/driverprotocol.go | 30 +-- timing/cp/commandprocessor_test.go | 109 ++++------ timing/cp/dma_test.go | 52 ++--- .../internal/dispatching/dispatcher_test.go | 66 +++--- .../cp/internal/dispatching/mock_sim_test.go | 74 +++++-- timing/cp/mock_dispatching_test.go | 8 +- timing/cp/mock_sim_test.go | 106 ++++----- timing/cu/branchunit_test.go | 4 +- timing/cu/computeunit_test.go | 63 +++--- timing/cu/decodeunit_test.go | 8 +- timing/cu/ldsunit_test.go | 4 +- timing/cu/mock_pipelining_test.go | 16 +- timing/cu/mock_sim_test.go | 98 +++++---- timing/cu/mock_subcomponent_test.go | 17 +- timing/cu/mock_wfdispatcher_test.go | 9 +- timing/cu/scalarunit_test.go | 16 +- timing/cu/scheduler_test.go | 32 +-- timing/cu/simdunit_test.go | 4 +- timing/cu/vectormemoryunit_test.go | 18 +- timing/cu/wfdispatcher_test.go | 2 +- .../pagemigrationcontroller/mock_sim_test.go | 98 +++++---- timing/pagemigrationcontroller/pmc_test.go | 61 ++---- timing/pagemigrationcontroller/pmcprotocol.go | 8 +- timing/rdma/mock_sim_test.go | 98 +++++---- timing/rdma/rdma_test.go | 75 +++---- timing/rdma/rdmaprotocol.go | 8 +- timing/rob/mock_sim_test.go | 98 +++++---- timing/rob/rob_test.go | 52 +++-- 33 files changed, 814 insertions(+), 853 deletions(-) diff --git a/driver/driver_test.go b/driver/driver_test.go index efbc2dfa..be2d77c6 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -128,20 +128,24 @@ var _ = ginkgo.Describe("Driver", func() { GetDeviceIDByPAddr(uint64(0x1_0000_2000)). Return(1) - toGPUs.EXPECT().Peek().Return(nil).AnyTimes() - toGPUs.EXPECT().Peek().Return(nil).AnyTimes() - toGPUs.EXPECT().Peek().Return(nil).AnyTimes() - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(12)).Return(nil) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(13)).Return(nil) + toGPUs.EXPECT().PeekIncoming().Return(nil).AnyTimes() + toGPUs.EXPECT().PeekIncoming().Return(nil).AnyTimes() + toGPUs.EXPECT().PeekIncoming().Return(nil).AnyTimes() + toMMU.EXPECT().RetrieveIncoming().Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT().Schedule(gomock.AssignableToTypeOf(sim.TickEvent{})) engine.EXPECT().Schedule(gomock.AssignableToTypeOf(sim.TickEvent{})) engine.EXPECT().Schedule(gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) - driver.Handle(sim.MakeTickEvent(12, nil)) - driver.Handle(sim.MakeTickEvent(13, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(12)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(13)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) + driver.Handle(sim.MakeTickEvent(nil, 12)) + driver.Handle(sim.MakeTickEvent(nil, 13)) Expect(driver.requestsToSend).To(HaveLen(4)) Expect(cmdQueue.IsRunning).To(BeTrue()) @@ -151,9 +155,9 @@ var _ = ginkgo.Describe("Driver", func() { ginkgo.Context("process MemCopyH2D return", func() { ginkgo.It("should remove one request", func() { - req := protocol.NewMemCopyH2DReq(9, toGPUs, nil, + req := protocol.NewMemCopyH2DReq(toGPUs, nil, make([]byte, 4), 0x104) - req2 := protocol.NewMemCopyH2DReq(9, toGPUs, nil, + req2 := protocol.NewMemCopyH2DReq(toGPUs, nil, make([]byte, 4), 0x100) cmd := &MemCopyH2DCommand{ Dst: Ptr(0x100), @@ -164,17 +168,19 @@ var _ = ginkgo.Describe("Driver", func() { cmdQueue.IsRunning = true rsp := sim.GeneralRspBuilder{}.WithOriginalReq(req).Build() - toGPUs.EXPECT().Peek().Return(rsp) - toGPUs.EXPECT().Peek().Return(nil) + toGPUs.EXPECT().PeekIncoming().Return(rsp) + toGPUs.EXPECT().PeekIncoming().Return(nil) toGPUs.EXPECT(). - Retrieve(sim.VTimeInSec(11)). + RetrieveIncoming(). Return(req) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT(). Schedule(gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) Expect(cmdQueue.IsRunning).To(BeTrue()) Expect(cmdQueue.commands).To(HaveLen(1)) @@ -183,8 +189,7 @@ var _ = ginkgo.Describe("Driver", func() { }) ginkgo.It("should remove command from queue if no more pending request", func() { - req := protocol.NewMemCopyH2DReq(9, - toGPUs, nil, + req := protocol.NewMemCopyH2DReq(toGPUs, nil, make([]byte, 4), 0x100) cmd := &MemCopyH2DCommand{ Dst: Ptr(0x100), @@ -195,18 +200,20 @@ var _ = ginkgo.Describe("Driver", func() { cmdQueue.IsRunning = true rsp := sim.GeneralRspBuilder{}.WithOriginalReq(req).Build() - toGPUs.EXPECT().Peek().Return(rsp) - toGPUs.EXPECT().Peek().Return(nil) + toGPUs.EXPECT().PeekIncoming().Return(rsp) + toGPUs.EXPECT().PeekIncoming().Return(nil) toGPUs.EXPECT(). - Retrieve(sim.VTimeInSec(11)). + RetrieveIncoming(). Return(req) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT().Schedule( gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) Expect(cmdQueue.IsRunning).To(BeFalse()) Expect(cmdQueue.NumCommand()).To(Equal(0)) @@ -236,12 +243,12 @@ var _ = ginkgo.Describe("Driver", func() { GetDeviceIDByPAddr(uint64(0x1_0000_0100)). Return(1) - toGPUs.EXPECT().Peek().Return(nil).AnyTimes() - toGPUs.EXPECT().Peek().Return(nil).AnyTimes() - toGPUs.EXPECT().Peek().Return(nil).AnyTimes() - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(12)).Return(nil) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(13)).Return(nil) + toGPUs.EXPECT().PeekIncoming().Return(nil).AnyTimes() + toGPUs.EXPECT().PeekIncoming().Return(nil).AnyTimes() + toGPUs.EXPECT().PeekIncoming().Return(nil).AnyTimes() + toMMU.EXPECT().RetrieveIncoming().Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT().Schedule( gomock.AssignableToTypeOf(sim.TickEvent{})) @@ -250,9 +257,13 @@ var _ = ginkgo.Describe("Driver", func() { engine.EXPECT().Schedule( gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) - driver.Handle(sim.MakeTickEvent(12, nil)) - driver.Handle(sim.MakeTickEvent(13, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(12)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(13)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) + driver.Handle(sim.MakeTickEvent(nil, 12)) + driver.Handle(sim.MakeTickEvent(nil, 13)) Expect(cmdQueue.IsRunning).To(BeTrue()) Expect(cmd.Reqs).To(HaveLen(1)) @@ -264,9 +275,9 @@ var _ = ginkgo.Describe("Driver", func() { ginkgo.It("should remove request", func() { data := uint64(0) req := protocol.NewMemCopyD2HReq( - 9, nil, toGPUs, 0x100, []byte{1, 0, 0, 0}) + nil, toGPUs, 0x100, []byte{1, 0, 0, 0}) req2 := protocol.NewMemCopyD2HReq( - 9, nil, toGPUs, 0x104, []byte{1, 0, 0, 0}) + nil, toGPUs, 0x104, []byte{1, 0, 0, 0}) cmd := &MemCopyD2HCommand{ Dst: &data, Src: Ptr(0x100), @@ -276,17 +287,19 @@ var _ = ginkgo.Describe("Driver", func() { cmdQueue.IsRunning = true rsp := sim.GeneralRspBuilder{}.WithOriginalReq(req).Build() - toGPUs.EXPECT().Peek().Return(rsp) - toGPUs.EXPECT().Peek().Return(nil) + toGPUs.EXPECT().PeekIncoming().Return(rsp) + toGPUs.EXPECT().PeekIncoming().Return(nil) toGPUs.EXPECT(). - Retrieve(sim.VTimeInSec(11)). + RetrieveIncoming(). Return(req) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT().Schedule( gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) Expect(cmdQueue.IsRunning).To(BeTrue()) Expect(cmdQueue.commands).To(HaveLen(1)) @@ -296,7 +309,7 @@ var _ = ginkgo.Describe("Driver", func() { ginkgo.It("should continue queue", func() { data := uint32(0) - req := protocol.NewMemCopyD2HReq(9, nil, toGPUs, + req := protocol.NewMemCopyD2HReq(nil, toGPUs, 0x100, []byte{1, 0, 0, 0}) cmd := &MemCopyD2HCommand{ @@ -309,16 +322,18 @@ var _ = ginkgo.Describe("Driver", func() { cmdQueue.IsRunning = true rsp := sim.GeneralRspBuilder{}.WithOriginalReq(req).Build() - toGPUs.EXPECT().Peek().Return(rsp) - toGPUs.EXPECT().Peek().Return(nil) + toGPUs.EXPECT().PeekIncoming().Return(rsp) + toGPUs.EXPECT().PeekIncoming().Return(nil) toGPUs.EXPECT(). - Retrieve(sim.VTimeInSec(11)). + RetrieveIncoming(). Return(req) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT().Schedule(gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) Expect(cmdQueue.IsRunning).To(BeFalse()) Expect(cmdQueue.commands).To(HaveLen(0)) @@ -338,14 +353,16 @@ var _ = ginkgo.Describe("Driver", func() { cmdQueue.Enqueue(cmd) cmdQueue.IsRunning = false - toGPUs.EXPECT().Peek().Return(nil).AnyTimes() + toGPUs.EXPECT().PeekIncoming().Return(nil).AnyTimes() - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT().Schedule( gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) Expect(cmdQueue.IsRunning).To(BeTrue()) Expect(cmd.Reqs).To(HaveLen(1)) @@ -356,41 +373,43 @@ var _ = ginkgo.Describe("Driver", func() { }) ginkgo.It("should process LaunchKernel return", func() { - req := protocol.NewLaunchKernelReq(7, toGPUs, nil) + req := protocol.NewLaunchKernelReq(toGPUs, nil) cmd := &LaunchKernelCommand{ Reqs: []sim.Msg{req}, } cmdQueue.Enqueue(cmd) cmdQueue.IsRunning = true - rsp := protocol.NewLaunchKernelRsp(9, nil, nil, req.ID) + rsp := protocol.NewLaunchKernelRsp(nil, nil, req.ID) - toGPUs.EXPECT().Peek().Return(rsp).Times(2) + toGPUs.EXPECT().PeekIncoming().Return(rsp).Times(2) toGPUs.EXPECT(). - Retrieve(sim.VTimeInSec(11)). + RetrieveIncoming(). Return(rsp) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(nil) + toMMU.EXPECT().RetrieveIncoming().Return(nil) engine.EXPECT().Schedule(gomock.AssignableToTypeOf(sim.TickEvent{})) - driver.Handle(sim.MakeTickEvent(11, nil)) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) + + driver.Handle(sim.MakeTickEvent(nil, 11)) Expect(cmdQueue.IsRunning).To(BeFalse()) Expect(cmdQueue.commands).To(HaveLen(0)) }) ginkgo.It("should handle page migration req from MMU ", func() { - req := vm.NewPageMigrationReqToDriver(10, nil, driver.mmuPort) - toMMU.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(req) + req := vm.NewPageMigrationReqToDriver(nil, driver.mmuPort) + toMMU.EXPECT().RetrieveIncoming().Return(req) driver.isCurrentlyHandlingMigrationReq = false for i := 0; i < 2; i++ { - rdmaDrainReq := protocol.NewRDMADrainCmdFromDriver(10, driver.gpuPort, driver.GPUs[i]) + rdmaDrainReq := protocol.NewRDMADrainCmdFromDriver(driver.gpuPort, driver.GPUs[i]) driver.requestsToSend = append(driver.requestsToSend, rdmaDrainReq) } - driver.parseFromMMU(10) + driver.parseFromMMU() Expect(driver.currentPageMigrationReq).To(Equal(req)) Expect(driver.isCurrentlyHandlingMigrationReq).To(BeTrue()) @@ -398,11 +417,11 @@ var _ = ginkgo.Describe("Driver", func() { }) ginkgo.It("should handle RDMA Drain RSP ", func() { - req := protocol.NewRDMADrainRspToDriver(10, nil, driver.gpuPort) + req := protocol.NewRDMADrainRspToDriver(nil, driver.gpuPort) driver.numRDMADrainACK = 1 pageMigrationReq := vm.NewPageMigrationReqToDriver( - 10, nil, driver.mmuPort) + nil, driver.mmuPort) pageMigrationReq.PageSize = 4 * mem.KB pageMigrationReq.CurrPageHostGPU = 1 pageMigrationReq.CurrAccessingGPUs = append( @@ -415,10 +434,10 @@ var _ = ginkgo.Describe("Driver", func() { driver.currentPageMigrationReq = pageMigrationReq - toGPUs.EXPECT().Peek().Return(req) - toGPUs.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(req) + toGPUs.EXPECT().PeekIncoming().Return(req) + toGPUs.EXPECT().RetrieveIncoming().Return(req) - madeProgress := driver.processReturnReq(10) + madeProgress := driver.processReturnReq() Expect(driver.numShootDownACK).To(Equal(uint64(1))) Expect(madeProgress).To(BeTrue()) @@ -427,10 +446,10 @@ var _ = ginkgo.Describe("Driver", func() { }) ginkgo.It("should handle shootdown complete rsp", func() { - req := protocol.NewShootdownCompleteRsp(10, nil, driver.gpuPort) + req := protocol.NewShootdownCompleteRsp(nil, driver.gpuPort) pageMigrationReq := vm.NewPageMigrationReqToDriver( - 10, nil, driver.mmuPort) + nil, driver.mmuPort) pageMigrationReq.PageSize = 4 * mem.KB pageMigrationReq.CurrPageHostGPU = 1 pageMigrationReq.CurrAccessingGPUs = @@ -478,10 +497,10 @@ var _ = ginkgo.Describe("Driver", func() { AllocatePageWithGivenVAddr(vm.PID(0), 2, uint64(0x100), true). Return(*page2) - toGPUs.EXPECT().Peek().Return(req) - toGPUs.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(req) + toGPUs.EXPECT().PeekIncoming().Return(req) + toGPUs.EXPECT().RetrieveIncoming().Return(req) - driver.processReturnReq(10) + driver.processReturnReq() Expect(driver.numPagesMigratingACK). To(Equal(uint64(1))) @@ -500,26 +519,26 @@ var _ = ginkgo.Describe("Driver", func() { ginkgo.It("should send migration req to CP", func() { migrationReqToCP := - protocol.NewPageMigrationReqToCP(10, driver.gpuPort, + protocol.NewPageMigrationReqToCP(driver.gpuPort, driver.GPUs[1]) driver.migrationReqToSendToCP = append(driver.migrationReqToSendToCP, migrationReqToCP) toGPUs.EXPECT().Send(migrationReqToCP) - madeProgress := driver.sendMigrationReqToCP(10) + madeProgress := driver.sendMigrationReqToCP() Expect(driver.isCurrentlyMigratingOnePage).To(BeTrue()) Expect(madeProgress).To(BeTrue()) }) ginkgo.It("should process page migration rsp from CP", func() { - req := protocol.NewPageMigrationRspToDriver(10, nil, driver.gpuPort) + req := protocol.NewPageMigrationRspToDriver(nil, driver.gpuPort) - toGPUs.EXPECT().Peek().Return(req) - toGPUs.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(req) + toGPUs.EXPECT().PeekIncoming().Return(req) + toGPUs.EXPECT().RetrieveIncoming().Return(req) driver.numPagesMigratingACK = 2 - driver.processReturnReq(10) + driver.processReturnReq() Expect(driver.numPagesMigratingACK).To(Equal(uint64(1))) Expect(driver.isCurrentlyMigratingOnePage).To(BeFalse()) @@ -527,13 +546,13 @@ var _ = ginkgo.Describe("Driver", func() { }) ginkgo.It("should process page migration rsp from CP and send restart reqs to GPU and reply to MMU", func() { - req := protocol.NewPageMigrationRspToDriver(10, nil, driver.gpuPort) - toGPUs.EXPECT().Peek().Return(req) - toGPUs.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(req) + req := protocol.NewPageMigrationRspToDriver(nil, driver.gpuPort) + toGPUs.EXPECT().PeekIncoming().Return(req) + toGPUs.EXPECT().RetrieveIncoming().Return(req) driver.numPagesMigratingACK = 1 - pageMigrationReq := vm.NewPageMigrationReqToDriver(10, nil, driver.mmuPort) + pageMigrationReq := vm.NewPageMigrationReqToDriver(nil, driver.mmuPort) pageMigrationReq.PageSize = 4 * mem.KB pageMigrationReq.CurrPageHostGPU = 1 pageMigrationReq.CurrAccessingGPUs = append(pageMigrationReq.CurrAccessingGPUs, 1) @@ -545,25 +564,24 @@ var _ = ginkgo.Describe("Driver", func() { pageMigrationReq.MigrationInfo = migrationInfo driver.currentPageMigrationReq = pageMigrationReq - reqToMMU := vm.NewPageMigrationRspFromDriver(10, - driver.mmuPort, pageMigrationReq.Src) + reqToMMU := vm.NewPageMigrationRspFromDriver(driver.mmuPort, pageMigrationReq.Src, pageMigrationReq) reqToMMU.VAddr = append(reqToMMU.VAddr, 0x100) reqToMMU.RspToTop = true - driver.processReturnReq(10) + driver.processReturnReq() Expect(driver.toSendToMMU).To(BeEquivalentTo(reqToMMU)) Expect(driver.requestsToSend).To(HaveLen(1)) }) ginkgo.It("should process GPU restart rsp and send restart req to RDMAs", func() { - req := protocol.NewGPURestartRsp(10, nil, driver.gpuPort) - toGPUs.EXPECT().Peek().Return(req) - toGPUs.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(req) + req := protocol.NewGPURestartRsp(nil, driver.gpuPort) + toGPUs.EXPECT().PeekIncoming().Return(req) + toGPUs.EXPECT().RetrieveIncoming().Return(req) driver.numRestartACK = 1 - pageMigrationReq := vm.NewPageMigrationReqToDriver(10, nil, driver.mmuPort) + pageMigrationReq := vm.NewPageMigrationReqToDriver(nil, driver.mmuPort) pageMigrationReq.PageSize = 4 * mem.KB pageMigrationReq.CurrPageHostGPU = 1 pageMigrationReq.CurrAccessingGPUs = append(pageMigrationReq.CurrAccessingGPUs, 1) @@ -575,19 +593,19 @@ var _ = ginkgo.Describe("Driver", func() { pageMigrationReq.MigrationInfo = migrationInfo driver.currentPageMigrationReq = pageMigrationReq - driver.processReturnReq(10) + driver.processReturnReq() Expect(driver.requestsToSend).To(HaveLen(2)) }) ginkgo.It("should handle rdma restart rsp", func() { - req := protocol.NewRDMARestartRspToDriver(10, nil, driver.gpuPort) - toGPUs.EXPECT().Peek().Return(req) - toGPUs.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(req) + req := protocol.NewRDMARestartRspToDriver(nil, driver.gpuPort) + toGPUs.EXPECT().PeekIncoming().Return(req) + toGPUs.EXPECT().RetrieveIncoming().Return(req) driver.numRDMARestartACK = 1 - pageMigrationReq := vm.NewPageMigrationReqToDriver(10, nil, driver.mmuPort) + pageMigrationReq := vm.NewPageMigrationReqToDriver(nil, driver.mmuPort) pageMigrationReq.PageSize = 4 * mem.KB pageMigrationReq.CurrPageHostGPU = 1 pageMigrationReq.CurrAccessingGPUs = append(pageMigrationReq.CurrAccessingGPUs, 1) @@ -599,19 +617,19 @@ var _ = ginkgo.Describe("Driver", func() { pageMigrationReq.MigrationInfo = migrationInfo driver.currentPageMigrationReq = pageMigrationReq - driver.processReturnReq(10) + driver.processReturnReq() Expect(driver.currentPageMigrationReq).To(BeNil()) Expect(driver.isCurrentlyHandlingMigrationReq).To(BeFalse()) }) ginkgo.It("should send to MMU", func() { - reqToMMU := vm.NewPageMigrationRspFromDriver(10, driver.mmuPort, nil) + reqToMMU := vm.NewPageMigrationRspFromDriver(driver.mmuPort, nil, nil) driver.toSendToMMU = reqToMMU toMMU.EXPECT().Send(reqToMMU) - madeProgress := driver.sendToMMU(10) + madeProgress := driver.sendToMMU() Expect(madeProgress).To(BeTrue()) Expect(driver.toSendToMMU).To(BeNil()) diff --git a/driver/mock_sim_test.go b/driver/mock_sim_test.go index 569ccb22..806a80bf 100644 --- a/driver/mock_sim_test.go +++ b/driver/mock_sim_test.go @@ -73,6 +73,20 @@ func (mr *MockPortMockRecorder) Component() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Component", reflect.TypeOf((*MockPort)(nil).Component)) } +// Deliver mocks base method. +func (m *MockPort) Deliver(arg0 sim.Msg) *sim.SendError { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Deliver", arg0) + ret0, _ := ret[0].(*sim.SendError) + return ret0 +} + +// Deliver indicates an expected call of Deliver. +func (mr *MockPortMockRecorder) Deliver(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deliver", reflect.TypeOf((*MockPort)(nil).Deliver), arg0) +} + // Hooks mocks base method. func (m *MockPort) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -102,15 +116,15 @@ func (mr *MockPortMockRecorder) Name() *gomock.Call { } // NotifyAvailable mocks base method. -func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) { +func (m *MockPort) NotifyAvailable() { m.ctrl.T.Helper() - m.ctrl.Call(m, "NotifyAvailable", arg0) + m.ctrl.Call(m, "NotifyAvailable") } // NotifyAvailable indicates an expected call of NotifyAvailable. -func (mr *MockPortMockRecorder) NotifyAvailable(arg0 interface{}) *gomock.Call { +func (mr *MockPortMockRecorder) NotifyAvailable() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable)) } // NumHooks mocks base method. @@ -127,46 +141,60 @@ func (mr *MockPortMockRecorder) NumHooks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NumHooks", reflect.TypeOf((*MockPort)(nil).NumHooks)) } -// Peek mocks base method. -func (m *MockPort) Peek() sim.Msg { +// PeekIncoming mocks base method. +func (m *MockPort) PeekIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek") + ret := m.ctrl.Call(m, "PeekIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Peek indicates an expected call of Peek. -func (mr *MockPortMockRecorder) Peek() *gomock.Call { +// PeekIncoming indicates an expected call of PeekIncoming. +func (mr *MockPortMockRecorder) PeekIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPort)(nil).Peek)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekIncoming", reflect.TypeOf((*MockPort)(nil).PeekIncoming)) } -// Recv mocks base method. -func (m *MockPort) Recv(arg0 sim.Msg) *sim.SendError { +// PeekOutgoing mocks base method. +func (m *MockPort) PeekOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0) - ret0, _ := ret[0].(*sim.SendError) + ret := m.ctrl.Call(m, "PeekOutgoing") + ret0, _ := ret[0].(sim.Msg) + return ret0 +} + +// PeekOutgoing indicates an expected call of PeekOutgoing. +func (mr *MockPortMockRecorder) PeekOutgoing() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekOutgoing", reflect.TypeOf((*MockPort)(nil).PeekOutgoing)) +} + +// RetrieveIncoming mocks base method. +func (m *MockPort) RetrieveIncoming() sim.Msg { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveIncoming") + ret0, _ := ret[0].(sim.Msg) return ret0 } -// Recv indicates an expected call of Recv. -func (mr *MockPortMockRecorder) Recv(arg0 interface{}) *gomock.Call { +// RetrieveIncoming indicates an expected call of RetrieveIncoming. +func (mr *MockPortMockRecorder) RetrieveIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPort)(nil).Recv), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIncoming", reflect.TypeOf((*MockPort)(nil).RetrieveIncoming)) } -// Retrieve mocks base method. -func (m *MockPort) Retrieve(arg0 sim.VTimeInSec) sim.Msg { +// RetrieveOutgoing mocks base method. +func (m *MockPort) RetrieveOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Retrieve", arg0) + ret := m.ctrl.Call(m, "RetrieveOutgoing") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Retrieve indicates an expected call of Retrieve. -func (mr *MockPortMockRecorder) Retrieve(arg0 interface{}) *gomock.Call { +// RetrieveOutgoing indicates an expected call of RetrieveOutgoing. +func (mr *MockPortMockRecorder) RetrieveOutgoing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPort)(nil).Retrieve), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveOutgoing", reflect.TypeOf((*MockPort)(nil).RetrieveOutgoing)) } // Send mocks base method. @@ -256,18 +284,6 @@ func (mr *MockEngineMockRecorder) CurrentTime() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentTime", reflect.TypeOf((*MockEngine)(nil).CurrentTime)) } -// Finished mocks base method. -func (m *MockEngine) Finished() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Finished") -} - -// Finished indicates an expected call of Finished. -func (mr *MockEngineMockRecorder) Finished() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finished", reflect.TypeOf((*MockEngine)(nil).Finished)) -} - // Hooks mocks base method. func (m *MockEngine) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -308,18 +324,6 @@ func (mr *MockEngineMockRecorder) Pause() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pause", reflect.TypeOf((*MockEngine)(nil).Pause)) } -// RegisterSimulationEndHandler mocks base method. -func (m *MockEngine) RegisterSimulationEndHandler(arg0 sim.SimulationEndHandler) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterSimulationEndHandler", arg0) -} - -// RegisterSimulationEndHandler indicates an expected call of RegisterSimulationEndHandler. -func (mr *MockEngineMockRecorder) RegisterSimulationEndHandler(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterSimulationEndHandler", reflect.TypeOf((*MockEngine)(nil).RegisterSimulationEndHandler), arg0) -} - // Run mocks base method. func (m *MockEngine) Run() error { m.ctrl.T.Helper() diff --git a/go.mod b/go.mod index da77ec59..9d73026e 100644 --- a/go.mod +++ b/go.mod @@ -2,15 +2,15 @@ module github.com/sarchlab/mgpusim/v4 require ( github.com/disintegration/imaging v1.6.2 - github.com/fatih/color v1.16.0 + github.com/fatih/color v1.17.0 github.com/golang/mock v1.6.0 github.com/gorilla/mux v1.8.1 - github.com/onsi/ginkgo/v2 v2.19.0 - github.com/onsi/gomega v1.33.1 + github.com/onsi/ginkgo/v2 v2.20.1 + github.com/onsi/gomega v1.34.1 github.com/rs/xid v1.5.0 github.com/sarchlab/akita/v4 v4.0.0-alpha.3 // v3.0.0 github.com/tebeka/atexit v0.3.0 - gonum.org/v1/gonum v0.14.0 + gonum.org/v1/gonum v0.15.1 ) require ( @@ -18,24 +18,24 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-sql-driver/mysql v1.8.1 // indirect - github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect + github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect - github.com/stretchr/testify v1.7.0 // indirect github.com/syifan/goseth v0.1.2 // indirect github.com/tklauser/go-sysconf v0.3.14 // indirect github.com/tklauser/numcpus v0.8.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - golang.org/x/image v0.18.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/tools v0.22.0 // indirect + golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect + golang.org/x/image v0.19.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + golang.org/x/tools v0.24.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 413b73d6..d9b1b7d2 100644 --- a/go.sum +++ b/go.sum @@ -6,30 +6,23 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-sql-driver/mysql v1.8.0 h1:UtktXaU2Nb64z/pLiGIxY4431SJ4/dR5cjMmlVHgnT4= -github.com/go-sql-driver/mysql v1.8.0/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 h1:y3N7Bm7Y9/CtpiVkw/ZWj6lSlDF3F74SfKwfTCer72Q= -github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/google/pprof v0.0.0-20240528025155-186aa0362fba h1:ql1qNgCyOB7iAEk8JTNM+zJrgIbnyCKX/wdlyPufP5g= -github.com/google/pprof v0.0.0-20240528025155-186aa0362fba/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= @@ -45,37 +38,28 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM= -github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= -github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= -github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= -github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= +github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= +github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/sarchlab/akita/v4 v3.0.0 h1:kLRhaBpDA6yXYn5suiIFGnWJ0xr/eqGDjMTMGSwaXUM= -github.com/sarchlab/akita/v4 v3.0.0/go.mod h1:p74MfNeElTYFy9H/gwsPzZQXPfw/e87/6HiIYCZexWc= github.com/sarchlab/akita/v4 v4.0.0-alpha.3 h1:pMHcTmtaMDROb0bRr11ClVROi582miqGNgfXoOuOvkI= github.com/sarchlab/akita/v4 v4.0.0-alpha.3/go.mod h1:1QJk3rUs3sTwyqG44lJcTR++bHGT5y+FdEtACqQaPvU= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syifan/goseth v0.1.2 h1:b/VG4wboBQNedodAw6wzTz6fdtISSbYIR3ntzRw0J6Q= github.com/syifan/goseth v0.1.2/go.mod h1:XmguXtbJ2+jSQABDvr3X0uDiYo+7gak39C6BHoWDvYo= github.com/tebeka/atexit v0.3.0 h1:jleL99H7Ywt80oJKR+VWmJNnezcCOG0CuzcN3CIpsdI= github.com/tebeka/atexit v0.3.0/go.mod h1:WJmSUSmMT7WoR7etUOaGBVXk+f5/ZJ+67qwuedq7Fbs= -github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= -github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= -github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= -github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY= github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -83,18 +67,17 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= -golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= +golang.org/x/image v0.19.0 h1:D9FX4QWkLfkeqaC62SonffIIuYdOk/UE2XKUBgRIBIQ= +golang.org/x/image v0.19.0/go.mod h1:y0zrRqlQRWQ5PXaYCOMLTW2fpsxZ8Qh9I/ohnInJEys= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -106,32 +89,28 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= -gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/protocol/cuprotocol.go b/protocol/cuprotocol.go index 5714facf..deac6647 100644 --- a/protocol/cuprotocol.go +++ b/protocol/cuprotocol.go @@ -16,9 +16,9 @@ func (m *CUPipelineRestartReq) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the CUPipelineRestartReq with diffrent ID. -func (r *CUPipelineRestartReq) Clone() sim.Msg { - cloneMsg := *r +// Clone returns a clone of the CUPipelineRestartReq with different ID. +func (m *CUPipelineRestartReq) Clone() sim.Msg { + cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() return &cloneMsg @@ -60,9 +60,9 @@ func (m *CUPipelineRestartRsp) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the CUPipelineRestartRsp with diffrent ID. -func (r *CUPipelineRestartRsp) Clone() sim.Msg { - cloneMsg := *r +// Clone returns a clone of the CUPipelineRestartRsp with different ID. +func (m *CUPipelineRestartRsp) Clone() sim.Msg { + cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() return &cloneMsg @@ -104,9 +104,9 @@ func (m *CUPipelineFlushReq) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the CUPipelineFlushReq with diffrent ID. -func (r *CUPipelineFlushReq) Clone() sim.Msg { - cloneMsg := *r +// Clone returns a clone of the CUPipelineFlushReq with different ID. +func (m *CUPipelineFlushReq) Clone() sim.Msg { + cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() return &cloneMsg @@ -148,9 +148,9 @@ func (m *CUPipelineFlushRsp) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the CUPipelineFlushRsp with diffrent ID. -func (r *CUPipelineFlushRsp) Clone() sim.Msg { - cloneMsg := *r +// Clone returns a clone of the CUPipelineFlushRsp with different ID. +func (m *CUPipelineFlushRsp) Clone() sim.Msg { + cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() return &cloneMsg @@ -205,7 +205,7 @@ func (r *MapWGReq) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the MapWGReq with diffrent ID. +// Clone returns a clone of the MapWGReq with different ID. func (r *MapWGReq) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -275,7 +275,7 @@ func (r *WGCompletionMsg) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the WGCompletionMsg with diffrent ID. +// Clone returns a clone of the WGCompletionMsg with different ID. func (r *WGCompletionMsg) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() diff --git a/protocol/driverprotocol.go b/protocol/driverprotocol.go index f8a722c0..a698a804 100644 --- a/protocol/driverprotocol.go +++ b/protocol/driverprotocol.go @@ -17,7 +17,7 @@ func (m *FlushReq) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the FlushReq with diffrent ID. +// Clone returns a clone of the FlushReq with different ID. func (m *FlushReq) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -52,7 +52,7 @@ func (m *LaunchKernelReq) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the LaunchKernelReq with diffrent ID. +// Clone returns a clone of the LaunchKernelReq with different ID. func (m *LaunchKernelReq) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -84,7 +84,7 @@ func (m *LaunchKernelRsp) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the LaunchKernelRsp with diffrent ID. +// Clone returns a clone of the LaunchKernelRsp with different ID. func (m *LaunchKernelRsp) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -120,7 +120,7 @@ func (m *MemCopyH2DReq) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the MemCopyH2DReq with diffrent ID. +// Clone returns a clone of the MemCopyH2DReq with different ID. func (m *MemCopyH2DReq) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -157,7 +157,7 @@ func (m *MemCopyD2HReq) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the MemCopyD2HReq with diffrent ID. +// Clone returns a clone of the MemCopyD2HReq with different ID. func (m *MemCopyD2HReq) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -198,7 +198,7 @@ func (m *ShootDownCommand) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the ShootDownCommand with diffrent ID. +// Clone returns a clone of the ShootDownCommand with different ID. func (m *ShootDownCommand) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -234,7 +234,7 @@ func (m *ShootDownCompleteRsp) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the ShootDownCompleteRsp with diffrent ID. +// Clone returns a clone of the ShootDownCompleteRsp with different ID. func (m *ShootDownCompleteRsp) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -266,7 +266,7 @@ func (m *RDMADrainCmdFromDriver) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the RDMADrainCmdFromDriver with diffrent ID. +// Clone returns a clone of the RDMADrainCmdFromDriver with different ID. func (m *RDMADrainCmdFromDriver) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -298,7 +298,7 @@ func (m *RDMADrainRspToDriver) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the RDMADrainRspToDriver with diffrent ID. +// Clone returns a clone of the RDMADrainRspToDriver with different ID. func (m *RDMADrainRspToDriver) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -330,7 +330,7 @@ func (m *RDMARestartCmdFromDriver) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the RDMARestartCmdFromDriver with diffrent ID. +// Clone returns a clone of the RDMARestartCmdFromDriver with different ID. func (m *RDMARestartCmdFromDriver) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -362,7 +362,7 @@ func (m *GPURestartReq) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the GPURestartReq with diffrent ID. +// Clone returns a clone of the GPURestartReq with different ID. func (m *GPURestartReq) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -394,7 +394,7 @@ func (m *GPURestartRsp) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the GPURestartRsp with diffrent ID. +// Clone returns a clone of the GPURestartRsp with different ID. func (m *GPURestartRsp) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -431,7 +431,7 @@ func (m *PageMigrationReqToCP) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the PageMigrationReqToCP with diffrent ID. +// Clone returns a clone of the PageMigrationReqToCP with different ID. func (m *PageMigrationReqToCP) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -463,7 +463,7 @@ func (m *PageMigrationRspToDriver) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the PageMigrationRspToDriver with diffrent ID. +// Clone returns a clone of the PageMigrationRspToDriver with different ID. func (m *PageMigrationRspToDriver) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -495,7 +495,7 @@ func (m *RDMARestartRspToDriver) Meta() *sim.MsgMeta { return &m.MsgMeta } -// Clone returns a clone of the RDMARestartRspToDriver with diffrent ID. +// Clone returns a clone of the RDMARestartRspToDriver with different ID. func (m *RDMARestartRspToDriver) Clone() sim.Msg { cloneMsg := *m cloneMsg.ID = sim.GetIDGenerator().Generate() diff --git a/timing/cp/commandprocessor_test.go b/timing/cp/commandprocessor_test.go index ff706e8a..c6ace611 100644 --- a/timing/cp/commandprocessor_test.go +++ b/timing/cp/commandprocessor_test.go @@ -153,38 +153,35 @@ var _ = Describe("CommandProcessor", func() { }) It("should forward kernel launching request to a Dispatcher", func() { - req := protocol.NewLaunchKernelReq(10, - driver, commandProcessor.ToDriver) + req := protocol.NewLaunchKernelReq(driver, commandProcessor.ToDriver) dispatcher.EXPECT().IsDispatching().Return(false) dispatcher.EXPECT().StartDispatching(req) - toDriver.EXPECT().Retrieve(sim.VTimeInSec(10)) + toDriver.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processLaunchKernelReq(10, req) + madeProgress := commandProcessor.processLaunchKernelReq(req) Expect(madeProgress).To(BeTrue()) }) It("should wait if there is no dispatcher available", func() { - req := protocol.NewLaunchKernelReq(10, - driver, commandProcessor.ToDriver) + req := protocol.NewLaunchKernelReq(driver, commandProcessor.ToDriver) dispatcher.EXPECT().IsDispatching().Return(true) - madeProgress := commandProcessor.processLaunchKernelReq(10, req) + madeProgress := commandProcessor.processLaunchKernelReq(req) Expect(madeProgress).To(BeFalse()) }) It("should handle a RDMA drain req from driver", func() { - cmd := protocol.NewRDMADrainCmdFromDriver( - 10, nil, commandProcessor.ToDriver) + cmd := protocol.NewRDMADrainCmdFromDriver(nil, commandProcessor.ToDriver) drainReq := rdma.DrainReqBuilder{}.Build() toRDMASender.EXPECT().Send(gomock.AssignableToTypeOf(drainReq)) - toDriver.EXPECT().Retrieve(sim.VTimeInSec(10)) + toDriver.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processRDMADrainCmd(10, cmd) + madeProgress := commandProcessor.processRDMADrainCmd(cmd) Expect(madeProgress).To(BeTrue()) }) @@ -192,12 +189,12 @@ var _ = Describe("CommandProcessor", func() { It("should handle a RDMA drain rsp from RDMA", func() { req := rdma.DrainRspBuilder{}.Build() - drainRsp := protocol.NewRDMADrainRspToDriver(10, + drainRsp := protocol.NewRDMADrainRspToDriver( commandProcessor.ToDriver, commandProcessor.Driver) toDriverSender.EXPECT().Send(gomock.AssignableToTypeOf(drainRsp)) - toRDMA.EXPECT().Retrieve(sim.VTimeInSec(10)) + toRDMA.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processRDMADrainRsp(10, req) + madeProgress := commandProcessor.processRDMADrainRsp(req) Expect(madeProgress).To(BeTrue()) }) @@ -206,18 +203,17 @@ var _ = Describe("CommandProcessor", func() { vAddr := make([]uint64, 0) vAddr = append(vAddr, 100) cmd := protocol.NewShootdownCommand( - 10, nil, commandProcessor.ToDriver, vAddr, 1) + nil, commandProcessor.ToDriver, vAddr, 1) for i := 0; i < 10; i++ { cuFlushReq := protocol.CUPipelineFlushReqBuilder{}.Build() - cuFlushReq.SendTime = 10 cuFlushReq.Src = commandProcessor.ToCUs cuFlushReq.Dst = commandProcessor.CUs[i] toCUsSender.EXPECT().Send(gomock.AssignableToTypeOf(cuFlushReq)) } - toDriver.EXPECT().Retrieve(sim.VTimeInSec(10)) + toDriver.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processShootdownCommand(10, cmd) + madeProgress := commandProcessor.processShootdownCommand(cmd) Expect(commandProcessor.numCUAck).To(Equal(uint64(10))) Expect(madeProgress).To(BeTrue()) @@ -225,16 +221,15 @@ var _ = Describe("CommandProcessor", func() { It("should handle a CU pipeline flush rsp", func() { req := protocol.CUPipelineFlushRspBuilder{}.Build() - req.SendTime = 10 req.Dst = commandProcessor.ToCUs commandProcessor.numCUAck = 1 for i := 0; i < 10; i++ { toAddressTranslatorSender.EXPECT().Send(gomock.Any()) } - toCU.EXPECT().Retrieve(sim.VTimeInSec(10)) + toCU.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processCUPipelineFlushRsp(10, req) + madeProgress := commandProcessor.processCUPipelineFlushRsp(req) Expect(commandProcessor.numAddrTranslationFlushAck). To(Equal(uint64(10))) @@ -243,7 +238,6 @@ var _ = Describe("CommandProcessor", func() { It("should handle a AT flush rsp", func() { req := mem.ControlMsgBuilder{}. - WithSendTime(10). WithDst(commandProcessor.ToAddressTranslators). ToNotifyDone(). Build() @@ -251,7 +245,6 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { cacheFlushReq := cache.FlushReqBuilder{}.Build() - cacheFlushReq.SendTime = 10 cacheFlushReq.Src = commandProcessor.ToCaches cacheFlushReq.Dst = commandProcessor.L1ICaches[i] cacheFlushReq.DiscardInflight = true @@ -263,7 +256,6 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { cacheFlushReq := cache.FlushReqBuilder{}.Build() - cacheFlushReq.SendTime = 10 cacheFlushReq.Src = commandProcessor.ToCaches cacheFlushReq.Dst = commandProcessor.L1VCaches[i] cacheFlushReq.DiscardInflight = true @@ -275,7 +267,6 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { cacheFlushReq := cache.FlushReqBuilder{}.Build() - cacheFlushReq.SendTime = 10 cacheFlushReq.Src = commandProcessor.ToCaches cacheFlushReq.Dst = commandProcessor.L1VCaches[i] cacheFlushReq.DiscardInflight = true @@ -287,7 +278,6 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { cacheFlushReq := cache.FlushReqBuilder{}.Build() - cacheFlushReq.SendTime = 10 cacheFlushReq.Src = commandProcessor.ToCaches cacheFlushReq.Dst = commandProcessor.L2Caches[i] cacheFlushReq.DiscardInflight = true @@ -297,10 +287,10 @@ var _ = Describe("CommandProcessor", func() { Send(gomock.AssignableToTypeOf(cacheFlushReq)) } - toAddressTranslator.EXPECT().Retrieve(sim.VTimeInSec(10)) + toAddressTranslator.EXPECT().RetrieveIncoming() madeProgress := commandProcessor.processAddressTranslatorFlushRsp( - 10, req) + req) Expect(commandProcessor.numCacheACK).To(Equal(uint64(40))) Expect(madeProgress).To(BeTrue()) @@ -309,10 +299,9 @@ var _ = Describe("CommandProcessor", func() { It("should handle a Cache flush rsp", func() { req := cache.FlushRspBuilder{}.Build() req.Dst = commandProcessor.ToDMA - req.SendTime = 10 vAddr := make([]uint64, 0) vAddr = append(vAddr, 100) - shootDwnCmd := protocol.NewShootdownCommand(10, nil, commandProcessor.ToDriver, vAddr, 1) + shootDwnCmd := protocol.NewShootdownCommand(nil, commandProcessor.ToDriver, vAddr, 1) commandProcessor.numCacheACK = 1 commandProcessor.shootDownInProcess = true @@ -320,42 +309,39 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { tlbFlushReq := tlb.FlushReqBuilder{}.Build() - tlbFlushReq.SendTime = 10 tlbFlushReq.Src = commandProcessor.ToTLBs tlbFlushReq.Dst = commandProcessor.TLBs[i] toTLBSender.EXPECT().Send(gomock.AssignableToTypeOf(tlbFlushReq)) } - toCaches.EXPECT().Retrieve(sim.VTimeInSec(10)) + toCaches.EXPECT().RetrieveIncoming() - commandProcessor.processCacheFlushRsp(10, req) + commandProcessor.processCacheFlushRsp(req) Expect(commandProcessor.numTLBAck).To(Equal(uint64(10))) }) It("should handle a TLB flush rsp", func() { req := tlb.FlushRspBuilder{}.Build() - req.SendTime = 10 req.Dst = commandProcessor.ToTLBs commandProcessor.numTLBAck = 1 - rsp := protocol.NewShootdownCompleteRsp(10, commandProcessor.ToDriver, commandProcessor.Driver) + rsp := protocol.NewShootdownCompleteRsp(commandProcessor.ToDriver, commandProcessor.Driver) toDriverSender.EXPECT().Send(gomock.AssignableToTypeOf(rsp)) - toTLB.EXPECT().Retrieve(sim.VTimeInSec(10)) + toTLB.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processTLBFlushRsp(10, req) + madeProgress := commandProcessor.processTLBFlushRsp(req) Expect(madeProgress).To(BeTrue()) Expect(commandProcessor.shootDownInProcess).To(BeFalse()) }) It("should handle a GPU restart req", func() { - req := protocol.NewGPURestartReq(10, nil, commandProcessor.ToDriver) + req := protocol.NewGPURestartReq(nil, commandProcessor.ToDriver) for i := 0; i < 10; i++ { cacheRestartReq := cache.RestartReqBuilder{}.Build() - cacheRestartReq.SendTime = 10 cacheRestartReq.Src = commandProcessor.ToCaches cacheRestartReq.Dst = commandProcessor.L1ICaches[i] toCachesSender.EXPECT(). @@ -364,7 +350,6 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { cacheRestartReq := cache.RestartReqBuilder{}.Build() - cacheRestartReq.SendTime = 10 cacheRestartReq.Src = commandProcessor.ToCaches cacheRestartReq.Dst = commandProcessor.L1SCaches[i] toCachesSender.EXPECT(). @@ -373,7 +358,6 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { cacheRestartReq := cache.RestartReqBuilder{}.Build() - cacheRestartReq.SendTime = 10 cacheRestartReq.Src = commandProcessor.ToCaches cacheRestartReq.Dst = commandProcessor.L1VCaches[i] toCachesSender.EXPECT(). @@ -382,16 +366,15 @@ var _ = Describe("CommandProcessor", func() { for i := 0; i < 10; i++ { cacheRestartReq := cache.RestartReqBuilder{}.Build() - cacheRestartReq.SendTime = 10 cacheRestartReq.Src = commandProcessor.ToCaches cacheRestartReq.Dst = commandProcessor.L2Caches[i] toCachesSender.EXPECT(). Send(gomock.AssignableToTypeOf(cacheRestartReq)) } - toDriver.EXPECT().Retrieve(sim.VTimeInSec(10)) + toDriver.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processGPURestartReq(10, req) + madeProgress := commandProcessor.processGPURestartReq(req) Expect(madeProgress).To(BeTrue()) Expect(commandProcessor.numCacheACK).To(Equal(uint64(40))) @@ -399,21 +382,19 @@ var _ = Describe("CommandProcessor", func() { It("should handle a cache restart rsp", func() { req := cache.RestartRspBuilder{}.Build() - req.SendTime = 10 req.Dst = commandProcessor.ToDMA commandProcessor.numCacheACK = 1 for i := 0; i < 10; i++ { tlbRestartReq := tlb.RestartReqBuilder{}.Build() - tlbRestartReq.SendTime = 10 tlbRestartReq.Src = commandProcessor.ToTLBs tlbRestartReq.Dst = commandProcessor.TLBs[i] toTLBSender.EXPECT().Send(gomock.AssignableToTypeOf(tlbRestartReq)) } - toCaches.EXPECT().Retrieve(sim.VTimeInSec(10)) + toCaches.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processCacheRestartRsp(10, req) + madeProgress := commandProcessor.processCacheRestartRsp(req) Expect(madeProgress).To(BeTrue()) Expect(commandProcessor.numTLBAck).To(Equal(uint64(10))) @@ -421,7 +402,6 @@ var _ = Describe("CommandProcessor", func() { It("should handle a TLB restart rsp", func() { req := tlb.RestartRspBuilder{}.Build() - req.SendTime = 10 req.Dst = commandProcessor.ToTLBs commandProcessor.numTLBAck = 1 @@ -430,9 +410,9 @@ var _ = Describe("CommandProcessor", func() { toAddressTranslatorSender.EXPECT(). Send(gomock.Any()) } - toTLB.EXPECT().Retrieve(sim.VTimeInSec(10)) + toTLB.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processTLBRestartRsp(10, req) + madeProgress := commandProcessor.processTLBRestartRsp(req) Expect(madeProgress).To(BeTrue()) Expect(commandProcessor.numAddrTranslationRestartAck). @@ -442,22 +422,20 @@ var _ = Describe("CommandProcessor", func() { It("should handle a AT restart rsp", func() { req := mem.ControlMsgBuilder{}. WithDst(commandProcessor.ToAddressTranslators). - WithSendTime(10). ToNotifyDone(). Build() commandProcessor.numAddrTranslationRestartAck = 1 for i := 0; i < 10; i++ { cuRestartReq := protocol.CUPipelineRestartReqBuilder{}.Build() - cuRestartReq.SendTime = 10 cuRestartReq.Src = commandProcessor.ToCUs cuRestartReq.Dst = commandProcessor.CUs[i] toCUsSender.EXPECT().Send(gomock.AssignableToTypeOf(cuRestartReq)) } - toAddressTranslator.EXPECT().Retrieve(sim.VTimeInSec(10)) + toAddressTranslator.EXPECT().RetrieveIncoming() madeProgress := - commandProcessor.processAddressTranslatorRestartRsp(10, req) + commandProcessor.processAddressTranslatorRestartRsp(req) Expect(commandProcessor.numCUAck).To(Equal(uint64(10))) Expect(madeProgress).To(BeTrue()) @@ -465,24 +443,23 @@ var _ = Describe("CommandProcessor", func() { It("should handle a CU pipeline restart rsp", func() { req := protocol.CUPipelineRestartRspBuilder{}.Build() - req.SendTime = 10 req.Dst = commandProcessor.ToCUs commandProcessor.numCUAck = 1 - gpuRestartRsp := protocol.NewGPURestartRsp(10, + gpuRestartRsp := protocol.NewGPURestartRsp( commandProcessor.ToDriver, commandProcessor.Driver) toDriverSender.EXPECT().Send(gomock.AssignableToTypeOf(gpuRestartRsp)) - toCU.EXPECT().Retrieve(sim.VTimeInSec(10)) + toCU.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processCUPipelineRestartRsp(10, req) + madeProgress := commandProcessor.processCUPipelineRestartRsp(req) Expect(madeProgress).To(BeTrue()) }) It("should handle a page migration req", func() { req := protocol.NewPageMigrationReqToCP( - 10, nil, commandProcessor.ToDriver) + nil, commandProcessor.ToDriver) req.ToWriteToPhysicalAddress = 0x100 req.ToReadFromPhysicalAddress = 0x20 remotePMC := NewMockPort(mockCtrl) @@ -491,17 +468,16 @@ var _ = Describe("CommandProcessor", func() { reqToPMC := pagemigrationcontroller.PageMigrationReqToPMCBuilder{}. Build() - req.SendTime = 10 reqToPMC.PageSize = req.PageSize reqToPMC.ToReadFromPhysicalAddress = req.ToReadFromPhysicalAddress reqToPMC.ToWriteToPhysicalAddress = req.ToWriteToPhysicalAddress reqToPMC.PMCPortOfRemoteGPU = req.DestinationPMCPort toPMCSender.EXPECT().Send(gomock.AssignableToTypeOf(reqToPMC)) - toDriver.EXPECT().Retrieve(sim.VTimeInSec(10)) + toDriver.EXPECT().RetrieveIncoming() madeProgress := - commandProcessor.processPageMigrationReq(10, req) + commandProcessor.processPageMigrationReq(req) Expect(madeProgress).To(BeTrue()) @@ -509,16 +485,15 @@ var _ = Describe("CommandProcessor", func() { It("should handle a page migration rsp", func() { req := pagemigrationcontroller.PageMigrationRspFromPMCBuilder{}.Build() - req.SendTime = 10 req.Dst = commandProcessor.ToPMC - rsp := protocol.NewPageMigrationRspToDriver(10, + rsp := protocol.NewPageMigrationRspToDriver( commandProcessor.ToDriver, commandProcessor.Driver) toDriverSender.EXPECT().Send(gomock.AssignableToTypeOf(rsp)) - toPMC.EXPECT().Retrieve(sim.VTimeInSec(10)) + toPMC.EXPECT().RetrieveIncoming() - madeProgress := commandProcessor.processPageMigrationRsp(10, req) + madeProgress := commandProcessor.processPageMigrationRsp(req) Expect(madeProgress).To(BeTrue()) }) diff --git a/timing/cp/dma_test.go b/timing/cp/dma_test.go index 82ab0463..31d97d93 100644 --- a/timing/cp/dma_test.go +++ b/timing/cp/dma_test.go @@ -38,13 +38,13 @@ var _ = Describe("DMAEngine", func() { It("should stall if dma is processing max request number", func() { for i := 0; i < int(dmaEngine.maxRequestCount); i++ { srcBuf := make([]byte, 128) - req := protocol.NewMemCopyH2DReq(5, nil, toCP, srcBuf, uint64(20+128*i)) + req := protocol.NewMemCopyH2DReq(nil, toCP, srcBuf, uint64(20+128*i)) rqC := NewRequestCollection(req) dmaEngine.processingReqs = append(dmaEngine.processingReqs, rqC) } - madeProgress := dmaEngine.parseFromCP(6) + madeProgress := dmaEngine.parseFromCP() Expect(dmaEngine.toSendToMem).To(HaveLen(0)) Expect(madeProgress).To(BeFalse()) @@ -52,11 +52,11 @@ var _ = Describe("DMAEngine", func() { It("should parse MemCopyH2D from CP", func() { srcBuf := make([]byte, 128) - req := protocol.NewMemCopyH2DReq(5, nil, toCP, srcBuf, 20) + req := protocol.NewMemCopyH2DReq(nil, toCP, srcBuf, 20) - toCP.EXPECT().Retrieve(sim.VTimeInSec(6)).Return(req) + toCP.EXPECT().RetrieveIncoming().Return(req) - madeProgress := dmaEngine.parseFromCP(6) + madeProgress := dmaEngine.parseFromCP() Expect(dmaEngine.processingReqs[0].superiorRequest).To(BeIdenticalTo(req)) Expect(dmaEngine.toSendToMem).To(HaveLen(3)) @@ -72,11 +72,11 @@ var _ = Describe("DMAEngine", func() { It("should parse MemCopyD2H from CP", func() { dstBuf := make([]byte, 128) - req := protocol.NewMemCopyD2HReq(5, nil, toCP, 20, dstBuf) + req := protocol.NewMemCopyD2HReq(nil, toCP, 20, dstBuf) - toCP.EXPECT().Retrieve(sim.VTimeInSec(6)).Return(req) + toCP.EXPECT().RetrieveIncoming().Return(req) - madeProgress := dmaEngine.parseFromCP(6) + madeProgress := dmaEngine.parseFromCP() Expect(dmaEngine.processingReqs[0].superiorRequest).To(BeIdenticalTo(req)) Expect(dmaEngine.toSendToMem).To(HaveLen(3)) @@ -92,24 +92,21 @@ var _ = Describe("DMAEngine", func() { It("should parse DataReady from mem", func() { dstBuf := make([]byte, 128) - req := protocol.NewMemCopyD2HReq(5, nil, toCP, 20, dstBuf) + req := protocol.NewMemCopyD2HReq(nil, toCP, 20, dstBuf) rqC := NewRequestCollection(req) dmaEngine.processingReqs = append(dmaEngine.processingReqs, rqC) reqToBottom1 := mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(20). WithByteSize(64). Build() reqToBottom2 := mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(64). WithByteSize(64). Build() reqToBottom3 := mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(128). WithByteSize(64). @@ -122,7 +119,6 @@ var _ = Describe("DMAEngine", func() { rqC.appendSubordinateID(reqToBottom3.Meta().ID) dataReady := mem.DataReadyRspBuilder{}. - WithSendTime(7). WithDst(toMem). WithRspTo(reqToBottom2.ID). WithData([]byte{ @@ -135,9 +131,9 @@ var _ = Describe("DMAEngine", func() { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, }).Build() - toMem.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(dataReady) + toMem.EXPECT().RetrieveIncoming().Return(dataReady) - madeProgress := dmaEngine.parseFromMem(10) + madeProgress := dmaEngine.parseFromMem() Expect(madeProgress).To(BeTrue()) Expect(dmaEngine.processingReqs[0].superiorRequest).To(BeIdenticalTo(req)) @@ -150,12 +146,11 @@ var _ = Describe("DMAEngine", func() { It("should respond MemCopyD2H", func() { dstBuf := make([]byte, 128) - req := protocol.NewMemCopyD2HReq(5, nil, toCP, 20, dstBuf) + req := protocol.NewMemCopyD2HReq(nil, toCP, 20, dstBuf) rqC := NewRequestCollection(req) dmaEngine.processingReqs = append(dmaEngine.processingReqs, rqC) reqToBottom2 := mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(64). WithByteSize(64). @@ -164,7 +159,6 @@ var _ = Describe("DMAEngine", func() { rqC.appendSubordinateID(reqToBottom2.Meta().ID) dataReady := mem.DataReadyRspBuilder{}. - WithSendTime(7). WithDst(toMem). WithRspTo(reqToBottom2.ID). WithData([]byte{ @@ -178,9 +172,9 @@ var _ = Describe("DMAEngine", func() { 1, 2, 3, 4, 5, 6, 7, 8, }). Build() - toMem.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(dataReady) + toMem.EXPECT().RetrieveIncoming().Return(dataReady) - madeProgress := dmaEngine.parseFromMem(10) + madeProgress := dmaEngine.parseFromMem() Expect(madeProgress).To(BeTrue()) Expect(dmaEngine.processingReqs).To(BeEmpty()) @@ -192,22 +186,19 @@ var _ = Describe("DMAEngine", func() { It("should parse Done from mem", func() { srcBuf := make([]byte, 128) - req := protocol.NewMemCopyH2DReq(5, nil, toCP, srcBuf, 20) + req := protocol.NewMemCopyH2DReq(nil, toCP, srcBuf, 20) rqC := NewRequestCollection(req) dmaEngine.processingReqs = append(dmaEngine.processingReqs, rqC) reqToBottom1 := mem.WriteReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(20). Build() reqToBottom2 := mem.WriteReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(64). Build() reqToBottom3 := mem.WriteReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(128). Build() @@ -220,14 +211,13 @@ var _ = Describe("DMAEngine", func() { rqC.appendSubordinateID(reqToBottom3.Meta().ID) done := mem.WriteDoneRspBuilder{}. - WithSendTime(7). WithDst(toMem). WithRspTo(reqToBottom2.ID). Build() - toMem.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(done) + toMem.EXPECT().RetrieveIncoming().Return(done) - madeProgress := dmaEngine.parseFromMem(10) + madeProgress := dmaEngine.parseFromMem() Expect(madeProgress).To(BeTrue()) Expect(dmaEngine.processingReqs[0].superiorRequest).To(BeIdenticalTo(req)) @@ -239,12 +229,11 @@ var _ = Describe("DMAEngine", func() { It("should send MemCopyH2D to top", func() { srcBuf := make([]byte, 128) - req := protocol.NewMemCopyH2DReq(5, nil, toCP, srcBuf, 20) + req := protocol.NewMemCopyH2DReq(nil, toCP, srcBuf, 20) rqC := NewRequestCollection(req) dmaEngine.processingReqs = append(dmaEngine.processingReqs, rqC) reqToBottom2 := mem.WriteReqBuilder{}. - WithSendTime(6). WithSrc(toMem). WithAddress(64). Build() @@ -252,14 +241,13 @@ var _ = Describe("DMAEngine", func() { rqC.appendSubordinateID(reqToBottom2.Meta().ID) done := mem.WriteDoneRspBuilder{}. - WithSendTime(7). WithDst(toMem). WithRspTo(reqToBottom2.ID). Build() - toMem.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(done) + toMem.EXPECT().RetrieveIncoming().Return(done) - madeProgress := dmaEngine.parseFromMem(10) + madeProgress := dmaEngine.parseFromMem() Expect(madeProgress).To(BeTrue()) Expect(dmaEngine.processingReqs).To(BeEmpty()) diff --git a/timing/cp/internal/dispatching/dispatcher_test.go b/timing/cp/internal/dispatching/dispatcher_test.go index 3bdeb944..3e166392 100644 --- a/timing/cp/internal/dispatching/dispatcher_test.go +++ b/timing/cp/internal/dispatching/dispatcher_test.go @@ -52,7 +52,7 @@ var _ = Describe("Dispatcher", func() { packet := &kernels.HsaKernelDispatchPacket{} packetAddr := uint64(0x40) - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) req.HsaCo = hsaco req.Packet = packet req.PacketAddress = packetAddr @@ -69,24 +69,24 @@ var _ = Describe("Dispatcher", func() { }) It("should panic if the dispatcher is dispatching another kernel", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req Expect(func() { dispatcher.StartDispatching(req) }).To(Panic()) }) It("should dispatch work-groups", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req alg.EXPECT().HasNext().Return(true).AnyTimes() alg.EXPECT().Next().Return(dispatchLocation{ valid: true, }) - dispatchingPort.EXPECT().Peek().Return(nil) + dispatchingPort.EXPECT().PeekIncoming().Return(nil) dispatchingPort.EXPECT().Send(gomock.Any()).Return(nil) - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeTrue()) Expect(dispatcher.currWG.valid).To(BeFalse()) @@ -96,27 +96,27 @@ var _ = Describe("Dispatcher", func() { }) It("should wait until cycle left becomes 0", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req dispatcher.cycleLeft = 3 - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeTrue()) Expect(dispatcher.cycleLeft).To(Equal(2)) }) It("should pause if no work-group can be executed", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req - dispatchingPort.EXPECT().Peek().Return(nil) + dispatchingPort.EXPECT().PeekIncoming().Return(nil) alg.EXPECT().HasNext().Return(true).AnyTimes() alg.EXPECT().Next().Return(dispatchLocation{ valid: false, }) - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeFalse()) Expect(dispatcher.currWG.valid).To(BeFalse()) @@ -124,10 +124,10 @@ var _ = Describe("Dispatcher", func() { }) It("should pause if send to CU failed", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req - dispatchingPort.EXPECT().Peek().Return(nil) + dispatchingPort.EXPECT().PeekIncoming().Return(nil) alg.EXPECT().HasNext().Return(true).AnyTimes() alg.EXPECT().Next().Return(dispatchLocation{ valid: true, @@ -136,7 +136,7 @@ var _ = Describe("Dispatcher", func() { Send(gomock.Any()). Return(sim.NewSendError()) - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeFalse()) Expect(dispatcher.currWG.valid).To(BeTrue()) @@ -144,22 +144,22 @@ var _ = Describe("Dispatcher", func() { }) It("should do nothing if all work-groups dispatched", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req dispatcher.numDispatchedWGs = 64 dispatcher.numCompletedWGs = 48 - dispatchingPort.EXPECT().Peek().Return(nil) + dispatchingPort.EXPECT().PeekIncoming().Return(nil) alg.EXPECT().HasNext().Return(false).AnyTimes() - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeFalse()) }) It("should receive work-group complete message", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req mapWGReq := protocol.MapWGReqBuilder{}.Build() @@ -176,12 +176,12 @@ var _ = Describe("Dispatcher", func() { alg.EXPECT().NumWG().Return(64) alg.EXPECT().FreeResources(location) dispatchingPort.EXPECT(). - Peek(). + PeekIncoming(). Return(wgCompletionMsg) dispatchingPort.EXPECT(). - Retrieve(sim.VTimeInSec(10)) + RetrieveIncoming() - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeTrue()) Expect(dispatcher.inflightWGs).NotTo(HaveKey(mapWGReq.ID)) @@ -189,7 +189,7 @@ var _ = Describe("Dispatcher", func() { It(`should add kernel overhead after completing the last Work-Group`, func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req mapWGReq := protocol.MapWGReqBuilder{}.Build() @@ -206,12 +206,12 @@ var _ = Describe("Dispatcher", func() { alg.EXPECT().NumWG().Return(64) alg.EXPECT().FreeResources(location) dispatchingPort.EXPECT(). - Peek(). + PeekIncoming(). Return(wgCompletionMsg) dispatchingPort.EXPECT(). - Retrieve(sim.VTimeInSec(10)) + RetrieveIncoming() - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeTrue()) Expect(dispatcher.inflightWGs).NotTo(HaveKey(mapWGReq.ID)) @@ -221,7 +221,7 @@ var _ = Describe("Dispatcher", func() { It(`should ignore response if the request is not sent by the dispatcher`, func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req mapWGReq := protocol.MapWGReqBuilder{}.Build() @@ -234,47 +234,47 @@ var _ = Describe("Dispatcher", func() { alg.EXPECT().HasNext().Return(false).AnyTimes() dispatchingPort.EXPECT(). - Peek(). + PeekIncoming(). Return(wgCompletionMsg) - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeFalse()) }) It("should send response when a kernel is completed", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req dispatcher.numDispatchedWGs = 64 dispatcher.numCompletedWGs = 64 alg.EXPECT().HasNext().Return(false).AnyTimes() - dispatchingPort.EXPECT().Peek().Return(nil) + dispatchingPort.EXPECT().PeekIncoming().Return(nil) respondingPort.EXPECT(). Send(gomock.Any()). Return(nil) - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeTrue()) Expect(dispatcher.dispatching).To(BeNil()) }) It("should wait if response is failed to send", func() { - req := protocol.NewLaunchKernelReq(10, nil, respondingPort) + req := protocol.NewLaunchKernelReq(nil, respondingPort) dispatcher.dispatching = req dispatcher.numDispatchedWGs = 64 dispatcher.numCompletedWGs = 64 alg.EXPECT().HasNext().Return(false).AnyTimes() - dispatchingPort.EXPECT().Peek().Return(nil) + dispatchingPort.EXPECT().PeekIncoming().Return(nil) respondingPort.EXPECT(). Send(gomock.Any()). Return(sim.NewSendError()) - madeProgress := dispatcher.Tick(10) + madeProgress := dispatcher.Tick() Expect(madeProgress).To(BeFalse()) Expect(dispatcher.dispatching).To(BeIdenticalTo(req)) diff --git a/timing/cp/internal/dispatching/mock_sim_test.go b/timing/cp/internal/dispatching/mock_sim_test.go index cd4eaf8c..b7278844 100644 --- a/timing/cp/internal/dispatching/mock_sim_test.go +++ b/timing/cp/internal/dispatching/mock_sim_test.go @@ -73,6 +73,20 @@ func (mr *MockPortMockRecorder) Component() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Component", reflect.TypeOf((*MockPort)(nil).Component)) } +// Deliver mocks base method. +func (m *MockPort) Deliver(arg0 sim.Msg) *sim.SendError { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Deliver", arg0) + ret0, _ := ret[0].(*sim.SendError) + return ret0 +} + +// Deliver indicates an expected call of Deliver. +func (mr *MockPortMockRecorder) Deliver(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deliver", reflect.TypeOf((*MockPort)(nil).Deliver), arg0) +} + // Hooks mocks base method. func (m *MockPort) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -102,15 +116,15 @@ func (mr *MockPortMockRecorder) Name() *gomock.Call { } // NotifyAvailable mocks base method. -func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) { +func (m *MockPort) NotifyAvailable() { m.ctrl.T.Helper() - m.ctrl.Call(m, "NotifyAvailable", arg0) + m.ctrl.Call(m, "NotifyAvailable") } // NotifyAvailable indicates an expected call of NotifyAvailable. -func (mr *MockPortMockRecorder) NotifyAvailable(arg0 interface{}) *gomock.Call { +func (mr *MockPortMockRecorder) NotifyAvailable() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable)) } // NumHooks mocks base method. @@ -127,46 +141,60 @@ func (mr *MockPortMockRecorder) NumHooks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NumHooks", reflect.TypeOf((*MockPort)(nil).NumHooks)) } -// Peek mocks base method. -func (m *MockPort) Peek() sim.Msg { +// PeekIncoming mocks base method. +func (m *MockPort) PeekIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek") + ret := m.ctrl.Call(m, "PeekIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Peek indicates an expected call of Peek. -func (mr *MockPortMockRecorder) Peek() *gomock.Call { +// PeekIncoming indicates an expected call of PeekIncoming. +func (mr *MockPortMockRecorder) PeekIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPort)(nil).Peek)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekIncoming", reflect.TypeOf((*MockPort)(nil).PeekIncoming)) } -// Recv mocks base method. -func (m *MockPort) Recv(arg0 sim.Msg) *sim.SendError { +// PeekOutgoing mocks base method. +func (m *MockPort) PeekOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0) - ret0, _ := ret[0].(*sim.SendError) + ret := m.ctrl.Call(m, "PeekOutgoing") + ret0, _ := ret[0].(sim.Msg) + return ret0 +} + +// PeekOutgoing indicates an expected call of PeekOutgoing. +func (mr *MockPortMockRecorder) PeekOutgoing() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekOutgoing", reflect.TypeOf((*MockPort)(nil).PeekOutgoing)) +} + +// RetrieveIncoming mocks base method. +func (m *MockPort) RetrieveIncoming() sim.Msg { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveIncoming") + ret0, _ := ret[0].(sim.Msg) return ret0 } -// Recv indicates an expected call of Recv. -func (mr *MockPortMockRecorder) Recv(arg0 interface{}) *gomock.Call { +// RetrieveIncoming indicates an expected call of RetrieveIncoming. +func (mr *MockPortMockRecorder) RetrieveIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPort)(nil).Recv), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIncoming", reflect.TypeOf((*MockPort)(nil).RetrieveIncoming)) } -// Retrieve mocks base method. -func (m *MockPort) Retrieve(arg0 sim.VTimeInSec) sim.Msg { +// RetrieveOutgoing mocks base method. +func (m *MockPort) RetrieveOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Retrieve", arg0) + ret := m.ctrl.Call(m, "RetrieveOutgoing") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Retrieve indicates an expected call of Retrieve. -func (mr *MockPortMockRecorder) Retrieve(arg0 interface{}) *gomock.Call { +// RetrieveOutgoing indicates an expected call of RetrieveOutgoing. +func (mr *MockPortMockRecorder) RetrieveOutgoing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPort)(nil).Retrieve), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveOutgoing", reflect.TypeOf((*MockPort)(nil).RetrieveOutgoing)) } // Send mocks base method. diff --git a/timing/cp/mock_dispatching_test.go b/timing/cp/mock_dispatching_test.go index 80315ecc..3a81a4e3 100644 --- a/timing/cp/mock_dispatching_test.go +++ b/timing/cp/mock_dispatching_test.go @@ -140,15 +140,15 @@ func (mr *MockDispatcherMockRecorder) StartDispatching(arg0 interface{}) *gomock } // Tick mocks base method. -func (m *MockDispatcher) Tick(arg0 sim.VTimeInSec) bool { +func (m *MockDispatcher) Tick() bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Tick", arg0) + ret := m.ctrl.Call(m, "Tick") ret0, _ := ret[0].(bool) return ret0 } // Tick indicates an expected call of Tick. -func (mr *MockDispatcherMockRecorder) Tick(arg0 interface{}) *gomock.Call { +func (mr *MockDispatcherMockRecorder) Tick() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockDispatcher)(nil).Tick), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockDispatcher)(nil).Tick)) } diff --git a/timing/cp/mock_sim_test.go b/timing/cp/mock_sim_test.go index 8ecec33f..8a22b2bc 100644 --- a/timing/cp/mock_sim_test.go +++ b/timing/cp/mock_sim_test.go @@ -71,18 +71,6 @@ func (mr *MockEngineMockRecorder) CurrentTime() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentTime", reflect.TypeOf((*MockEngine)(nil).CurrentTime)) } -// Finished mocks base method. -func (m *MockEngine) Finished() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Finished") -} - -// Finished indicates an expected call of Finished. -func (mr *MockEngineMockRecorder) Finished() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finished", reflect.TypeOf((*MockEngine)(nil).Finished)) -} - // Hooks mocks base method. func (m *MockEngine) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -123,18 +111,6 @@ func (mr *MockEngineMockRecorder) Pause() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pause", reflect.TypeOf((*MockEngine)(nil).Pause)) } -// RegisterSimulationEndHandler mocks base method. -func (m *MockEngine) RegisterSimulationEndHandler(arg0 sim.SimulationEndHandler) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterSimulationEndHandler", arg0) -} - -// RegisterSimulationEndHandler indicates an expected call of RegisterSimulationEndHandler. -func (mr *MockEngineMockRecorder) RegisterSimulationEndHandler(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterSimulationEndHandler", reflect.TypeOf((*MockEngine)(nil).RegisterSimulationEndHandler), arg0) -} - // Run mocks base method. func (m *MockEngine) Run() error { m.ctrl.T.Helper() @@ -224,6 +200,20 @@ func (mr *MockPortMockRecorder) Component() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Component", reflect.TypeOf((*MockPort)(nil).Component)) } +// Deliver mocks base method. +func (m *MockPort) Deliver(arg0 sim.Msg) *sim.SendError { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Deliver", arg0) + ret0, _ := ret[0].(*sim.SendError) + return ret0 +} + +// Deliver indicates an expected call of Deliver. +func (mr *MockPortMockRecorder) Deliver(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deliver", reflect.TypeOf((*MockPort)(nil).Deliver), arg0) +} + // Hooks mocks base method. func (m *MockPort) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -253,15 +243,15 @@ func (mr *MockPortMockRecorder) Name() *gomock.Call { } // NotifyAvailable mocks base method. -func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) { +func (m *MockPort) NotifyAvailable() { m.ctrl.T.Helper() - m.ctrl.Call(m, "NotifyAvailable", arg0) + m.ctrl.Call(m, "NotifyAvailable") } // NotifyAvailable indicates an expected call of NotifyAvailable. -func (mr *MockPortMockRecorder) NotifyAvailable(arg0 interface{}) *gomock.Call { +func (mr *MockPortMockRecorder) NotifyAvailable() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable)) } // NumHooks mocks base method. @@ -278,46 +268,60 @@ func (mr *MockPortMockRecorder) NumHooks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NumHooks", reflect.TypeOf((*MockPort)(nil).NumHooks)) } -// Peek mocks base method. -func (m *MockPort) Peek() sim.Msg { +// PeekIncoming mocks base method. +func (m *MockPort) PeekIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek") + ret := m.ctrl.Call(m, "PeekIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Peek indicates an expected call of Peek. -func (mr *MockPortMockRecorder) Peek() *gomock.Call { +// PeekIncoming indicates an expected call of PeekIncoming. +func (mr *MockPortMockRecorder) PeekIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPort)(nil).Peek)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekIncoming", reflect.TypeOf((*MockPort)(nil).PeekIncoming)) } -// Recv mocks base method. -func (m *MockPort) Recv(arg0 sim.Msg) *sim.SendError { +// PeekOutgoing mocks base method. +func (m *MockPort) PeekOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0) - ret0, _ := ret[0].(*sim.SendError) + ret := m.ctrl.Call(m, "PeekOutgoing") + ret0, _ := ret[0].(sim.Msg) + return ret0 +} + +// PeekOutgoing indicates an expected call of PeekOutgoing. +func (mr *MockPortMockRecorder) PeekOutgoing() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekOutgoing", reflect.TypeOf((*MockPort)(nil).PeekOutgoing)) +} + +// RetrieveIncoming mocks base method. +func (m *MockPort) RetrieveIncoming() sim.Msg { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveIncoming") + ret0, _ := ret[0].(sim.Msg) return ret0 } -// Recv indicates an expected call of Recv. -func (mr *MockPortMockRecorder) Recv(arg0 interface{}) *gomock.Call { +// RetrieveIncoming indicates an expected call of RetrieveIncoming. +func (mr *MockPortMockRecorder) RetrieveIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPort)(nil).Recv), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIncoming", reflect.TypeOf((*MockPort)(nil).RetrieveIncoming)) } -// Retrieve mocks base method. -func (m *MockPort) Retrieve(arg0 sim.VTimeInSec) sim.Msg { +// RetrieveOutgoing mocks base method. +func (m *MockPort) RetrieveOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Retrieve", arg0) + ret := m.ctrl.Call(m, "RetrieveOutgoing") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Retrieve indicates an expected call of Retrieve. -func (mr *MockPortMockRecorder) Retrieve(arg0 interface{}) *gomock.Call { +// RetrieveOutgoing indicates an expected call of RetrieveOutgoing. +func (mr *MockPortMockRecorder) RetrieveOutgoing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPort)(nil).Retrieve), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveOutgoing", reflect.TypeOf((*MockPort)(nil).RetrieveOutgoing)) } // Send mocks base method. @@ -408,15 +412,15 @@ func (mr *MockBufferedSenderMockRecorder) Send(arg0 interface{}) *gomock.Call { } // Tick mocks base method. -func (m *MockBufferedSender) Tick(arg0 sim.VTimeInSec) bool { +func (m *MockBufferedSender) Tick() bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Tick", arg0) + ret := m.ctrl.Call(m, "Tick") ret0, _ := ret[0].(bool) return ret0 } // Tick indicates an expected call of Tick. -func (mr *MockBufferedSenderMockRecorder) Tick(arg0 interface{}) *gomock.Call { +func (mr *MockBufferedSenderMockRecorder) Tick() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockBufferedSender)(nil).Tick), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockBufferedSender)(nil).Tick)) } diff --git a/timing/cu/branchunit_test.go b/timing/cu/branchunit_test.go index 723ceaea..d4b6b466 100644 --- a/timing/cu/branchunit_test.go +++ b/timing/cu/branchunit_test.go @@ -36,7 +36,7 @@ var _ = Describe("Branch Unit", func() { It("should accept wave", func() { wave := new(wavefront.Wavefront) - bu.AcceptWave(wave, 10) + bu.AcceptWave(wave) Expect(bu.toRead).To(BeIdenticalTo(wave)) }) @@ -58,7 +58,7 @@ var _ = Describe("Branch Unit", func() { bu.toExec = wave2 bu.toWrite = wave3 - bu.Run(10) + bu.Run() Expect(wave3.State).To(Equal(wavefront.WfReady)) Expect(wave3.PC).To(Equal(uint64(0x140))) diff --git a/timing/cu/computeunit_test.go b/timing/cu/computeunit_test.go index cc7afaeb..9f5bd60a 100644 --- a/timing/cu/computeunit_test.go +++ b/timing/cu/computeunit_test.go @@ -174,28 +174,25 @@ var _ = Describe("ComputeUnit", func() { } builder := protocol.MapWGReqBuilder{}. - WithSendTime(6). WithSrc(nil). WithDst(cu.ToACE). WithWG(wg). AddWf(location1). AddWf(location2) req = builder.Build() - req.RecvTime = 10 - toACE.EXPECT().Retrieve(gomock.Any()).Return(req) + toACE.EXPECT().RetrieveIncoming().Return(req) }) It("should dispatch wavefront", func() { wfDispatcher.EXPECT(). - DispatchWf(sim.VTimeInSec(11), - gomock.Any(), req.Wavefronts[0]) + DispatchWf(gomock.Any(), req.Wavefronts[0]) wfDispatcher.EXPECT(). - DispatchWf(sim.VTimeInSec(11), - gomock.Any(), req.Wavefronts[1]) + DispatchWf(gomock.Any(), req.Wavefronts[1]) engine.EXPECT().Schedule(gomock.Any()) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) - cu.processInputFromACE(11) + cu.processInputFromACE() Expect(cu.WfPools[1].wfs).To(HaveLen(1)) Expect(cu.WfPools[2].wfs).To(HaveLen(1)) @@ -214,7 +211,6 @@ var _ = Describe("ComputeUnit", func() { wf.PC = 0x1000 req := mem.ReadReqBuilder{}. - WithSendTime(8). WithSrc(cu.ToInstMem). WithDst(instMem). WithAddress(0x100). @@ -222,7 +218,6 @@ var _ = Describe("ComputeUnit", func() { Build() dataReady = mem.DataReadyRspBuilder{}. - WithSendTime(10). WithSrc(instMem). WithDst(cu.ToInstMem). WithRspTo(req.ID). @@ -238,8 +233,7 @@ var _ = Describe("ComputeUnit", func() { }). Build() - dataReady.RecvTime = 10 - toInstMem.EXPECT().Retrieve(gomock.Any()).Return(dataReady) + toInstMem.EXPECT().RetrieveIncoming().Return(dataReady) info := new(InstFetchReqInfo) info.Wavefront = wf @@ -248,7 +242,9 @@ var _ = Describe("ComputeUnit", func() { }) It("should handle fetch return", func() { - madeProgress := cu.processInputFromInstMem(10) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(10)) + + madeProgress := cu.processInputFromInstMem() //Expect(wf.State).To(Equal(WfFetched)) Expect(wf.LastFetchTime).To(BeNumerically("~", 10)) @@ -273,7 +269,6 @@ var _ = Describe("ComputeUnit", func() { It("should handle scalar data load return", func() { read := mem.ReadReqBuilder{}. - WithSendTime(8). WithSrc(cu.ToScalarMem). WithAddress(0x100). WithByteSize(64). @@ -287,14 +282,12 @@ var _ = Describe("ComputeUnit", func() { cu.InFlightScalarMemAccess = append(cu.InFlightScalarMemAccess, info) rsp := mem.DataReadyRspBuilder{}. - WithSendTime(10). WithRspTo(read.ID). WithData(insts.Uint32ToBytes(32)). Build() - rsp.RecvTime = 10 - toScalarMem.EXPECT().Retrieve(gomock.Any()).Return(rsp) + toScalarMem.EXPECT().RetrieveIncoming().Return(rsp) - cu.processInputFromScalarMem(10) + cu.processInputFromScalarMem() access := RegisterAccess{ Reg: insts.SReg(0), @@ -330,7 +323,6 @@ var _ = Describe("ComputeUnit", func() { wf.OutstandingScalarMemAccess = 1 read = mem.ReadReqBuilder{}. - WithSendTime(8). WithAddress(0x100). WithByteSize(16). CanWaitForCoalesce(). @@ -350,18 +342,17 @@ var _ = Describe("ComputeUnit", func() { cu.InFlightVectorMemAccess, info) dataReady := mem.DataReadyRspBuilder{}. - WithSendTime(10). WithRspTo(read.ID). WithData(make([]byte, 16)). Build() for i := 0; i < 4; i++ { copy(dataReady.Data[i*4:i*4+4], insts.Uint32ToBytes(uint32(i))) } - toVectorMem.EXPECT().Retrieve(gomock.Any()).Return(dataReady) + toVectorMem.EXPECT().RetrieveIncoming().Return(dataReady) }) It("should handle vector data load return, and the return is not the last one for an instruction", func() { - cu.processInputFromVectorMem(10) + cu.processInputFromVectorMem() for i := 0; i < 4; i++ { access := RegisterAccess{} @@ -382,7 +373,7 @@ var _ = Describe("ComputeUnit", func() { It("should handle vector data load return, and the return is the last one for an instruction", func() { read.CanWaitForCoalesce = false - cu.processInputFromVectorMem(10) + cu.processInputFromVectorMem() Expect(wf.OutstandingVectorMemAccess).To(Equal(0)) Expect(wf.OutstandingScalarMemAccess).To(Equal(0)) @@ -421,7 +412,6 @@ var _ = Describe("ComputeUnit", func() { wf.OutstandingScalarMemAccess = 1 writeReq = mem.WriteReqBuilder{}. - WithSendTime(8). WithAddress(0x100). CanWaitForCoalesce(). Build() @@ -433,14 +423,13 @@ var _ = Describe("ComputeUnit", func() { cu.InFlightVectorMemAccess = append(cu.InFlightVectorMemAccess, info) doneRsp = mem.WriteDoneRspBuilder{}. - WithSendTime(10). WithRspTo(writeReq.ID). Build() - toVectorMem.EXPECT().Retrieve(gomock.Any()).Return(doneRsp) + toVectorMem.EXPECT().RetrieveIncoming().Return(doneRsp) }) It("should handle vector data store return and the return is not the last one from an instruction", func() { - madeProgress := cu.processInputFromVectorMem(10) + madeProgress := cu.processInputFromVectorMem() Expect(cu.InFlightVectorMemAccess).To(HaveLen(0)) Expect(madeProgress).To(BeTrue()) @@ -449,7 +438,7 @@ var _ = Describe("ComputeUnit", func() { It("should handle vector data store return and the return is the last one from an instruction", func() { writeReq.CanWaitForCoalesce = false - cu.processInputFromVectorMem(10) + cu.processInputFromVectorMem() Expect(wf.OutstandingVectorMemAccess).To(Equal(0)) Expect(wf.OutstandingScalarMemAccess).To(Equal(0)) @@ -462,12 +451,11 @@ var _ = Describe("ComputeUnit", func() { req := protocol.CUPipelineFlushReqBuilder{}. WithSrc(nil). WithDst(cu.ToCP). - WithSendTime(10). Build() - toCP.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(req) + toCP.EXPECT().RetrieveIncoming().Return(req) - cu.processInputFromCP(11) + cu.processInputFromCP() Expect(cu.inCPRequestProcessingStage).To(BeIdenticalTo(req)) Expect(cu.isFlushing).To(BeTrue()) @@ -495,15 +483,14 @@ var _ = Describe("ComputeUnit", func() { cu.isPaused = true req := protocol.CUPipelineRestartReqBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(cu.ToCP). Build() - toCP.EXPECT().Retrieve(gomock.Any()).Return(req) + toCP.EXPECT().RetrieveIncoming().Return(req) toCP.EXPECT().Send(gomock.Any()) - cu.processInputFromCP(11) + cu.processInputFromCP() Expect(cu.isPaused).To(BeTrue()) Expect(cu.isSendingOutShadowBufferReqs).To(BeTrue()) }) @@ -512,7 +499,6 @@ var _ = Describe("ComputeUnit", func() { req := protocol.CUPipelineFlushReqBuilder{}. WithSrc(nil). WithDst(cu.ToCP). - WithSendTime(10). Build() cu.currentFlushReq = req @@ -536,7 +522,7 @@ var _ = Describe("ComputeUnit", func() { vectorMemDecoder.EXPECT().Flush() vectorMemUnit.EXPECT().Flush() - cu.flushPipeline(10) + cu.flushPipeline() Expect(cu.InFlightInstFetch).To(BeNil()) Expect(cu.InFlightVectorMemAccess).To(BeNil()) @@ -554,7 +540,6 @@ var _ = Describe("ComputeUnit", func() { It("should not restart a CU where there are shadow buffer reqs pending", func() { info := new(InstFetchReqInfo) req := mem.ReadReqBuilder{}. - WithSendTime(8). WithSrc(cu.ToInstMem). WithDst(instMem). WithAddress(0x100). @@ -576,7 +561,7 @@ var _ = Describe("ComputeUnit", func() { toVectorMem.EXPECT().Send(gomock.Any()) toScalarMem.EXPECT().Send(gomock.Any()) - cu.checkShadowBuffers(11) + cu.checkShadowBuffers() }) It("should restart a CU where there are no shadow buffer reqs pending", func() { @@ -584,7 +569,7 @@ var _ = Describe("ComputeUnit", func() { cu.shadowInFlightScalarMemAccess = nil cu.shadowInFlightVectorMemAccess = nil - cu.checkShadowBuffers(11) + cu.checkShadowBuffers() Expect(cu.isPaused).To(BeFalse()) }) diff --git a/timing/cu/decodeunit_test.go b/timing/cu/decodeunit_test.go index 90d3c563..fcd60185 100644 --- a/timing/cu/decodeunit_test.go +++ b/timing/cu/decodeunit_test.go @@ -37,7 +37,7 @@ var _ = Describe("DecodeUnit", func() { It("should accept wave", func() { wave := new(wavefront.Wavefront) du.toDecode = nil - du.AcceptWave(wave, 10) + du.AcceptWave(wave) Expect(du.toDecode).To(BeIdenticalTo(wave)) }) @@ -46,7 +46,7 @@ var _ = Describe("DecodeUnit", func() { wave2 := new(wavefront.Wavefront) du.toDecode = wave - Expect(func() { du.AcceptWave(wave2, 10) }).Should(Panic()) + Expect(func() { du.AcceptWave(wave2) }).Should(Panic()) Expect(du.toDecode).To(BeIdenticalTo(wave)) }) @@ -55,7 +55,7 @@ var _ = Describe("DecodeUnit", func() { wave.SIMDID = 1 du.toDecode = wave - du.Run(10) + du.Run() Expect(len(execUnits[0].acceptedWave)).To(Equal(0)) Expect(len(execUnits[1].acceptedWave)).To(Equal(1)) @@ -70,7 +70,7 @@ var _ = Describe("DecodeUnit", func() { du.toDecode = wave execUnits[1].canAccept = false - du.Run(10) + du.Run() Expect(len(execUnits[0].acceptedWave)).To(Equal(0)) Expect(len(execUnits[1].acceptedWave)).To(Equal(0)) diff --git a/timing/cu/ldsunit_test.go b/timing/cu/ldsunit_test.go index 5a80261f..7a7aec53 100644 --- a/timing/cu/ldsunit_test.go +++ b/timing/cu/ldsunit_test.go @@ -36,7 +36,7 @@ var _ = Describe("LDS Unit", func() { It("should accept wave", func() { wave := new(wavefront.Wavefront) - bu.AcceptWave(wave, 10) + bu.AcceptWave(wave) Expect(bu.toRead).To(BeIdenticalTo(wave)) }) @@ -64,7 +64,7 @@ var _ = Describe("LDS Unit", func() { bu.toExec = wave2 bu.toWrite = wave3 - bu.Run(10) + bu.Run() Expect(wave3.State).To(Equal(wavefront.WfReady)) Expect(wave3.PC).To(Equal(uint64(0x140))) diff --git a/timing/cu/mock_pipelining_test.go b/timing/cu/mock_pipelining_test.go index 331b90d0..60ebd122 100644 --- a/timing/cu/mock_pipelining_test.go +++ b/timing/cu/mock_pipelining_test.go @@ -35,15 +35,15 @@ func (m *MockPipeline) EXPECT() *MockPipelineMockRecorder { } // Accept mocks base method. -func (m *MockPipeline) Accept(arg0 sim.VTimeInSec, arg1 pipelining.PipelineItem) { +func (m *MockPipeline) Accept(arg0 pipelining.PipelineItem) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Accept", arg0, arg1) + m.ctrl.Call(m, "Accept", arg0) } // Accept indicates an expected call of Accept. -func (mr *MockPipelineMockRecorder) Accept(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockPipelineMockRecorder) Accept(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Accept", reflect.TypeOf((*MockPipeline)(nil).Accept), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Accept", reflect.TypeOf((*MockPipeline)(nil).Accept), arg0) } // AcceptHook mocks base method. @@ -139,15 +139,15 @@ func (mr *MockPipelineMockRecorder) NumHooks() *gomock.Call { } // Tick mocks base method. -func (m *MockPipeline) Tick(arg0 sim.VTimeInSec) bool { +func (m *MockPipeline) Tick() bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Tick", arg0) + ret := m.ctrl.Call(m, "Tick") ret0, _ := ret[0].(bool) return ret0 } // Tick indicates an expected call of Tick. -func (mr *MockPipelineMockRecorder) Tick(arg0 interface{}) *gomock.Call { +func (mr *MockPipelineMockRecorder) Tick() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockPipeline)(nil).Tick), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockPipeline)(nil).Tick)) } diff --git a/timing/cu/mock_sim_test.go b/timing/cu/mock_sim_test.go index 5096b4ff..a0e6b595 100644 --- a/timing/cu/mock_sim_test.go +++ b/timing/cu/mock_sim_test.go @@ -73,6 +73,20 @@ func (mr *MockPortMockRecorder) Component() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Component", reflect.TypeOf((*MockPort)(nil).Component)) } +// Deliver mocks base method. +func (m *MockPort) Deliver(arg0 sim.Msg) *sim.SendError { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Deliver", arg0) + ret0, _ := ret[0].(*sim.SendError) + return ret0 +} + +// Deliver indicates an expected call of Deliver. +func (mr *MockPortMockRecorder) Deliver(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deliver", reflect.TypeOf((*MockPort)(nil).Deliver), arg0) +} + // Hooks mocks base method. func (m *MockPort) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -102,15 +116,15 @@ func (mr *MockPortMockRecorder) Name() *gomock.Call { } // NotifyAvailable mocks base method. -func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) { +func (m *MockPort) NotifyAvailable() { m.ctrl.T.Helper() - m.ctrl.Call(m, "NotifyAvailable", arg0) + m.ctrl.Call(m, "NotifyAvailable") } // NotifyAvailable indicates an expected call of NotifyAvailable. -func (mr *MockPortMockRecorder) NotifyAvailable(arg0 interface{}) *gomock.Call { +func (mr *MockPortMockRecorder) NotifyAvailable() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable)) } // NumHooks mocks base method. @@ -127,46 +141,60 @@ func (mr *MockPortMockRecorder) NumHooks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NumHooks", reflect.TypeOf((*MockPort)(nil).NumHooks)) } -// Peek mocks base method. -func (m *MockPort) Peek() sim.Msg { +// PeekIncoming mocks base method. +func (m *MockPort) PeekIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek") + ret := m.ctrl.Call(m, "PeekIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Peek indicates an expected call of Peek. -func (mr *MockPortMockRecorder) Peek() *gomock.Call { +// PeekIncoming indicates an expected call of PeekIncoming. +func (mr *MockPortMockRecorder) PeekIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPort)(nil).Peek)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekIncoming", reflect.TypeOf((*MockPort)(nil).PeekIncoming)) } -// Recv mocks base method. -func (m *MockPort) Recv(arg0 sim.Msg) *sim.SendError { +// PeekOutgoing mocks base method. +func (m *MockPort) PeekOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0) - ret0, _ := ret[0].(*sim.SendError) + ret := m.ctrl.Call(m, "PeekOutgoing") + ret0, _ := ret[0].(sim.Msg) return ret0 } -// Recv indicates an expected call of Recv. -func (mr *MockPortMockRecorder) Recv(arg0 interface{}) *gomock.Call { +// PeekOutgoing indicates an expected call of PeekOutgoing. +func (mr *MockPortMockRecorder) PeekOutgoing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPort)(nil).Recv), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekOutgoing", reflect.TypeOf((*MockPort)(nil).PeekOutgoing)) } -// Retrieve mocks base method. -func (m *MockPort) Retrieve(arg0 sim.VTimeInSec) sim.Msg { +// RetrieveIncoming mocks base method. +func (m *MockPort) RetrieveIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Retrieve", arg0) + ret := m.ctrl.Call(m, "RetrieveIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Retrieve indicates an expected call of Retrieve. -func (mr *MockPortMockRecorder) Retrieve(arg0 interface{}) *gomock.Call { +// RetrieveIncoming indicates an expected call of RetrieveIncoming. +func (mr *MockPortMockRecorder) RetrieveIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPort)(nil).Retrieve), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIncoming", reflect.TypeOf((*MockPort)(nil).RetrieveIncoming)) +} + +// RetrieveOutgoing mocks base method. +func (m *MockPort) RetrieveOutgoing() sim.Msg { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveOutgoing") + ret0, _ := ret[0].(sim.Msg) + return ret0 +} + +// RetrieveOutgoing indicates an expected call of RetrieveOutgoing. +func (mr *MockPortMockRecorder) RetrieveOutgoing() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveOutgoing", reflect.TypeOf((*MockPort)(nil).RetrieveOutgoing)) } // Send mocks base method. @@ -256,18 +284,6 @@ func (mr *MockEngineMockRecorder) CurrentTime() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentTime", reflect.TypeOf((*MockEngine)(nil).CurrentTime)) } -// Finished mocks base method. -func (m *MockEngine) Finished() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Finished") -} - -// Finished indicates an expected call of Finished. -func (mr *MockEngineMockRecorder) Finished() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finished", reflect.TypeOf((*MockEngine)(nil).Finished)) -} - // Hooks mocks base method. func (m *MockEngine) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -308,18 +324,6 @@ func (mr *MockEngineMockRecorder) Pause() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pause", reflect.TypeOf((*MockEngine)(nil).Pause)) } -// RegisterSimulationEndHandler mocks base method. -func (m *MockEngine) RegisterSimulationEndHandler(arg0 sim.SimulationEndHandler) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterSimulationEndHandler", arg0) -} - -// RegisterSimulationEndHandler indicates an expected call of RegisterSimulationEndHandler. -func (mr *MockEngineMockRecorder) RegisterSimulationEndHandler(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterSimulationEndHandler", reflect.TypeOf((*MockEngine)(nil).RegisterSimulationEndHandler), arg0) -} - // Run mocks base method. func (m *MockEngine) Run() error { m.ctrl.T.Helper() diff --git a/timing/cu/mock_subcomponent_test.go b/timing/cu/mock_subcomponent_test.go index a654ddaf..88741e76 100644 --- a/timing/cu/mock_subcomponent_test.go +++ b/timing/cu/mock_subcomponent_test.go @@ -8,7 +8,6 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - sim "github.com/sarchlab/akita/v4/sim" wavefront "github.com/sarchlab/mgpusim/v4/timing/wavefront" ) @@ -36,15 +35,15 @@ func (m *MockSubComponent) EXPECT() *MockSubComponentMockRecorder { } // AcceptWave mocks base method. -func (m *MockSubComponent) AcceptWave(wave *wavefront.Wavefront, now sim.VTimeInSec) { +func (m *MockSubComponent) AcceptWave(wave *wavefront.Wavefront) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AcceptWave", wave, now) + m.ctrl.Call(m, "AcceptWave", wave) } // AcceptWave indicates an expected call of AcceptWave. -func (mr *MockSubComponentMockRecorder) AcceptWave(wave, now interface{}) *gomock.Call { +func (mr *MockSubComponentMockRecorder) AcceptWave(wave interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptWave", reflect.TypeOf((*MockSubComponent)(nil).AcceptWave), wave, now) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptWave", reflect.TypeOf((*MockSubComponent)(nil).AcceptWave), wave) } // CanAcceptWave mocks base method. @@ -88,15 +87,15 @@ func (mr *MockSubComponentMockRecorder) IsIdle() *gomock.Call { } // Run mocks base method. -func (m *MockSubComponent) Run(now sim.VTimeInSec) bool { +func (m *MockSubComponent) Run() bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Run", now) + ret := m.ctrl.Call(m, "Run") ret0, _ := ret[0].(bool) return ret0 } // Run indicates an expected call of Run. -func (mr *MockSubComponentMockRecorder) Run(now interface{}) *gomock.Call { +func (mr *MockSubComponentMockRecorder) Run() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockSubComponent)(nil).Run), now) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockSubComponent)(nil).Run)) } diff --git a/timing/cu/mock_wfdispatcher_test.go b/timing/cu/mock_wfdispatcher_test.go index 4fc5b648..96f14b63 100644 --- a/timing/cu/mock_wfdispatcher_test.go +++ b/timing/cu/mock_wfdispatcher_test.go @@ -8,7 +8,6 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - sim "github.com/sarchlab/akita/v4/sim" protocol "github.com/sarchlab/mgpusim/v4/protocol" wavefront "github.com/sarchlab/mgpusim/v4/timing/wavefront" ) @@ -37,13 +36,13 @@ func (m *MockWfDispatcher) EXPECT() *MockWfDispatcherMockRecorder { } // DispatchWf mocks base method. -func (m *MockWfDispatcher) DispatchWf(now sim.VTimeInSec, wf *wavefront.Wavefront, location protocol.WfDispatchLocation) { +func (m *MockWfDispatcher) DispatchWf(wf *wavefront.Wavefront, location protocol.WfDispatchLocation) { m.ctrl.T.Helper() - m.ctrl.Call(m, "DispatchWf", now, wf, location) + m.ctrl.Call(m, "DispatchWf", wf, location) } // DispatchWf indicates an expected call of DispatchWf. -func (mr *MockWfDispatcherMockRecorder) DispatchWf(now, wf, location interface{}) *gomock.Call { +func (mr *MockWfDispatcherMockRecorder) DispatchWf(wf, location interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DispatchWf", reflect.TypeOf((*MockWfDispatcher)(nil).DispatchWf), now, wf, location) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DispatchWf", reflect.TypeOf((*MockWfDispatcher)(nil).DispatchWf), wf, location) } diff --git a/timing/cu/scalarunit_test.go b/timing/cu/scalarunit_test.go index ad20da20..cca35177 100644 --- a/timing/cu/scalarunit_test.go +++ b/timing/cu/scalarunit_test.go @@ -89,7 +89,7 @@ var _ = Describe("Scalar Unit", func() { It("should accept wave", func() { wave := new(wavefront.Wavefront) - bu.AcceptWave(wave, 10) + bu.AcceptWave(wave) Expect(bu.toRead).To(BeIdenticalTo(wave)) }) @@ -107,7 +107,7 @@ var _ = Describe("Scalar Unit", func() { bu.toExec = wave2 bu.toWrite = wave3 - bu.Run(10) + bu.Run() Expect(wave3.State).To(Equal(wavefront.WfReady)) Expect(bu.toWrite).To(BeIdenticalTo(wave2)) @@ -136,7 +136,7 @@ var _ = Describe("Scalar Unit", func() { //expectedReq := mem.NewReadReq(10, cu, scalarMem, 0x1024, 4) //conn.ExpectSend(expectedReq, nil) - bu.Run(10) + bu.Run() Expect(wave.State).To(Equal(wavefront.WfReady)) Expect(wave.OutstandingScalarMemAccess).To(Equal(1)) @@ -162,7 +162,7 @@ var _ = Describe("Scalar Unit", func() { //expectedReq := mem.NewReadReq(10, cu, scalarMem, 0x1024, 8) //conn.ExpectSend(expectedReq, nil) - bu.Run(10) + bu.Run() Expect(wave.State).To(Equal(wavefront.WfReady)) Expect(wave.OutstandingScalarMemAccess).To(Equal(1)) @@ -185,7 +185,7 @@ var _ = Describe("Scalar Unit", func() { sp.Base = 0x1000 sp.Offset = 56 start := sp.Base + sp.Offset - bu.Run(10) + bu.Run() Expect(bu.numCacheline(start, uint64(16))).To(Equal(2)) Expect(wave.State).To(Equal(wavefront.WfReady)) Expect(wave.OutstandingScalarMemAccess).To(Equal(1)) @@ -200,7 +200,6 @@ var _ = Describe("Scalar Unit", func() { It("should send request out", func() { req := mem.ReadReqBuilder{}. - WithSendTime(10). WithSrc(cu.ToScalarMem). WithDst(scalarMem). WithAddress(1024). @@ -216,14 +215,13 @@ var _ = Describe("Scalar Unit", func() { Expect(req.AccessByteSize).To(Equal(uint64(4))) }) - bu.Run(11) + bu.Run() Expect(bu.readBuf).To(HaveLen(0)) }) It("should retry if send request failed", func() { req := mem.ReadReqBuilder{}. - WithSendTime(10). WithSrc(cu.ToScalarMem). WithDst(scalarMem). WithAddress(1024). @@ -239,7 +237,7 @@ var _ = Describe("Scalar Unit", func() { Expect(req.AccessByteSize).To(Equal(uint64(4))) }).Return(&sim.SendError{}) - bu.Run(11) + bu.Run() Expect(bu.readBuf).To(HaveLen(1)) }) diff --git a/timing/cu/scheduler_test.go b/timing/cu/scheduler_test.go index 5ddeab3c..d819423c 100644 --- a/timing/cu/scheduler_test.go +++ b/timing/cu/scheduler_test.go @@ -41,11 +41,11 @@ func (c *mockCUComponent) CanAcceptWave() bool { return c.canAccept } -func (c *mockCUComponent) AcceptWave(wave *wavefront.Wavefront, now sim.VTimeInSec) { +func (c *mockCUComponent) AcceptWave(wave *wavefront.Wavefront) { c.acceptedWave = append(c.acceptedWave, wave) } -func (c *mockCUComponent) Run(now sim.VTimeInSec) bool { +func (c *mockCUComponent) Run() bool { return true } @@ -131,7 +131,7 @@ var _ = Describe("Scheduler", func() { Expect(req.AccessByteSize).To(Equal(uint64(64))) }) - scheduler.DoFetch(10) + scheduler.DoFetch() Expect(cu.InFlightInstFetch).To(HaveLen(1)) Expect(wf.IsFetching).To(BeTrue()) @@ -152,7 +152,7 @@ var _ = Describe("Scheduler", func() { Expect(req.AccessByteSize).To(Equal(uint64(64))) }).Return(&sim.SendError{}) - scheduler.DoFetch(10) + scheduler.DoFetch() //Expect(cu.inFlightMemAccess).To(HaveLen(0)) Expect(wf.IsFetching).To(BeFalse()) @@ -188,7 +188,7 @@ var _ = Describe("Scheduler", func() { wfs[0].PC = 0x13C issueArbitor.wfsToReturn = append(issueArbitor.wfsToReturn, wfs) - scheduler.DoIssue(10) + scheduler.DoIssue() Expect(len(branchUnit.acceptedWave)).To(Equal(1)) Expect(len(ldsDecoder.acceptedWave)).To(Equal(1)) @@ -224,7 +224,7 @@ var _ = Describe("Scheduler", func() { issueArbitor.wfsToReturn = append(issueArbitor.wfsToReturn, wfs) scheduler.internalExecuting = nil - scheduler.DoIssue(10) + scheduler.DoIssue() Expect(scheduler.internalExecuting).To(ContainElement(wf)) Expect(wf.State).To(Equal(wavefront.WfRunning)) @@ -242,7 +242,7 @@ var _ = Describe("Scheduler", func() { wf.OutstandingScalarMemAccess = 1 scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).To(ContainElement(wf)) Expect(wf.State).To(Equal(wavefront.WfRunning)) @@ -258,7 +258,7 @@ var _ = Describe("Scheduler", func() { wf.OutstandingVectorMemAccess = 1 scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).To(ContainElement(wf)) Expect(wf.State).To(Equal(wavefront.WfRunning)) @@ -276,7 +276,7 @@ var _ = Describe("Scheduler", func() { wf.OutstandingVectorMemAccess = 0 scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).NotTo(ContainElement(wf)) Expect(wf.State).To(Equal(wavefront.WfReady)) @@ -293,7 +293,7 @@ var _ = Describe("Scheduler", func() { wf.OutstandingVectorMemAccess = 1 scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).NotTo(BeNil()) }) @@ -328,7 +328,7 @@ var _ = Describe("Scheduler", func() { wg.Wfs = append(wg.Wfs, wf) scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).To(HaveLen(0)) for i := 0; i < 3; i++ { @@ -368,7 +368,7 @@ var _ = Describe("Scheduler", func() { wg.Wfs = append(wg.Wfs, wf) scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).To(HaveLen(0)) for i := 0; i < 3; i++ { @@ -407,7 +407,7 @@ var _ = Describe("Scheduler", func() { wg.Wfs = append(wg.Wfs, wf) scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).To(ContainElement(wf)) for i := 0; i < 3; i++ { @@ -445,7 +445,7 @@ var _ = Describe("Scheduler", func() { cu.WfPools[0].wfs = append(cu.WfPools[0].wfs, wf) scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).NotTo(ContainElement(wf)) Expect(cu.WfPools[0].wfs).To(HaveLen(0)) @@ -468,7 +468,7 @@ var _ = Describe("Scheduler", func() { wf := wg.Wfs[0] scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(wf.State).To(Equal(wavefront.WfAtBarrier)) Expect(len(scheduler.barrierBuffer)).To(Equal(1)) @@ -497,7 +497,7 @@ var _ = Describe("Scheduler", func() { wg.Wfs = append(wg.Wfs, wf) scheduler.internalExecuting = []*wavefront.Wavefront{wf} - scheduler.EvaluateInternalInst(10) + scheduler.EvaluateInternalInst() Expect(scheduler.internalExecuting).NotTo(ContainElement(wf)) Expect(len(scheduler.barrierBuffer)).To(Equal(0)) diff --git a/timing/cu/simdunit_test.go b/timing/cu/simdunit_test.go index e40f9cf6..bcb27e57 100644 --- a/timing/cu/simdunit_test.go +++ b/timing/cu/simdunit_test.go @@ -41,7 +41,7 @@ var _ = Describe("SIMD Unit", func() { wave := new(wavefront.Wavefront) inst := wavefront.NewInst(insts.NewInst()) wave.SetDynamicInst(inst) - bu.AcceptWave(wave, 10) + bu.AcceptWave(wave) Expect(bu.toExec).To(BeIdenticalTo(wave)) Expect(bu.cycleLeft).To(Equal(4)) }) @@ -64,7 +64,7 @@ var _ = Describe("SIMD Unit", func() { bu.toExec = wave bu.cycleLeft = 1 - bu.Run(10) + bu.Run() Expect(wave.State).To(Equal(wavefront.WfReady)) Expect(wave.PC).To(Equal(uint64(0x140))) diff --git a/timing/cu/vectormemoryunit_test.go b/timing/cu/vectormemoryunit_test.go index 73340d41..87123dba 100644 --- a/timing/cu/vectormemoryunit_test.go +++ b/timing/cu/vectormemoryunit_test.go @@ -5,7 +5,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sarchlab/akita/v4/mem/mem" - "github.com/sarchlab/akita/v4/sim" "github.com/sarchlab/mgpusim/v4/insts" "github.com/sarchlab/mgpusim/v4/kernels" "github.com/sarchlab/mgpusim/v4/timing/wavefront" @@ -66,9 +65,9 @@ var _ = Describe("Vector Memory Unit", func() { It("should accept wave", func() { wave := new(wavefront.Wavefront) - instPipeline.EXPECT().Accept(sim.VTimeInSec(10), gomock.Any()) + instPipeline.EXPECT().Accept(gomock.Any()) - vecMemUnit.AcceptWave(wave, 10) + vecMemUnit.AcceptWave(wave) Expect(vecMemUnit.numInstInFlight).To(Equal(uint64(1))) }) @@ -94,7 +93,7 @@ var _ = Describe("Vector Memory Unit", func() { instBuffer.EXPECT().Peek().Return(vectorMemInst{wavefront: wave}) instBuffer.EXPECT().Pop().Return(vectorMemInst{wavefront: wave}) - madeProgress := vecMemUnit.instToTransaction(10) + madeProgress := vecMemUnit.instToTransaction() Expect(madeProgress).To(BeTrue()) Expect(wave.State).To(Equal(wavefront.WfReady)) @@ -126,7 +125,7 @@ var _ = Describe("Vector Memory Unit", func() { instBuffer.EXPECT().Peek().Return(vectorMemInst{wavefront: wave}) instBuffer.EXPECT().Pop().Return(vectorMemInst{wavefront: wave}) - madeProgress := vecMemUnit.instToTransaction(10) + madeProgress := vecMemUnit.instToTransaction() Expect(madeProgress).To(BeTrue()) Expect(wave.State).To(Equal(wavefront.WfReady)) @@ -149,9 +148,9 @@ var _ = Describe("Vector Memory Unit", func() { vecMemUnit.transactionsWaiting = transactions transactionPipeline.EXPECT().CanAccept().Return(true) - transactionPipeline.EXPECT().Accept(sim.VTimeInSec(10), gomock.Any()) + transactionPipeline.EXPECT().Accept(gomock.Any()) - madeProgress := vecMemUnit.instToTransaction(10) + madeProgress := vecMemUnit.instToTransaction() Expect(madeProgress).To(BeTrue()) Expect(vecMemUnit.transactionsWaiting).To(HaveLen(3)) @@ -160,13 +159,11 @@ var _ = Describe("Vector Memory Unit", func() { It("should send memory access requests", func() { inst := wavefront.NewInst(nil) loadReq := mem.ReadReqBuilder{}. - WithSendTime(8). WithSrc(cu.ToVectorMem). WithDst(vectorMem). WithAddress(0). WithByteSize(4). Build() - loadReq.RecvTime = 10 trans := VectorMemAccessInfo{ Read: loadReq, Inst: inst, @@ -177,9 +174,8 @@ var _ = Describe("Vector Memory Unit", func() { transactionBuffer.EXPECT().Pop() toVectorMem.EXPECT().Send(loadReq) - vecMemUnit.sendRequest(10) + vecMemUnit.sendRequest() - Expect(loadReq.SendTime).To(Equal(sim.VTimeInSec(10))) Expect(vecMemUnit.numTransactionInFlight).To(Equal(uint64(0))) }) diff --git a/timing/cu/wfdispatcher_test.go b/timing/cu/wfdispatcher_test.go index df3718e5..71bda0d6 100644 --- a/timing/cu/wfdispatcher_test.go +++ b/timing/cu/wfdispatcher_test.go @@ -56,7 +56,7 @@ var _ = Describe("WfDispatcher", func() { wf.CodeObject = co wf.Packet = packet //req := mgpusim.NewDispatchWfReq(nil, cu.ToACE, 10, nil) - wfDispatcher.DispatchWf(10, wf, wfDispatchInfo) + wfDispatcher.DispatchWf(wf, wfDispatchInfo) //Expect(len(engine.ScheduledEvent)).To(Equal(1)) Expect(wf.SIMDID).To(Equal(1)) diff --git a/timing/pagemigrationcontroller/mock_sim_test.go b/timing/pagemigrationcontroller/mock_sim_test.go index 16971cad..2d1105eb 100644 --- a/timing/pagemigrationcontroller/mock_sim_test.go +++ b/timing/pagemigrationcontroller/mock_sim_test.go @@ -73,6 +73,20 @@ func (mr *MockPortMockRecorder) Component() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Component", reflect.TypeOf((*MockPort)(nil).Component)) } +// Deliver mocks base method. +func (m *MockPort) Deliver(arg0 sim.Msg) *sim.SendError { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Deliver", arg0) + ret0, _ := ret[0].(*sim.SendError) + return ret0 +} + +// Deliver indicates an expected call of Deliver. +func (mr *MockPortMockRecorder) Deliver(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deliver", reflect.TypeOf((*MockPort)(nil).Deliver), arg0) +} + // Hooks mocks base method. func (m *MockPort) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -102,15 +116,15 @@ func (mr *MockPortMockRecorder) Name() *gomock.Call { } // NotifyAvailable mocks base method. -func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) { +func (m *MockPort) NotifyAvailable() { m.ctrl.T.Helper() - m.ctrl.Call(m, "NotifyAvailable", arg0) + m.ctrl.Call(m, "NotifyAvailable") } // NotifyAvailable indicates an expected call of NotifyAvailable. -func (mr *MockPortMockRecorder) NotifyAvailable(arg0 interface{}) *gomock.Call { +func (mr *MockPortMockRecorder) NotifyAvailable() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable)) } // NumHooks mocks base method. @@ -127,46 +141,60 @@ func (mr *MockPortMockRecorder) NumHooks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NumHooks", reflect.TypeOf((*MockPort)(nil).NumHooks)) } -// Peek mocks base method. -func (m *MockPort) Peek() sim.Msg { +// PeekIncoming mocks base method. +func (m *MockPort) PeekIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek") + ret := m.ctrl.Call(m, "PeekIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Peek indicates an expected call of Peek. -func (mr *MockPortMockRecorder) Peek() *gomock.Call { +// PeekIncoming indicates an expected call of PeekIncoming. +func (mr *MockPortMockRecorder) PeekIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPort)(nil).Peek)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekIncoming", reflect.TypeOf((*MockPort)(nil).PeekIncoming)) } -// Recv mocks base method. -func (m *MockPort) Recv(arg0 sim.Msg) *sim.SendError { +// PeekOutgoing mocks base method. +func (m *MockPort) PeekOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0) - ret0, _ := ret[0].(*sim.SendError) + ret := m.ctrl.Call(m, "PeekOutgoing") + ret0, _ := ret[0].(sim.Msg) + return ret0 +} + +// PeekOutgoing indicates an expected call of PeekOutgoing. +func (mr *MockPortMockRecorder) PeekOutgoing() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekOutgoing", reflect.TypeOf((*MockPort)(nil).PeekOutgoing)) +} + +// RetrieveIncoming mocks base method. +func (m *MockPort) RetrieveIncoming() sim.Msg { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveIncoming") + ret0, _ := ret[0].(sim.Msg) return ret0 } -// Recv indicates an expected call of Recv. -func (mr *MockPortMockRecorder) Recv(arg0 interface{}) *gomock.Call { +// RetrieveIncoming indicates an expected call of RetrieveIncoming. +func (mr *MockPortMockRecorder) RetrieveIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPort)(nil).Recv), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIncoming", reflect.TypeOf((*MockPort)(nil).RetrieveIncoming)) } -// Retrieve mocks base method. -func (m *MockPort) Retrieve(arg0 sim.VTimeInSec) sim.Msg { +// RetrieveOutgoing mocks base method. +func (m *MockPort) RetrieveOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Retrieve", arg0) + ret := m.ctrl.Call(m, "RetrieveOutgoing") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Retrieve indicates an expected call of Retrieve. -func (mr *MockPortMockRecorder) Retrieve(arg0 interface{}) *gomock.Call { +// RetrieveOutgoing indicates an expected call of RetrieveOutgoing. +func (mr *MockPortMockRecorder) RetrieveOutgoing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPort)(nil).Retrieve), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveOutgoing", reflect.TypeOf((*MockPort)(nil).RetrieveOutgoing)) } // Send mocks base method. @@ -256,18 +284,6 @@ func (mr *MockEngineMockRecorder) CurrentTime() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentTime", reflect.TypeOf((*MockEngine)(nil).CurrentTime)) } -// Finished mocks base method. -func (m *MockEngine) Finished() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Finished") -} - -// Finished indicates an expected call of Finished. -func (mr *MockEngineMockRecorder) Finished() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finished", reflect.TypeOf((*MockEngine)(nil).Finished)) -} - // Hooks mocks base method. func (m *MockEngine) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -308,18 +324,6 @@ func (mr *MockEngineMockRecorder) Pause() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pause", reflect.TypeOf((*MockEngine)(nil).Pause)) } -// RegisterSimulationEndHandler mocks base method. -func (m *MockEngine) RegisterSimulationEndHandler(arg0 sim.SimulationEndHandler) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterSimulationEndHandler", arg0) -} - -// RegisterSimulationEndHandler indicates an expected call of RegisterSimulationEndHandler. -func (mr *MockEngineMockRecorder) RegisterSimulationEndHandler(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterSimulationEndHandler", reflect.TypeOf((*MockEngine)(nil).RegisterSimulationEndHandler), arg0) -} - // Run mocks base method. func (m *MockEngine) Run() error { m.ctrl.T.Helper() diff --git a/timing/pagemigrationcontroller/pmc_test.go b/timing/pagemigrationcontroller/pmc_test.go index 1a8782e5..3ac23cdc 100644 --- a/timing/pagemigrationcontroller/pmc_test.go +++ b/timing/pagemigrationcontroller/pmc_test.go @@ -67,15 +67,15 @@ var _ = Describe("PMC", func() { Context("should handle page migration req", func() { It("should receive a page migraiton req from Control port", func() { req := PageMigrationReqToPMCBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.ctrlPort). WithPageSize(4 * mem.KB). Build() - ctrlPort.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(req) + ctrlPort.EXPECT().RetrieveIncoming().Return(req) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(10)) - madeProgress := pmc.processFromCtrlPort(11) + madeProgress := pmc.processFromCtrlPort() Expect(pmc.currentMigrationRequest).To(BeEquivalentTo(req)) Expect(madeProgress).To(BeTrue()) @@ -83,7 +83,6 @@ var _ = Describe("PMC", func() { It("should process the page migration req from Control Port", func() { req := PageMigrationReqToPMCBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.ctrlPort). WithPageSize(4 * mem.KB). @@ -91,7 +90,7 @@ var _ = Describe("PMC", func() { pmc.currentMigrationRequest = req - madeProgress := pmc.processPageMigrationReqFromCtrlPort(11) + madeProgress := pmc.processPageMigrationReqFromCtrlPort() Expect(pmc.toPullFromAnotherPMC).ToNot(BeNil()) Expect(madeProgress).To(BeTrue()) @@ -99,7 +98,6 @@ var _ = Describe("PMC", func() { It("should send a migration req to another PMC", func() { req := DataPullReqBuilder{}. - WithSendTime(10). WithSrc(pmc.remotePort). WithDst(nil). WithReadFromPhyAddress(0x100). @@ -110,31 +108,29 @@ var _ = Describe("PMC", func() { RemotePort.EXPECT().Send(req).Return(nil) - madeProgress := pmc.sendMigrationReqToAnotherPMC(11) + madeProgress := pmc.sendMigrationReqToAnotherPMC() Expect(madeProgress).To(BeTrue()) }) It("should receive a data request for page migration from another PMC", func() { req := DataPullReqBuilder{}. - WithSendTime(10). WithSrc(pmc.remotePort). WithDst(nil). WithReadFromPhyAddress(0x100). WithDataTransferSize(256). Build() - RemotePort.EXPECT().Peek().Return(req) - RemotePort.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(req) + RemotePort.EXPECT().PeekIncoming().Return(req) + RemotePort.EXPECT().RetrieveIncoming().Return(req) - madeProgress := pmc.processFromOutside(11) + madeProgress := pmc.processFromOutside() Expect(madeProgress).To(BeTrue()) }) It("process a read page req from another PMC", func() { req := DataPullReqBuilder{}. - WithSendTime(10). WithSrc(pmc.remotePort). WithDst(nil). WithReadFromPhyAddress(0x100). @@ -142,7 +138,7 @@ var _ = Describe("PMC", func() { Build() pmc.currentPullReqFromAnotherPMC = append(pmc.currentPullReqFromAnotherPMC, req) - madeProgress := pmc.processReadPageReqFromAnotherPMC(11) + madeProgress := pmc.processReadPageReqFromAnotherPMC() Expect(pmc.toSendLocalMemPort).ToNot(BeNil()) Expect(pmc.toSendLocalMemPort[0].Address).To(BeEquivalentTo(uint64(0x100))) @@ -153,7 +149,6 @@ var _ = Describe("PMC", func() { It("send the data request from page migration to MemCtrl", func() { req := mem.ReadReqBuilder{}. - WithSendTime(10). WithSrc(pmc.localMemPort). WithDst(pmc.MemCtrlFinder.Find(0x100)). WithAddress(0x100). @@ -163,21 +158,20 @@ var _ = Describe("PMC", func() { LocalMemPort.EXPECT().Send(req).Return(nil) - madeProgress := pmc.sendReadReqLocalMemPort(11) + madeProgress := pmc.sendReadReqLocalMemPort() Expect(madeProgress).To(BeTrue()) }) It("should receive a data ready rsp from MemCtrl", func() { req := mem.DataReadyRspBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.localMemPort). Build() - LocalMemPort.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(req) + LocalMemPort.EXPECT().RetrieveIncoming().Return(req) - madeProgress := pmc.processFromMemCtrl(11) + madeProgress := pmc.processFromMemCtrl() Expect(madeProgress).To(BeTrue()) }) @@ -186,7 +180,6 @@ var _ = Describe("PMC", func() { data := make([]byte, 0) data = append(data, 0x04) req := mem.DataReadyRspBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.localMemPort). WithData(data). @@ -195,7 +188,7 @@ var _ = Describe("PMC", func() { pmc.dataReadyRspFromMemCtrl = append( pmc.dataReadyRspFromMemCtrl, req) - pmc.processDataReadyRspFromMemCtrl(11) + pmc.processDataReadyRspFromMemCtrl() Expect(pmc.toRspToAnotherPMC[0]).ToNot(BeNil()) Expect(pmc.toRspToAnotherPMC[0].Data).To(HaveLen(1)) @@ -207,7 +200,6 @@ var _ = Describe("PMC", func() { data := make([]byte, 0) data = append(data, 0x04) req := DataPullRspBuilder{}. - WithSendTime(10). WithSrc(pmc.remotePort). WithDst(nil). WithData(data). @@ -217,7 +209,7 @@ var _ = Describe("PMC", func() { RemotePort.EXPECT().Send(req).Return(nil) - madeProgress := pmc.sendDataReadyRspToRequestingPMC(11) + madeProgress := pmc.sendDataReadyRspToRequestingPMC() Expect(madeProgress).To(BeTrue()) Expect(len(pmc.toRspToAnotherPMC)).To(BeEquivalentTo(0)) @@ -226,16 +218,15 @@ var _ = Describe("PMC", func() { It("should receive a data ready rsp from the requested PMC", func() { data := []byte{1, 2, 3, 4} req := DataPullRspBuilder{}. - WithSendTime(10). WithSrc(pmc.remotePort). WithDst(nil). WithData(data). Build() - RemotePort.EXPECT().Peek().Return(req) - RemotePort.EXPECT().Retrieve(sim.VTimeInSec(11)).Return(req) + RemotePort.EXPECT().PeekIncoming().Return(req) + RemotePort.EXPECT().RetrieveIncoming().Return(req) - madeProgress := pmc.processFromOutside(11) + madeProgress := pmc.processFromOutside() Expect(madeProgress).To(BeTrue()) }) @@ -243,14 +234,12 @@ var _ = Describe("PMC", func() { It("should process a data migration rsp from requested PMC", func() { data := []byte{1, 2} migrationReq := PageMigrationReqToPMCBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.ctrlPort). WithPageSize(4 * mem.KB). Build() req := DataPullRspBuilder{}. - WithSendTime(10). WithSrc(pmc.remotePort). WithDst(nil). WithData(data). @@ -261,7 +250,7 @@ var _ = Describe("PMC", func() { pmc.currentMigrationRequest = migrationReq pmc.receivedDataFromAnothePMC = append(pmc.receivedDataFromAnothePMC, req) - madeProgress := pmc.processDataPullRsp(11) + madeProgress := pmc.processDataPullRsp() Expect(madeProgress).To(BeTrue()) Expect(pmc.writeReqLocalMemPort[0].Data).To(BeEquivalentTo(data)) @@ -270,7 +259,6 @@ var _ = Describe("PMC", func() { It("should send a write req to mem ctrl", func() { data := []byte{1, 2} req := mem.WriteReqBuilder{}. - WithSendTime(10). WithSrc(pmc.localMemPort). WithDst(pmc.MemCtrlFinder.Find(0x100)). WithAddress(0x100). @@ -281,7 +269,7 @@ var _ = Describe("PMC", func() { LocalMemPort.EXPECT().Send(req).Return(nil) - madeProgress := pmc.sendWriteReqLocalMemPort(11) + madeProgress := pmc.sendWriteReqLocalMemPort() Expect(madeProgress).To(BeTrue()) Expect(pmc.toSendLocalMemPort).To(BeNil()) @@ -289,7 +277,6 @@ var _ = Describe("PMC", func() { It("should process a write done rsp from memctrl", func() { req := mem.WriteDoneRspBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.localMemPort). WithRspTo("xx"). @@ -299,7 +286,7 @@ var _ = Describe("PMC", func() { pmc.numDataRspPendingForPageMigration = 10 - madeProgress := pmc.processWriteDoneRspFromMemCtrl(11) + madeProgress := pmc.processWriteDoneRspFromMemCtrl() Expect(madeProgress).To(BeTrue()) Expect(pmc.numDataRspPendingForPageMigration).ToNot(BeNil()) @@ -308,13 +295,11 @@ var _ = Describe("PMC", func() { It("should receive the last pending data for the page and prepare response for CP", func() { req := mem.WriteDoneRspBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.localMemPort). WithRspTo("xx"). Build() pageMigrationReq := PageMigrationReqToPMCBuilder{}. - WithSendTime(10). WithSrc(nil). WithDst(pmc.ctrlPort). WithPageSize(4 * mem.KB). @@ -323,7 +308,7 @@ var _ = Describe("PMC", func() { pmc.receivedWriteDoneFromMemCtrl = req pmc.numDataRspPendingForPageMigration = 1 - madeProgress := pmc.processWriteDoneRspFromMemCtrl(11) + madeProgress := pmc.processWriteDoneRspFromMemCtrl() Expect(madeProgress).To(BeTrue()) Expect(pmc.numDataRspPendingForPageMigration).ToNot(BeNil()) @@ -333,7 +318,6 @@ var _ = Describe("PMC", func() { It("should send migration complete rsp to CP", func() { req := PageMigrationRspFromPMCBuilder{}. - WithSendTime(10). WithSrc(pmc.ctrlPort). WithDst(nil). Build() @@ -342,8 +326,9 @@ var _ = Describe("PMC", func() { pmc.isHandlingPageMigration = true ctrlPort.EXPECT().Send(req).Return(nil) + engine.EXPECT().CurrentTime().Return(sim.VTimeInSec(11)) - madeProgress := pmc.sendMigrationCompleteRspToCtrlPort(11) + madeProgress := pmc.sendMigrationCompleteRspToCtrlPort() Expect(madeProgress).To(BeTrue()) Expect(pmc.isHandlingPageMigration).To(BeFalse()) diff --git a/timing/pagemigrationcontroller/pmcprotocol.go b/timing/pagemigrationcontroller/pmcprotocol.go index 8d19feda..d59bbea4 100644 --- a/timing/pagemigrationcontroller/pmcprotocol.go +++ b/timing/pagemigrationcontroller/pmcprotocol.go @@ -18,7 +18,7 @@ func (r *PageMigrationReqToPMC) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the PageMigrationReqToPMC with diffrent ID. +// Clone returns a clone of the PageMigrationReqToPMC with different ID. func (r *PageMigrationReqToPMC) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -96,7 +96,7 @@ func (r *PageMigrationRspFromPMC) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the PageMigrationRspFromPMC with diffrent ID. +// Clone returns a clone of the PageMigrationRspFromPMC with different ID. func (r *PageMigrationRspFromPMC) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -143,7 +143,7 @@ func (r *DataPullReq) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the DataPullReq with diffrent ID. +// Clone returns a clone of the DataPullReq with different ID. func (r *DataPullReq) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -206,7 +206,7 @@ func (r *DataPullRsp) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the DataPullRsp with diffrent ID. +// Clone returns a clone of the DataPullRsp with different ID. func (r *DataPullRsp) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() diff --git a/timing/rdma/mock_sim_test.go b/timing/rdma/mock_sim_test.go index b8c5b3ba..bdfbec52 100644 --- a/timing/rdma/mock_sim_test.go +++ b/timing/rdma/mock_sim_test.go @@ -73,6 +73,20 @@ func (mr *MockPortMockRecorder) Component() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Component", reflect.TypeOf((*MockPort)(nil).Component)) } +// Deliver mocks base method. +func (m *MockPort) Deliver(arg0 sim.Msg) *sim.SendError { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Deliver", arg0) + ret0, _ := ret[0].(*sim.SendError) + return ret0 +} + +// Deliver indicates an expected call of Deliver. +func (mr *MockPortMockRecorder) Deliver(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deliver", reflect.TypeOf((*MockPort)(nil).Deliver), arg0) +} + // Hooks mocks base method. func (m *MockPort) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -102,15 +116,15 @@ func (mr *MockPortMockRecorder) Name() *gomock.Call { } // NotifyAvailable mocks base method. -func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) { +func (m *MockPort) NotifyAvailable() { m.ctrl.T.Helper() - m.ctrl.Call(m, "NotifyAvailable", arg0) + m.ctrl.Call(m, "NotifyAvailable") } // NotifyAvailable indicates an expected call of NotifyAvailable. -func (mr *MockPortMockRecorder) NotifyAvailable(arg0 interface{}) *gomock.Call { +func (mr *MockPortMockRecorder) NotifyAvailable() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable)) } // NumHooks mocks base method. @@ -127,46 +141,60 @@ func (mr *MockPortMockRecorder) NumHooks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NumHooks", reflect.TypeOf((*MockPort)(nil).NumHooks)) } -// Peek mocks base method. -func (m *MockPort) Peek() sim.Msg { +// PeekIncoming mocks base method. +func (m *MockPort) PeekIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek") + ret := m.ctrl.Call(m, "PeekIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Peek indicates an expected call of Peek. -func (mr *MockPortMockRecorder) Peek() *gomock.Call { +// PeekIncoming indicates an expected call of PeekIncoming. +func (mr *MockPortMockRecorder) PeekIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPort)(nil).Peek)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekIncoming", reflect.TypeOf((*MockPort)(nil).PeekIncoming)) } -// Recv mocks base method. -func (m *MockPort) Recv(arg0 sim.Msg) *sim.SendError { +// PeekOutgoing mocks base method. +func (m *MockPort) PeekOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0) - ret0, _ := ret[0].(*sim.SendError) + ret := m.ctrl.Call(m, "PeekOutgoing") + ret0, _ := ret[0].(sim.Msg) + return ret0 +} + +// PeekOutgoing indicates an expected call of PeekOutgoing. +func (mr *MockPortMockRecorder) PeekOutgoing() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekOutgoing", reflect.TypeOf((*MockPort)(nil).PeekOutgoing)) +} + +// RetrieveIncoming mocks base method. +func (m *MockPort) RetrieveIncoming() sim.Msg { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveIncoming") + ret0, _ := ret[0].(sim.Msg) return ret0 } -// Recv indicates an expected call of Recv. -func (mr *MockPortMockRecorder) Recv(arg0 interface{}) *gomock.Call { +// RetrieveIncoming indicates an expected call of RetrieveIncoming. +func (mr *MockPortMockRecorder) RetrieveIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPort)(nil).Recv), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIncoming", reflect.TypeOf((*MockPort)(nil).RetrieveIncoming)) } -// Retrieve mocks base method. -func (m *MockPort) Retrieve(arg0 sim.VTimeInSec) sim.Msg { +// RetrieveOutgoing mocks base method. +func (m *MockPort) RetrieveOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Retrieve", arg0) + ret := m.ctrl.Call(m, "RetrieveOutgoing") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Retrieve indicates an expected call of Retrieve. -func (mr *MockPortMockRecorder) Retrieve(arg0 interface{}) *gomock.Call { +// RetrieveOutgoing indicates an expected call of RetrieveOutgoing. +func (mr *MockPortMockRecorder) RetrieveOutgoing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPort)(nil).Retrieve), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveOutgoing", reflect.TypeOf((*MockPort)(nil).RetrieveOutgoing)) } // Send mocks base method. @@ -256,18 +284,6 @@ func (mr *MockEngineMockRecorder) CurrentTime() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentTime", reflect.TypeOf((*MockEngine)(nil).CurrentTime)) } -// Finished mocks base method. -func (m *MockEngine) Finished() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Finished") -} - -// Finished indicates an expected call of Finished. -func (mr *MockEngineMockRecorder) Finished() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finished", reflect.TypeOf((*MockEngine)(nil).Finished)) -} - // Hooks mocks base method. func (m *MockEngine) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -308,18 +324,6 @@ func (mr *MockEngineMockRecorder) Pause() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pause", reflect.TypeOf((*MockEngine)(nil).Pause)) } -// RegisterSimulationEndHandler mocks base method. -func (m *MockEngine) RegisterSimulationEndHandler(arg0 sim.SimulationEndHandler) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterSimulationEndHandler", arg0) -} - -// RegisterSimulationEndHandler indicates an expected call of RegisterSimulationEndHandler. -func (mr *MockEngineMockRecorder) RegisterSimulationEndHandler(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterSimulationEndHandler", reflect.TypeOf((*MockEngine)(nil).RegisterSimulationEndHandler), arg0) -} - // Run mocks base method. func (m *MockEngine) Run() error { m.ctrl.T.Helper() diff --git a/timing/rdma/rdma_test.go b/timing/rdma/rdma_test.go index edcacab5..ac33303e 100644 --- a/timing/rdma/rdma_test.go +++ b/timing/rdma/rdma_test.go @@ -75,7 +75,6 @@ var _ = Describe("Engine", func() { BeforeEach(func() { read = mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(localCache). WithDst(rdmaEngine.ToOutside). WithAddress(0x100). @@ -84,25 +83,25 @@ var _ = Describe("Engine", func() { }) It("should send read to outside", func() { - toL1.EXPECT().Peek().Return(read) + toL1.EXPECT().PeekIncoming().Return(read) toOutside.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.ReadReq{})). Return(nil) - toL1.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(read) - toL1.EXPECT().Peek().Return(nil) + toL1.EXPECT().RetrieveIncoming().Return(read) + toL1.EXPECT().PeekIncoming().Return(nil) - rdmaEngine.processFromL1(10) + rdmaEngine.processFromL1() Expect(rdmaEngine.transactionsFromInside).To(HaveLen(1)) }) It("should wait if outside connection is busy", func() { - toL1.EXPECT().Peek().Return(read) + toL1.EXPECT().PeekIncoming().Return(read) toOutside.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.ReadReq{})). Return(sim.NewSendError()) - rdmaEngine.processFromL1(10) + rdmaEngine.processFromL1() Expect(rdmaEngine.transactionsFromInside).To(HaveLen(0)) }) @@ -113,7 +112,6 @@ var _ = Describe("Engine", func() { BeforeEach(func() { read = mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(localCache). WithDst(rdmaEngine.ToOutside). WithAddress(0x100). @@ -122,25 +120,25 @@ var _ = Describe("Engine", func() { }) It("should send read to outside", func() { - toOutside.EXPECT().Peek().Return(read) - toOutside.EXPECT().Peek().Return(nil) + toOutside.EXPECT().PeekIncoming().Return(read) + toOutside.EXPECT().PeekIncoming().Return(nil) toL2.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.ReadReq{})). Return(nil) - toOutside.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(read) + toOutside.EXPECT().RetrieveIncoming().Return(read) - rdmaEngine.processFromOutside(10) + rdmaEngine.processFromOutside() Expect(rdmaEngine.transactionsFromOutside).To(HaveLen(1)) }) It("should wait if outside connection is busy", func() { - toOutside.EXPECT().Peek().Return(read) + toOutside.EXPECT().PeekIncoming().Return(read) toL2.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.ReadReq{})). Return(sim.NewSendError()) - rdmaEngine.processFromOutside(10) + rdmaEngine.processFromOutside() Expect(rdmaEngine.transactionsFromInside).To(HaveLen(0)) }) @@ -155,21 +153,18 @@ var _ = Describe("Engine", func() { BeforeEach(func() { readFromInside = mem.ReadReqBuilder{}. - WithSendTime(4). WithSrc(localCache). WithDst(rdmaEngine.ToL1). WithAddress(0x100). WithByteSize(64). Build() read = mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(rdmaEngine.ToOutside). WithDst(remoteGPU). WithAddress(0x100). WithByteSize(64). Build() rsp = mem.DataReadyRspBuilder{}. - WithSendTime(9). WithSrc(remoteGPU). WithDst(rdmaEngine.ToOutside). WithRspTo(read.ID). @@ -184,25 +179,25 @@ var _ = Describe("Engine", func() { }) It("should send rsp to inside", func() { - toOutside.EXPECT().Peek().Return(rsp) - toOutside.EXPECT().Peek().Return(nil) + toOutside.EXPECT().PeekIncoming().Return(rsp) + toOutside.EXPECT().PeekIncoming().Return(nil) toL1.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.DataReadyRsp{})). Return(nil) - toOutside.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(read) + toOutside.EXPECT().RetrieveIncoming().Return(read) - rdmaEngine.processFromOutside(10) + rdmaEngine.processFromOutside() Expect(rdmaEngine.transactionsFromInside).To(HaveLen(0)) }) It("should not send rsp to inside if busy", func() { - toOutside.EXPECT().Peek().Return(rsp) + toOutside.EXPECT().PeekIncoming().Return(rsp) toL1.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.DataReadyRsp{})). Return(sim.NewSendError()) - rdmaEngine.processFromOutside(10) + rdmaEngine.processFromOutside() Expect(rdmaEngine.transactionsFromInside).To(HaveLen(1)) }) @@ -217,21 +212,18 @@ var _ = Describe("Engine", func() { BeforeEach(func() { readFromOutside = mem.ReadReqBuilder{}. - WithSendTime(4). WithSrc(localCache). WithDst(rdmaEngine.ToL2). WithAddress(0x100). WithByteSize(64). Build() read = mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(rdmaEngine.ToOutside). WithDst(remoteGPU). WithAddress(0x100). WithByteSize(64). Build() rsp = mem.DataReadyRspBuilder{}. - WithSendTime(9). WithSrc(remoteGPU). WithDst(rdmaEngine.ToOutside). WithRspTo(read.ID). @@ -245,25 +237,25 @@ var _ = Describe("Engine", func() { }) It("should send rsp to outside", func() { - toL2.EXPECT().Peek().Return(rsp) - toL2.EXPECT().Peek().Return(nil) + toL2.EXPECT().PeekIncoming().Return(rsp) + toL2.EXPECT().PeekIncoming().Return(nil) toOutside.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.DataReadyRsp{})). Return(nil) - toL2.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(read) + toL2.EXPECT().RetrieveIncoming().Return(read) - rdmaEngine.processFromL2(10) + rdmaEngine.processFromL2() Expect(rdmaEngine.transactionsFromOutside).To(HaveLen(0)) }) It("should not send rsp to outside", func() { - toL2.EXPECT().Peek().Return(rsp) + toL2.EXPECT().PeekIncoming().Return(rsp) toOutside.EXPECT(). Send(gomock.AssignableToTypeOf(&mem.DataReadyRsp{})). Return(sim.NewSendError()) - rdmaEngine.processFromL2(10) + rdmaEngine.processFromL2() Expect(rdmaEngine.transactionsFromOutside).To(HaveLen(1)) }) @@ -278,28 +270,25 @@ var _ = Describe("Engine", func() { BeforeEach(func() { read = mem.ReadReqBuilder{}. - WithSendTime(6). WithSrc(localCache). WithDst(rdmaEngine.ToOutside). WithAddress(0x100). WithByteSize(64). Build() drainReq = DrainReqBuilder{}. - WithSendTime(6). WithSrc(controllingComponent). WithDst(rdmaEngine.CtrlPort).Build() restartReq = RestartReqBuilder{}. - WithSendTime(6). WithSrc(controllingComponent). WithDst(rdmaEngine.CtrlPort).Build() }) It("should handle drain req", func() { - ctrlPort.EXPECT().Peek().Return(drainReq) - ctrlPort.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(drainReq) + ctrlPort.EXPECT().PeekIncoming().Return(drainReq) + ctrlPort.EXPECT().RetrieveIncoming().Return(drainReq) - rdmaEngine.processFromCtrlPort(10) + rdmaEngine.processFromCtrlPort() Expect(rdmaEngine.currentDrainReq).To(Equal(drainReq)) Expect(rdmaEngine.isDraining).To(BeTrue()) @@ -314,7 +303,7 @@ var _ = Describe("Engine", func() { ctrlPort.EXPECT(). Send(gomock.AssignableToTypeOf(&DrainRsp{})). Return(nil) - rdmaEngine.drainRDMA(10) + rdmaEngine.drainRDMA() Expect(rdmaEngine.isDraining).To(BeFalse()) @@ -330,7 +319,7 @@ var _ = Describe("Engine", func() { rdmaEngine.currentDrainReq = drainReq rdmaEngine.isDraining = true - rdmaEngine.drainRDMA(10) + rdmaEngine.drainRDMA() Expect(rdmaEngine.isDraining).To(BeTrue()) @@ -340,13 +329,13 @@ var _ = Describe("Engine", func() { rdmaEngine.currentDrainReq = drainReq rdmaEngine.pauseIncomingReqsFromL1 = true - ctrlPort.EXPECT().Peek().Return(restartReq) - ctrlPort.EXPECT().Retrieve(sim.VTimeInSec(10)).Return(restartReq) + ctrlPort.EXPECT().PeekIncoming().Return(restartReq) + ctrlPort.EXPECT().RetrieveIncoming().Return(restartReq) ctrlPort.EXPECT(). Send(gomock.AssignableToTypeOf(&RestartRsp{})). Return(nil) - rdmaEngine.processFromCtrlPort(10) + rdmaEngine.processFromCtrlPort() Expect(rdmaEngine.currentDrainReq).To(BeNil()) Expect(rdmaEngine.pauseIncomingReqsFromL1).To(BeFalse()) diff --git a/timing/rdma/rdmaprotocol.go b/timing/rdma/rdmaprotocol.go index 6bac8e3f..39ffe054 100644 --- a/timing/rdma/rdmaprotocol.go +++ b/timing/rdma/rdmaprotocol.go @@ -14,7 +14,7 @@ func (r *DrainReq) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the DrainReq with diffrent ID. +// Clone returns a clone of the DrainReq with different ID. func (r *DrainReq) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -58,7 +58,7 @@ func (r *RestartReq) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the RestartReq with diffrent ID. +// Clone returns a clone of the RestartReq with different ID. func (r *RestartReq) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -102,7 +102,7 @@ func (r *DrainRsp) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the DrainRsp with diffrent ID. +// Clone returns a clone of the DrainRsp with different ID. func (r *DrainRsp) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() @@ -146,7 +146,7 @@ func (r *RestartRsp) Meta() *sim.MsgMeta { return &r.MsgMeta } -// Clone returns a clone of the RestartRsp with diffrent ID. +// Clone returns a clone of the RestartRsp with different ID. func (r *RestartRsp) Clone() sim.Msg { cloneMsg := *r cloneMsg.ID = sim.GetIDGenerator().Generate() diff --git a/timing/rob/mock_sim_test.go b/timing/rob/mock_sim_test.go index 68c5dd01..3a3077f8 100644 --- a/timing/rob/mock_sim_test.go +++ b/timing/rob/mock_sim_test.go @@ -73,6 +73,20 @@ func (mr *MockPortMockRecorder) Component() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Component", reflect.TypeOf((*MockPort)(nil).Component)) } +// Deliver mocks base method. +func (m *MockPort) Deliver(arg0 sim.Msg) *sim.SendError { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Deliver", arg0) + ret0, _ := ret[0].(*sim.SendError) + return ret0 +} + +// Deliver indicates an expected call of Deliver. +func (mr *MockPortMockRecorder) Deliver(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deliver", reflect.TypeOf((*MockPort)(nil).Deliver), arg0) +} + // Hooks mocks base method. func (m *MockPort) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -102,15 +116,15 @@ func (mr *MockPortMockRecorder) Name() *gomock.Call { } // NotifyAvailable mocks base method. -func (m *MockPort) NotifyAvailable(arg0 sim.VTimeInSec) { +func (m *MockPort) NotifyAvailable() { m.ctrl.T.Helper() - m.ctrl.Call(m, "NotifyAvailable", arg0) + m.ctrl.Call(m, "NotifyAvailable") } // NotifyAvailable indicates an expected call of NotifyAvailable. -func (mr *MockPortMockRecorder) NotifyAvailable(arg0 interface{}) *gomock.Call { +func (mr *MockPortMockRecorder) NotifyAvailable() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyAvailable", reflect.TypeOf((*MockPort)(nil).NotifyAvailable)) } // NumHooks mocks base method. @@ -127,46 +141,60 @@ func (mr *MockPortMockRecorder) NumHooks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NumHooks", reflect.TypeOf((*MockPort)(nil).NumHooks)) } -// Peek mocks base method. -func (m *MockPort) Peek() sim.Msg { +// PeekIncoming mocks base method. +func (m *MockPort) PeekIncoming() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek") + ret := m.ctrl.Call(m, "PeekIncoming") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Peek indicates an expected call of Peek. -func (mr *MockPortMockRecorder) Peek() *gomock.Call { +// PeekIncoming indicates an expected call of PeekIncoming. +func (mr *MockPortMockRecorder) PeekIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPort)(nil).Peek)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekIncoming", reflect.TypeOf((*MockPort)(nil).PeekIncoming)) } -// Recv mocks base method. -func (m *MockPort) Recv(arg0 sim.Msg) *sim.SendError { +// PeekOutgoing mocks base method. +func (m *MockPort) PeekOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0) - ret0, _ := ret[0].(*sim.SendError) + ret := m.ctrl.Call(m, "PeekOutgoing") + ret0, _ := ret[0].(sim.Msg) + return ret0 +} + +// PeekOutgoing indicates an expected call of PeekOutgoing. +func (mr *MockPortMockRecorder) PeekOutgoing() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeekOutgoing", reflect.TypeOf((*MockPort)(nil).PeekOutgoing)) +} + +// RetrieveIncoming mocks base method. +func (m *MockPort) RetrieveIncoming() sim.Msg { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RetrieveIncoming") + ret0, _ := ret[0].(sim.Msg) return ret0 } -// Recv indicates an expected call of Recv. -func (mr *MockPortMockRecorder) Recv(arg0 interface{}) *gomock.Call { +// RetrieveIncoming indicates an expected call of RetrieveIncoming. +func (mr *MockPortMockRecorder) RetrieveIncoming() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPort)(nil).Recv), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveIncoming", reflect.TypeOf((*MockPort)(nil).RetrieveIncoming)) } -// Retrieve mocks base method. -func (m *MockPort) Retrieve(arg0 sim.VTimeInSec) sim.Msg { +// RetrieveOutgoing mocks base method. +func (m *MockPort) RetrieveOutgoing() sim.Msg { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Retrieve", arg0) + ret := m.ctrl.Call(m, "RetrieveOutgoing") ret0, _ := ret[0].(sim.Msg) return ret0 } -// Retrieve indicates an expected call of Retrieve. -func (mr *MockPortMockRecorder) Retrieve(arg0 interface{}) *gomock.Call { +// RetrieveOutgoing indicates an expected call of RetrieveOutgoing. +func (mr *MockPortMockRecorder) RetrieveOutgoing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPort)(nil).Retrieve), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetrieveOutgoing", reflect.TypeOf((*MockPort)(nil).RetrieveOutgoing)) } // Send mocks base method. @@ -256,18 +284,6 @@ func (mr *MockEngineMockRecorder) CurrentTime() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentTime", reflect.TypeOf((*MockEngine)(nil).CurrentTime)) } -// Finished mocks base method. -func (m *MockEngine) Finished() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Finished") -} - -// Finished indicates an expected call of Finished. -func (mr *MockEngineMockRecorder) Finished() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finished", reflect.TypeOf((*MockEngine)(nil).Finished)) -} - // Hooks mocks base method. func (m *MockEngine) Hooks() []sim.Hook { m.ctrl.T.Helper() @@ -308,18 +324,6 @@ func (mr *MockEngineMockRecorder) Pause() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pause", reflect.TypeOf((*MockEngine)(nil).Pause)) } -// RegisterSimulationEndHandler mocks base method. -func (m *MockEngine) RegisterSimulationEndHandler(arg0 sim.SimulationEndHandler) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterSimulationEndHandler", arg0) -} - -// RegisterSimulationEndHandler indicates an expected call of RegisterSimulationEndHandler. -func (mr *MockEngineMockRecorder) RegisterSimulationEndHandler(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterSimulationEndHandler", reflect.TypeOf((*MockEngine)(nil).RegisterSimulationEndHandler), arg0) -} - // Run mocks base method. func (m *MockEngine) Run() error { m.ctrl.T.Helper() diff --git a/timing/rob/rob_test.go b/timing/rob/rob_test.go index 0e2e333d..7f4c18ab 100644 --- a/timing/rob/rob_test.go +++ b/timing/rob/rob_test.go @@ -53,43 +53,42 @@ var _ = Describe("Reorder Buffer", func() { rob.addTransaction(trans) } - madeProgress := rob.topDown(10) + madeProgress := rob.topDown() Expect(madeProgress).To(BeFalse()) }) It("should do nothing if no message arriving", func() { - topPort.EXPECT().Peek().Return(nil) + topPort.EXPECT().PeekIncoming().Return(nil) - madeProgress := rob.topDown(10) + madeProgress := rob.topDown() Expect(madeProgress).To(BeFalse()) }) It("should not receive request if bottom port is busy", func() { - topPort.EXPECT().Peek().Return(read) + topPort.EXPECT().PeekIncoming().Return(read) bottomPort.EXPECT(). Send(gomock.Any()). Return(sim.NewSendError()) - madeProgress := rob.topDown(10) + madeProgress := rob.topDown() Expect(madeProgress).To(BeFalse()) }) It("should accept request from top and forward to bottom", func() { - topPort.EXPECT().Peek().Return(read) - topPort.EXPECT().Retrieve(sim.VTimeInSec(10)) + topPort.EXPECT().PeekIncoming().Return(read) + topPort.EXPECT().RetrieveIncoming() bottomPort.EXPECT(). Send(gomock.Any()). Do(func(req *mem.ReadReq) { Expect(req.Src).To(BeIdenticalTo(rob.bottomPort)) Expect(req.Dst).To(BeIdenticalTo(rob.BottomUnit)) - Expect(req.SendTime).To(Equal(sim.VTimeInSec(10))) }). Return(nil) - madeProgress := rob.topDown(10) + madeProgress := rob.topDown() Expect(madeProgress).To(BeTrue()) Expect(rob.transactions.Len()).To(Equal(1)) @@ -110,9 +109,9 @@ var _ = Describe("Reorder Buffer", func() { }) It("should do nothing if no response in the Bottom Port", func() { - bottomPort.EXPECT().Peek().Return(nil) + bottomPort.EXPECT().PeekIncoming().Return(nil) - madeProgress := rob.parseBottom(10) + madeProgress := rob.parseBottom() Expect(madeProgress).To(BeFalse()) }) @@ -122,10 +121,10 @@ var _ = Describe("Reorder Buffer", func() { WithRspTo(transaction.reqToBottom.Meta().ID). Build() - bottomPort.EXPECT().Peek().Return(rsp) - bottomPort.EXPECT().Retrieve(sim.VTimeInSec(10)) + bottomPort.EXPECT().PeekIncoming().Return(rsp) + bottomPort.EXPECT().RetrieveIncoming() - madeProgress := rob.parseBottom(10) + madeProgress := rob.parseBottom() Expect(madeProgress).To(BeTrue()) Expect(transaction.rspFromBottom).To(BeIdenticalTo(rsp)) @@ -156,7 +155,7 @@ var _ = Describe("Reorder Buffer", func() { It("should do nothing if there is no transaction", func() { rob.transactions.Remove(rob.transactions.Front()) - madeProgress := rob.bottomUp(10) + madeProgress := rob.bottomUp() Expect(madeProgress).To(BeFalse()) }) @@ -164,7 +163,7 @@ var _ = Describe("Reorder Buffer", func() { It("should do nothing if the transaction is not ready", func() { transaction.rspFromBottom = nil - madeProgress := rob.bottomUp(10) + madeProgress := rob.bottomUp() Expect(madeProgress).To(BeFalse()) }) @@ -172,7 +171,7 @@ var _ = Describe("Reorder Buffer", func() { It("should stall if TopPort is busy", func() { topPort.EXPECT().Send(gomock.Any()).Return(sim.NewSendError()) - madeProgress := rob.bottomUp(10) + madeProgress := rob.bottomUp() Expect(madeProgress).To(BeFalse()) Expect(rob.transactions.Len()).To(Equal(1)) @@ -185,12 +184,11 @@ var _ = Describe("Reorder Buffer", func() { Do(func(rsp *mem.WriteDoneRsp) { Expect(rsp.Dst).To(BeIdenticalTo(topModule)) Expect(rsp.Src).To(BeIdenticalTo(topPort)) - Expect(rsp.SendTime).To(Equal(sim.VTimeInSec(10))) Expect(rsp.RespondTo).To(Equal(writeFromTop.ID)) }). Return(nil) - madeProgress := rob.bottomUp(10) + madeProgress := rob.bottomUp() Expect(madeProgress).To(BeTrue()) Expect(rob.transactions.Len()).To(Equal(0)) @@ -204,11 +202,11 @@ var _ = Describe("Reorder Buffer", func() { ToDiscardTransactions(). Build() - ctrlPort.EXPECT().Peek().Return(flush) - ctrlPort.EXPECT().Retrieve(sim.VTimeInSec(10)) + ctrlPort.EXPECT().PeekIncoming().Return(flush) + ctrlPort.EXPECT().RetrieveIncoming() ctrlPort.EXPECT().Send(gomock.Any()).Return(nil) - madeProgress := rob.processControlMsg(10) + madeProgress := rob.processControlMsg() Expect(madeProgress).To(BeTrue()) Expect(rob.isFlushing).To(BeTrue()) @@ -219,13 +217,13 @@ var _ = Describe("Reorder Buffer", func() { ToRestart(). Build() - ctrlPort.EXPECT().Peek().Return(restart) - ctrlPort.EXPECT().Retrieve(sim.VTimeInSec(10)) + ctrlPort.EXPECT().PeekIncoming().Return(restart) + ctrlPort.EXPECT().RetrieveIncoming() ctrlPort.EXPECT().Send(gomock.Any()).Return(nil) - topPort.EXPECT().Retrieve(sim.VTimeInSec(10)).AnyTimes() - bottomPort.EXPECT().Retrieve(sim.VTimeInSec(10)).AnyTimes() + topPort.EXPECT().RetrieveIncoming().AnyTimes() + bottomPort.EXPECT().RetrieveIncoming().AnyTimes() - madeProgress := rob.processControlMsg(10) + madeProgress := rob.processControlMsg() Expect(madeProgress).To(BeTrue()) Expect(rob.isFlushing).To(BeFalse())