Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Accelsim/ticking #43

Open
wants to merge 32 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f4ce3bd
initial accelsim traing branch
gongchen618 Dec 2, 2023
55b7416
update gitignore
gongchen618 Dec 6, 2023
d4a3161
Include accelsim_tracing in linting
syifan Dec 6, 2023
6426b2a
Merge branch 'accelsim_tracing' of github.com:sarchlab/mgpusim into a…
gongchen618 Dec 6, 2023
520d885
fix lint problem
gongchen618 Dec 6, 2023
9122028
use drse drinst(gpu,trace) instead of trace(gpu)
gongchen618 Dec 13, 2023
5118672
update the alu_builder
gongchen618 Dec 15, 2023
dfd3ae8
deldrop constructure alu group
gongchen618 Dec 17, 2023
00f8b8e
update the builder concept
gongchen618 Dec 17, 2023
e2e4b6e
lint
gongchen618 Dec 17, 2023
86bde55
fix the driver pattern
gongchen618 Jan 26, 2024
ce185e1
fix the work flow
gongchen618 Jan 26, 2024
83ed726
no else after return-type if
gongchen618 Jan 30, 2024
bdf5df3
empty line after loop and before return
gongchen618 Jan 30, 2024
a725c7e
add empty line after closing of bracket
gongchen618 Jan 30, 2024
afd9f84
adjust trace parsing logical structure
gongchen618 Feb 2, 2024
73d5395
fix
gongchen618 Feb 2, 2024
77d3fe1
fix
gongchen618 Feb 2, 2024
3d13284
draft
gongchen618 Feb 23, 2024
76332d8
draft-original
gongchen618 Feb 23, 2024
b752af7
move original code to v1
gongchen618 Feb 29, 2024
da18b31
clean the directory
gongchen618 Feb 29, 2024
7300eb4
add the trace_reader part with tests, (unfinished)rewrite code
gongchen618 Mar 1, 2024
61806f9
simple model
gongchen618 Mar 5, 2024
f2ee042
fix the pointer bug & add test
gongchen618 Mar 5, 2024
4a549ae
merge v3
gongchen618 Mar 5, 2024
a2ce6d9
edit docs
gongchen618 Mar 5, 2024
1a77eb0
modify module name
gongchen618 Mar 5, 2024
ab92c2d
delete the mod file in subdirectory
gongchen618 Mar 5, 2024
da2c310
add test data
gongchen618 Mar 5, 2024
b07ae3f
lint
gongchen618 Mar 5, 2024
28342ed
Merge branch 'v3' into accelsim/ticking
syifan Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions .vscode/tasks.json

This file was deleted.

