-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86bde55
commit ce185e1
Showing
12 changed files
with
96 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
package trace | ||
|
||
import ( | ||
"github.com/sarchlab/mgpusim/v3/accelsim_tracing/gpu" | ||
) | ||
|
||
type kernel struct { // trace execs interface | ||
type Kernel struct { // trace execs interface | ||
rawText string | ||
fileName string | ||
filePath string | ||
traceGroup *traceGroup | ||
traceGroup *traceGroupReader | ||
} | ||
|
||
func (te *kernel) Type() string { | ||
func (te *Kernel) Type() string { | ||
return "kernel" | ||
} | ||
|
||
func (te *kernel) Exec(gpu *gpu.GPU) error { | ||
tg := NewTraceGroup().WithFilePath(te.filePath) | ||
tg.Build() | ||
|
||
err := tg.Exec(gpu) | ||
|
||
return err | ||
func (te *Kernel) File() string { | ||
return te.fileName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package trace | ||
|
||
import ( | ||
"bufio" | ||
"log" | ||
"os" | ||
"strings" | ||
) | ||
|
||
type traceGroupReaderBuilder struct { | ||
filePath string | ||
} | ||
|
||
func NewTraceGroupReaderBuilder() *traceGroupReaderBuilder { | ||
return &traceGroupReaderBuilder{ | ||
filePath: "", | ||
} | ||
} | ||
|
||
func (tg *traceGroupReaderBuilder) WithFilePath(path string) *traceGroupReaderBuilder { | ||
tg.filePath = path | ||
return tg | ||
} | ||
|
||
func (tg *traceGroupReaderBuilder) Build() *traceGroupReader { | ||
tgReader := &traceGroupReader{} | ||
tg.buildFileScanner(tgReader) | ||
tg.parseTraceHeader(tgReader) | ||
return tgReader | ||
} | ||
|
||
func (tg *traceGroupReaderBuilder) buildFileScanner(tgReader *traceGroupReader) { | ||
file, err := os.Open(tg.filePath) | ||
if err != nil { | ||
log.Panic(err) | ||
} | ||
tgReader.File = file // [note] close after exec | ||
tgReader.scanner = bufio.NewScanner(file) | ||
} | ||
|
||
func (tg *traceGroupReaderBuilder) parseTraceHeader(tgReader *traceGroupReader) { | ||
headerLines := make([]string, 0) | ||
for tgReader.scanner.Scan() { // [note] get prefix lines that start with "-" | ||
if strings.HasPrefix(tgReader.scanner.Text(), "-") { | ||
headerLines = append(headerLines, tgReader.scanner.Text()) | ||
} else if tgReader.scanner.Text() != "" { | ||
break | ||
} | ||
} | ||
|
||
tgReader.traceHeader = parseHeaderParam(headerLines) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters