From 82331883a4f075960e3c0cf2b8870be2ab9ce8d4 Mon Sep 17 00:00:00 2001 From: Yuwei Sun Date: Thu, 14 Nov 2024 05:35:14 +0000 Subject: [PATCH 1/4] seperate gmmu page table --- driver/builder.go | 8 ++- driver/driver.go | 8 ++- driver/internal/memoryallocator.go | 13 +++- samples/runner/emuplatform.go | 3 +- samples/runner/platform.go | 5 ++ samples/runner/r9nanobuilder.go | 95 +++++++++++++++++++++++++++++- samples/runner/timingplatform.go | 8 ++- 7 files changed, 132 insertions(+), 8 deletions(-) diff --git a/driver/builder.go b/driver/builder.go index 3cf47ed8..b93d0cd7 100644 --- a/driver/builder.go +++ b/driver/builder.go @@ -17,6 +17,7 @@ type Builder struct { useMagicMemoryCopy bool middlewareD2HCycles int middlewareH2DCycles int + cpuMemorySize uint64 } // MakeBuilder creates a driver builder with some default configuration @@ -74,6 +75,11 @@ func (b Builder) WithH2DCycles(h2dCycles int) Builder { return b } +func (b Builder) WithCPUMemorySize(memorySize uint64) Builder { + b.cpuMemorySize = memorySize + return b +} + // Build creates a driver. func (b Builder) Build(name string) *Driver { driver := new(Driver) @@ -125,7 +131,7 @@ func (b *Builder) createCPU(d *Driver) { Type: internal.DeviceTypeCPU, MemState: internal.NewDeviceMemoryState(d.Log2PageSize), } - cpu.SetTotalMemSize(4 * mem.GB) + cpu.SetTotalMemSize(b.cpuMemorySize) d.memAllocator.RegisterDevice(cpu) d.devices = append(d.devices, cpu) diff --git a/driver/driver.go b/driver/driver.go index 28d17459..9131f317 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -142,6 +142,7 @@ type DeviceProperties struct { func (d *Driver) RegisterGPU( commandProcessorPort sim.Port, properties DeviceProperties, + gmmuPageTable vm.PageTable, ) { d.GPUs = append(d.GPUs, commandProcessorPort) @@ -156,8 +157,13 @@ func (d *Driver) RegisterGPU( } gpuDevice.SetTotalMemSize(properties.DRAMSize) d.memAllocator.RegisterDevice(gpuDevice) - d.devices = append(d.devices, gpuDevice) + + for _, page := range d.memAllocator.GetVAddrToPageMapping() { + if page.DeviceID == uint64(gpuDevice.ID) { + gmmuPageTable.Insert(page) + } + } } // Tick ticks diff --git a/driver/internal/memoryallocator.go b/driver/internal/memoryallocator.go index 1a887ea5..84a010f2 100644 --- a/driver/internal/memoryallocator.go +++ b/driver/internal/memoryallocator.go @@ -22,6 +22,7 @@ type MemoryAllocator interface { vAddr uint64, unified bool, ) vm.Page + GetVAddrToPageMapping() map[uint64]vm.Page } // NewMemoryAllocator creates a new memory allocator. @@ -63,9 +64,7 @@ func (a *memoryAllocatorImpl) RegisterDevice(device *Device) { state := device.MemState state.setInitialAddress(a.totalStorageByteSize) - a.totalStorageByteSize += state.getStorageSize() - a.devices[device.ID] = device } @@ -285,3 +284,13 @@ func (a *memoryAllocatorImpl) Free(ptr uint64) { a.removePage(ptr) } + +func (a *memoryAllocatorImpl) GetVAddrToPageMapping() map[uint64]vm.Page { + a.Lock() + defer a.Unlock() + copy := make(map[uint64]vm.Page, len(a.vAddrToPageMapping)) + for vAddr, page := range a.vAddrToPageMapping { + copy[vAddr] = page + } + return copy +} diff --git a/samples/runner/emuplatform.go b/samples/runner/emuplatform.go index be08f308..c1b9c32e 100644 --- a/samples/runner/emuplatform.go +++ b/samples/runner/emuplatform.go @@ -98,7 +98,8 @@ func (b EmuBuilder) Build() *Platform { gpuDriver.RegisterGPU(cpPort, driver.DeviceProperties{ DRAMSize: 4 * mem.GB, CUCount: 64, - }) + }, + gpuBuilder.pageTable) connection.PlugIn(cpPort, 64) b.gpus = append(b.gpus, gpu) diff --git a/samples/runner/platform.go b/samples/runner/platform.go index 3a846589..2f797b55 100644 --- a/samples/runner/platform.go +++ b/samples/runner/platform.go @@ -1,6 +1,8 @@ package runner import ( + "github.com/sarchlab/akita/v3/mem/vm/gmmu" + "github.com/sarchlab/akita/v3/mem/vm/mmu" "github.com/sarchlab/akita/v3/sim" "github.com/sarchlab/akita/v3/tracing" "github.com/sarchlab/mgpusim/v3/driver" @@ -39,4 +41,7 @@ type GPU struct { L1ITLBs []TraceableComponent L2TLBs []TraceableComponent MemControllers []TraceableComponent + MMUEngine *mmu.MMU + GMMUEngine *gmmu.GMMU + GMMUCache []TraceableComponent } diff --git a/samples/runner/r9nanobuilder.go b/samples/runner/r9nanobuilder.go index a0d3a23d..96299628 100644 --- a/samples/runner/r9nanobuilder.go +++ b/samples/runner/r9nanobuilder.go @@ -11,7 +11,9 @@ import ( "github.com/sarchlab/akita/v3/mem/cache/writethrough" "github.com/sarchlab/akita/v3/mem/dram" "github.com/sarchlab/akita/v3/mem/mem" + "github.com/sarchlab/akita/v3/mem/vm" "github.com/sarchlab/akita/v3/mem/vm/addresstranslator" + "github.com/sarchlab/akita/v3/mem/vm/gmmu" "github.com/sarchlab/akita/v3/mem/vm/mmu" "github.com/sarchlab/akita/v3/mem/vm/tlb" "github.com/sarchlab/akita/v3/monitoring" @@ -78,6 +80,10 @@ type R9NanoGPUBuilder struct { l1TLBToL2TLBConnection *sim.DirectConnection l1ToL2Connection *sim.DirectConnection l2ToDramConnection *sim.DirectConnection + + gmmuCache *tlb.TLB + gmmu *gmmu.GMMU + pageTable vm.PageTable } // MakeR9NanoGPUBuilder provides a GPU builder that can builds the R9Nano GPU. @@ -233,11 +239,15 @@ func (b R9NanoGPUBuilder) Build(name string, id uint64) *GPU { b.buildDRAMControllers() b.buildCP() b.buildL2TLB() + b.buildGMMU() + b.buildGMMUCache() b.connectCP() b.connectL2AndDRAM() b.connectL1ToL2() b.connectL1TLBToL2TLB() + b.connectL2TLBToGMMUCache() + b.connectGMMUCachetoGMMU() b.populateExternalPorts() @@ -254,6 +264,7 @@ func (b *R9NanoGPUBuilder) populateExternalPorts() { name := fmt.Sprintf("Translation_%02d", i) b.gpu.Domain.AddPort(name, l2TLB.GetPortByName("Bottom")) } + b.gpu.Domain.AddPort("GMMU", b.gmmu.GetPortByName("Bottom")) } func (b *R9NanoGPUBuilder) createGPU(name string, id uint64) { @@ -824,7 +835,7 @@ func (b *R9NanoGPUBuilder) buildL2TLB() { WithNumMSHREntry(64). WithNumReqPerCycle(1024). WithPageSize(1 << b.log2PageSize). - WithLowModule(b.mmu.GetPortByName("Top")) + WithLowModule(b.gmmuCache.GetPortByName("Top")) l2TLB := builder.Build(fmt.Sprintf("%s.L2TLB", b.gpuName)) b.l2TLBs = append(b.l2TLBs, l2TLB) @@ -854,3 +865,85 @@ func (b *R9NanoGPUBuilder) connectWithDirectConnection( conn.PlugIn(port1, bufferSize) conn.PlugIn(port2, bufferSize) } + +func (b R9NanoGPUBuilder) WithGMMUPageTable( + pageTable vm.PageTable, +) R9NanoGPUBuilder { + b.pageTable = pageTable + return b +} + +func (b *R9NanoGPUBuilder) buildGMMUCache() { + // numWays := 128 + // test:= int(b.dramSize / (1 << b.log2PageSize) / uint64(numWays)) + builder := tlb.MakeBuilder(). + WithEngine(b.engine). + WithFreq(b.freq). + WithNumWays(8). + WithNumSets(16). + WithNumMSHREntry(32). + WithNumReqPerCycle(32). + WithPageSize(1 << b.log2PageSize). + WithLowModule(b.gmmu.GetPortByName("Top")) + + gmmuCache := builder.Build(fmt.Sprintf("%s.GMMUCache", b.gpuName)) + b.gmmuCache = gmmuCache + b.gpu.GMMUCache = append(b.gpu.GMMUCache, gmmuCache) + // b.gpu.L2TLBs = append(b.gpu.L2TLBs, l2TLB) + + if b.enableVisTracing { + tracing.CollectTrace(b.gmmuCache, b.visTracer) + } + + if b.monitor != nil { + b.monitor.RegisterComponent(b.gmmuCache) + } + + if b.perfAnalyzer != nil { + b.perfAnalyzer.RegisterComponent(b.gmmuCache) + } +} + +func (b *R9NanoGPUBuilder) buildGMMU() { + gmmu := gmmu.MakeBuilder(). + WithEngine(b.engine). + WithFreq(b.freq). + WithDeviceID(b.gpuID). + WithLog2PageSize(b.log2PageSize). + WithMaxNumReqInFlight(8). + WithPageTable(b.pageTable).WithPageWalkingLatency(100). + WithLowModule(b.mmu.GetPortByName("Top")). + Build(fmt.Sprintf("%s.GMMU", b.gpuName)) + + b.gmmu = gmmu + b.gpu.GMMUEngine = b.gmmu + + if b.enableVisTracing { + tracing.CollectTrace(b.gmmu, b.visTracer) + } + + if b.monitor != nil { + b.monitor.RegisterComponent(b.gmmu) + } +} + +func (b *R9NanoGPUBuilder) connectL2TLBToGMMUCache() { + conn := sim.NewDirectConnection( + b.gpuName+".L2TLBtoGMMUCache", + b.engine, b.freq, + ) + conn.PlugIn(b.gmmuCache.GetPortByName("Top"), 64) + + for _, l2TLB := range b.l2TLBs { + conn.PlugIn(l2TLB.GetPortByName("Bottom"), 64) + } +} + +func (b *R9NanoGPUBuilder) connectGMMUCachetoGMMU() { + conn := sim.NewDirectConnection( + b.gpuName+".GMMUCacheToGMMU", + b.engine, b.freq, + ) + conn.PlugIn(b.gmmu.GetPortByName("Top"), 64) + conn.PlugIn(b.gmmuCache.GetPortByName("Bottom"), 64) +} diff --git a/samples/runner/timingplatform.go b/samples/runner/timingplatform.go index b2ea6726..0a061a08 100644 --- a/samples/runner/timingplatform.go +++ b/samples/runner/timingplatform.go @@ -164,6 +164,10 @@ func (b R9NanoPlatformBuilder) Build() *Platform { pcieConnector.EstablishRoute() + for _, gpu := range b.gpus { + gpu.MMUEngine = mmuComponent + } + return &Platform{ Engine: b.engine, Driver: gpuDriver, @@ -425,8 +429,8 @@ func (b *R9NanoPlatformBuilder) createGPU( driver.DeviceProperties{ CUCount: b.numCUPerSA * b.numSAPerGPU, DRAMSize: 4 * mem.GB, - }, - ) + }, gpuBuilder.pageTable) + gpu.CommandProcessor.Driver = gpuDriver.GetPortByName("GPU") b.configRDMAEngine(gpu, rdmaAddressTable) From 791754085e7784f67ef4561252f75eaecbfe6aea Mon Sep 17 00:00:00 2001 From: Yuwei Sun Date: Mon, 2 Dec 2024 22:33:57 +0000 Subject: [PATCH 2/4] create seperate gmmu pagetable --- driver/driver.go | 8 +------- driver/internal/device.go | 3 +++ driver/internal/memoryallocator.go | 23 ++++++++--------------- go.mod | 2 +- go.sum | 4 ++-- go.work | 3 +++ go.work.sum | 10 ++++++++++ samples/runner/platform.go | 2 +- samples/runner/timingplatform.go | 2 +- 9 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 go.work create mode 100644 go.work.sum diff --git a/driver/driver.go b/driver/driver.go index 9131f317..576ae9d9 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -142,7 +142,6 @@ type DeviceProperties struct { func (d *Driver) RegisterGPU( commandProcessorPort sim.Port, properties DeviceProperties, - gmmuPageTable vm.PageTable, ) { d.GPUs = append(d.GPUs, commandProcessorPort) @@ -154,16 +153,11 @@ func (d *Driver) RegisterGPU( CUCount: properties.CUCount, DRAMSize: properties.DRAMSize, }, + pageTable: vm.PageTable, } gpuDevice.SetTotalMemSize(properties.DRAMSize) d.memAllocator.RegisterDevice(gpuDevice) d.devices = append(d.devices, gpuDevice) - - for _, page := range d.memAllocator.GetVAddrToPageMapping() { - if page.DeviceID == uint64(gpuDevice.ID) { - gmmuPageTable.Insert(page) - } - } } // Tick ticks diff --git a/driver/internal/device.go b/driver/internal/device.go index eaf8b1cc..6175b2b1 100644 --- a/driver/internal/device.go +++ b/driver/internal/device.go @@ -1,5 +1,7 @@ package internal +import "github.com/sarchlab/akita/v3/mem/vm" + // DeviceType marks the type of a device. type DeviceType int @@ -38,6 +40,7 @@ type Device struct { nextActualGPUIndex int MemState DeviceMemoryState Properties DeviceProperties + pageTable vm.PageTable } // SetTotalMemSize sets total memory size diff --git a/driver/internal/memoryallocator.go b/driver/internal/memoryallocator.go index 84a010f2..68071009 100644 --- a/driver/internal/memoryallocator.go +++ b/driver/internal/memoryallocator.go @@ -22,7 +22,6 @@ type MemoryAllocator interface { vAddr uint64, unified bool, ) vm.Page - GetVAddrToPageMapping() map[uint64]vm.Page } // NewMemoryAllocator creates a new memory allocator. @@ -65,6 +64,7 @@ func (a *memoryAllocatorImpl) RegisterDevice(device *Device) { state := device.MemState state.setInitialAddress(a.totalStorageByteSize) a.totalStorageByteSize += state.getStorageSize() + device.pageTable = vm.NewPageTable(a.log2PageSize) a.devices[device.ID] = device } @@ -162,7 +162,7 @@ func (a *memoryAllocatorImpl) allocatePages( // fmt.Printf("page.addr is %x piage Device ID is %d \n", page.PAddr, page.DeviceID) // debug.PrintStack() - a.pageTable.Insert(page) + device.pageTable.Insert(page) a.vAddrToPageMapping[page.VAddr] = page } @@ -186,8 +186,11 @@ func (a *memoryAllocatorImpl) Remap( vAddrs = append(vAddrs, addr) addr += pageSize } - - a.allocateMultiplePagesWithGivenVAddrs(pid, deviceID, vAddrs, false) + device := a.devices[deviceID] + pages := a.allocateMultiplePagesWithGivenVAddrs(pid, deviceID, vAddrs, false) + for _, page := range pages { + device.pageTable.Insert(page) + } } func (a *memoryAllocatorImpl) RemovePage(vAddr uint64) { @@ -243,8 +246,8 @@ func (a *memoryAllocatorImpl) allocatePageWithGivenVAddr( DeviceID: uint64(deviceID), Unified: isUnified, } + device.pageTable.Insert(page) a.vAddrToPageMapping[page.VAddr] = page - a.pageTable.Update(page) return page } @@ -284,13 +287,3 @@ func (a *memoryAllocatorImpl) Free(ptr uint64) { a.removePage(ptr) } - -func (a *memoryAllocatorImpl) GetVAddrToPageMapping() map[uint64]vm.Page { - a.Lock() - defer a.Unlock() - copy := make(map[uint64]vm.Page, len(a.vAddrToPageMapping)) - for vAddr, page := range a.vAddrToPageMapping { - copy[vAddr] = page - } - return copy -} diff --git a/go.mod b/go.mod index f2b366cc..7ac31345 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/onsi/ginkgo/v2 v2.16.0 github.com/onsi/gomega v1.31.1 github.com/rs/xid v1.5.0 - github.com/sarchlab/akita/v3 v3.0.0 + github.com/sarchlab/akita/v3 v3.1.0 github.com/tebeka/atexit v0.3.0 gonum.org/v1/gonum v0.14.0 ) diff --git a/go.sum b/go.sum index d28c9fe3..fbc168a5 100644 --- a/go.sum +++ b/go.sum @@ -48,8 +48,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb 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/v3 v3.0.0 h1:kLRhaBpDA6yXYn5suiIFGnWJ0xr/eqGDjMTMGSwaXUM= -github.com/sarchlab/akita/v3 v3.0.0/go.mod h1:p74MfNeElTYFy9H/gwsPzZQXPfw/e87/6HiIYCZexWc= +github.com/sarchlab/akita/v3 v3.1.0 h1:pt17MC5A7NqfZKFRuE9CSQh1L50YJE+/zh2x3DBt5Ow= +github.com/sarchlab/akita/v3 v3.1.0/go.mod h1:63FwQtSD9gCrOF5XGIq4Z6md3QqBgZ5yRDI5K2nGwfA= 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= diff --git a/go.work b/go.work new file mode 100644 index 00000000..01cddcb9 --- /dev/null +++ b/go.work @@ -0,0 +1,3 @@ +go 1.22.4 + +use ../akita diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 00000000..7488f7e4 --- /dev/null +++ b/go.work.sum @@ -0,0 +1,10 @@ +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/ianlancetaylor/demangle v0.0.0-20220517205856-0058ec4f073c/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/samples/runner/platform.go b/samples/runner/platform.go index 2f797b55..6d72bcd8 100644 --- a/samples/runner/platform.go +++ b/samples/runner/platform.go @@ -42,6 +42,6 @@ type GPU struct { L2TLBs []TraceableComponent MemControllers []TraceableComponent MMUEngine *mmu.MMU - GMMUEngine *gmmu.GMMU + GMMUEngine *gmmu.Comp GMMUCache []TraceableComponent } diff --git a/samples/runner/timingplatform.go b/samples/runner/timingplatform.go index 0a061a08..68142178 100644 --- a/samples/runner/timingplatform.go +++ b/samples/runner/timingplatform.go @@ -429,7 +429,7 @@ func (b *R9NanoPlatformBuilder) createGPU( driver.DeviceProperties{ CUCount: b.numCUPerSA * b.numSAPerGPU, DRAMSize: 4 * mem.GB, - }, gpuBuilder.pageTable) + }) gpu.CommandProcessor.Driver = gpuDriver.GetPortByName("GPU") From 146e85c050905fb28b1f74ac6519157f82ba1b02 Mon Sep 17 00:00:00 2001 From: Yifan Sun Date: Tue, 3 Dec 2024 00:35:26 +0000 Subject: [PATCH 3/4] Export Device's PageTable --- driver/driver.go | 2 +- driver/internal/device.go | 2 +- driver/internal/memoryallocator.go | 8 ++++---- go.work | 3 --- go.work.sum | 10 ---------- 5 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 go.work delete mode 100644 go.work.sum diff --git a/driver/driver.go b/driver/driver.go index 576ae9d9..2cdb3118 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -153,7 +153,7 @@ func (d *Driver) RegisterGPU( CUCount: properties.CUCount, DRAMSize: properties.DRAMSize, }, - pageTable: vm.PageTable, + PageTable: vm.NewPageTable(d.Log2PageSize), } gpuDevice.SetTotalMemSize(properties.DRAMSize) d.memAllocator.RegisterDevice(gpuDevice) diff --git a/driver/internal/device.go b/driver/internal/device.go index 6175b2b1..4033d058 100644 --- a/driver/internal/device.go +++ b/driver/internal/device.go @@ -40,7 +40,7 @@ type Device struct { nextActualGPUIndex int MemState DeviceMemoryState Properties DeviceProperties - pageTable vm.PageTable + PageTable vm.PageTable } // SetTotalMemSize sets total memory size diff --git a/driver/internal/memoryallocator.go b/driver/internal/memoryallocator.go index 68071009..7aaea995 100644 --- a/driver/internal/memoryallocator.go +++ b/driver/internal/memoryallocator.go @@ -64,7 +64,7 @@ func (a *memoryAllocatorImpl) RegisterDevice(device *Device) { state := device.MemState state.setInitialAddress(a.totalStorageByteSize) a.totalStorageByteSize += state.getStorageSize() - device.pageTable = vm.NewPageTable(a.log2PageSize) + device.PageTable = vm.NewPageTable(a.log2PageSize) a.devices[device.ID] = device } @@ -162,7 +162,7 @@ func (a *memoryAllocatorImpl) allocatePages( // fmt.Printf("page.addr is %x piage Device ID is %d \n", page.PAddr, page.DeviceID) // debug.PrintStack() - device.pageTable.Insert(page) + device.PageTable.Insert(page) a.vAddrToPageMapping[page.VAddr] = page } @@ -189,7 +189,7 @@ func (a *memoryAllocatorImpl) Remap( device := a.devices[deviceID] pages := a.allocateMultiplePagesWithGivenVAddrs(pid, deviceID, vAddrs, false) for _, page := range pages { - device.pageTable.Insert(page) + device.PageTable.Insert(page) } } @@ -246,7 +246,7 @@ func (a *memoryAllocatorImpl) allocatePageWithGivenVAddr( DeviceID: uint64(deviceID), Unified: isUnified, } - device.pageTable.Insert(page) + device.PageTable.Insert(page) a.vAddrToPageMapping[page.VAddr] = page return page diff --git a/go.work b/go.work deleted file mode 100644 index 01cddcb9..00000000 --- a/go.work +++ /dev/null @@ -1,3 +0,0 @@ -go 1.22.4 - -use ../akita diff --git a/go.work.sum b/go.work.sum deleted file mode 100644 index 7488f7e4..00000000 --- a/go.work.sum +++ /dev/null @@ -1,10 +0,0 @@ -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/ianlancetaylor/demangle v0.0.0-20220517205856-0058ec4f073c/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= From 08a802b986b9882c0467f2dfeb36ff4db7a0f900 Mon Sep 17 00:00:00 2001 From: Yuwei Sun Date: Thu, 5 Dec 2024 14:00:25 +0000 Subject: [PATCH 4/4] fix bugs --- samples/runner/emuplatform.go | 3 +-- samples/runner/r9nanobuilder.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/runner/emuplatform.go b/samples/runner/emuplatform.go index c1b9c32e..be08f308 100644 --- a/samples/runner/emuplatform.go +++ b/samples/runner/emuplatform.go @@ -98,8 +98,7 @@ func (b EmuBuilder) Build() *Platform { gpuDriver.RegisterGPU(cpPort, driver.DeviceProperties{ DRAMSize: 4 * mem.GB, CUCount: 64, - }, - gpuBuilder.pageTable) + }) connection.PlugIn(cpPort, 64) b.gpus = append(b.gpus, gpu) diff --git a/samples/runner/r9nanobuilder.go b/samples/runner/r9nanobuilder.go index 96299628..a508ac56 100644 --- a/samples/runner/r9nanobuilder.go +++ b/samples/runner/r9nanobuilder.go @@ -82,7 +82,7 @@ type R9NanoGPUBuilder struct { l2ToDramConnection *sim.DirectConnection gmmuCache *tlb.TLB - gmmu *gmmu.GMMU + gmmu *gmmu.Comp pageTable vm.PageTable }