6 changes: 4 additions & 2 deletions accelsim_tracing/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
accelsim_tracing
output/
example/
data/*
*.log

!data/simple-trace-example/
Binary file modified accelsim_tracing/README.md
Binary file not shown.
29 changes: 29 additions & 0 deletions accelsim_tracing/accelsim_tracing.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package main

import (
"github.com/sarchlab/akita/v3/sim"
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/benchmark"
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/platform"
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/runner"
"github.com/tebeka/atexit"
)

func main() {
benchmark := new(benchmark.BenchmarkBuilder).
// WithTraceDirectory("data/bfs-rodinia-2.0-ft").
WithTraceDirectory("data/simple-trace-example").
Build()

platform := new(platform.A100PlatformBuilder).
WithFreq(1 * sim.Hz).
Build()

runner := new(runner.RunnerBuilder).
WithPlatform(platform).
Build()
runner.AddBenchmark(benchmark)

runner.Run()

atexit.Exit(0)
}
17 changes: 0 additions & 17 deletions accelsim_tracing/alu/alu.go

This file was deleted.

45 changes: 0 additions & 45 deletions accelsim_tracing/alu/builder.go

This file was deleted.

2 changes: 0 additions & 2 deletions accelsim_tracing/alu/doc.go

This file was deleted.

19 changes: 0 additions & 19 deletions accelsim_tracing/alu/int32.go

This file was deleted.

48 changes: 48 additions & 0 deletions accelsim_tracing/benchmark/benchmark.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package benchmark

import (
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/driver"
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/nvidia"
)

type TraceExec interface {
ExecType() nvidia.ExecType
Run(*driver.Driver)
}

type Benchmark struct {
TraceExecs []TraceExec
}

type ExecMemcpy struct {
direction nvidia.ExecMemcpyDirection
address uint64
length uint64
}

type ExecKernel struct {
kernel nvidia.Kernel
}

func (e *ExecMemcpy) ExecType() nvidia.ExecType {
return nvidia.ExecMemcpy
}

func (e *ExecKernel) ExecType() nvidia.ExecType {
return nvidia.ExecKernel
}

func (e *ExecMemcpy) Run(d *driver.Driver) {
}

func (e *ExecKernel) Run(d *driver.Driver) {
d.RunKernel(&e.kernel)
}

func (e *ExecKernel) SetKernel(kernel nvidia.Kernel) {
e.kernel = kernel
}

func (e *ExecKernel) GetKernel() *nvidia.Kernel {
return &e.kernel
}
42 changes: 42 additions & 0 deletions accelsim_tracing/benchmark/benchmark_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package benchmark_test

import (
"testing"

"github.com/sarchlab/mgpusim/v3/accelsim_tracing/benchmark"
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/nvidia"
)

func TestBenchmarkBuild(t *testing.T) {
benchmark := new(benchmark.BenchmarkBuilder).
// WithTraceDirectory("../data/bfs-rodinia-2.0-ft").
WithTraceDirectory("../data/simple-trace-example").
Build()

kernelCount := 0
memcpyCount := 0

for _, exec := range benchmark.TraceExecs {
if exec.ExecType() == nvidia.ExecKernel {
kernelCount++
} else if exec.ExecType() == nvidia.ExecMemcpy {
memcpyCount++
} else {
t.Errorf("Unknown exec type")
}
}

// if kernelCount != 16 {
// t.Errorf("Expected 16 kernel, got %d", kernelCount)
// }
// if memcpyCount != 14 {
// t.Errorf("Expected 14 memcpy, got %d", memcpyCount)
// }

if kernelCount != 3 {
t.Errorf("Expected 3 kernel, got %d", kernelCount)
}
if memcpyCount != 3 {
t.Errorf("Expected 3 memcpy, got %d", memcpyCount)
}
}
45 changes: 0 additions & 45 deletions accelsim_tracing/benchmark/build.go

This file was deleted.

77 changes: 77 additions & 0 deletions accelsim_tracing/benchmark/builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package benchmark

import (
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/nvidia"
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/tracereader"
)

type BenchmarkBuilder struct {
traceDirectory string
}

func (b *BenchmarkBuilder) WithTraceDirectory(traceDirectory string) *BenchmarkBuilder {
b.traceDirectory = traceDirectory
return b
}

func (b *BenchmarkBuilder) Build() *Benchmark {
b.traceDirectoryMustBeSet()

reader := new(tracereader.TraceReaderBuilder).
WithTraceDirectory(b.traceDirectory).
Build()
execMetas := reader.GetExecMetas()

traceExecs := make([]TraceExec, 0)

execCount := len(execMetas)
for i := 0; i < execCount; i++ {
meta := execMetas[i]
if meta.ExecType() == nvidia.ExecKernel {
kernel := b.generateKernelTrace(meta)
traceExecs = append(traceExecs, kernel)
} else if meta.ExecType() == nvidia.ExecMemcpy {
memcpy := b.generateMemcpyTrace(meta)
traceExecs = append(traceExecs, memcpy)
}
}

return &Benchmark{
TraceExecs: traceExecs,
}
}

func (b *BenchmarkBuilder) generateKernelTrace(meta tracereader.TraceExecMeta) *ExecKernel {
kernelTrace := tracereader.ReadTrace(meta)
kernel := nvidia.Kernel{}

kernel.ThreadblocksCount = kernelTrace.ThreadblocksCount()
for i := int64(0); i < kernel.ThreadblocksCount; i++ {
tb := nvidia.Threadblock{}
tb.WarpsCount = kernelTrace.Threadblock(i).WarpsCount()
for j := int64(0); j < tb.WarpsCount; j++ {
warp := nvidia.Warp{}
warp.InstructionsCount = kernelTrace.Threadblock(i).Warp(j).InstructionsCount()
tb.Warps = append(tb.Warps, warp)
}
kernel.Threadblocks = append(kernel.Threadblocks, tb)
}

return &ExecKernel{
kernel: kernel,
}
}

func (b *BenchmarkBuilder) generateMemcpyTrace(meta tracereader.TraceExecMeta) *ExecMemcpy {
return &ExecMemcpy{
direction: meta.Direction,
address: meta.Address,
length: meta.Length,
}
}

func (b *BenchmarkBuilder) traceDirectoryMustBeSet() {
if b.traceDirectory == "" {
panic("Trace directory must be set")
}
}
2 changes: 1 addition & 1 deletion accelsim_tracing/benchmark/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package benchmark contains the driver which links traces and the simulator
// Package benchmark can load trace information and run simulation.
package benchmark
Loading
Loading