Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
M
MGPUSim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
3
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Akita
MGPUSim
Commits
6a626754
Commit
6a626754
authored
5 years ago
by
Yifan Sun
Browse files
Options
Downloads
Patches
Plain Diff
Directory write to bottom
Former-commit-id:
dbdf1482
Former-commit-id:
e5d17617
Former-commit-id:
4d0f9c36
parent
6fda475a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
timing/newcaches/l1v/directory.go
+41
-4
41 additions, 4 deletions
timing/newcaches/l1v/directory.go
timing/newcaches/l1v/directory_test.go
+43
-0
43 additions, 0 deletions
timing/newcaches/l1v/directory_test.go
with
84 additions
and
4 deletions
timing/newcaches/l1v/directory.go
+
41
−
4
View file @
6a626754
...
...
@@ -138,19 +138,44 @@ func (d *directory) processWrite(
mshrEntry
:=
d
.
mshr
.
Query
(
cacheLineID
)
if
mshrEntry
!=
nil
{
ok
:=
d
.
writeBottom
(
now
,
trans
)
if
ok
{
return
d
.
processMSHRHit
(
trans
,
mshrEntry
)
}
return
false
}
block
:=
d
.
dir
.
Lookup
(
cacheLineID
)
if
block
!=
nil
&&
block
.
IsValid
{
return
d
.
processWriteHit
(
trans
,
block
)
return
d
.
processWriteHit
(
now
,
trans
,
block
)
}
block
=
d
.
dir
.
FindVictim
(
cacheLineID
)
return
d
.
processWriteHit
(
trans
,
block
)
return
d
.
processWriteHit
(
now
,
trans
,
block
)
}
func
(
d
*
directory
)
writeBottom
(
now
akita
.
VTimeInSec
,
trans
*
transaction
)
bool
{
write
:=
trans
.
write
addr
:=
write
.
Address
writeToBottom
:=
mem
.
NewWriteReq
(
now
,
d
.
bottomPort
,
d
.
lowModuleFinder
.
Find
(
addr
),
addr
,
)
writeToBottom
.
Data
=
write
.
Data
writeToBottom
.
PID
=
write
.
PID
err
:=
d
.
bottomPort
.
Send
(
writeToBottom
)
if
err
!=
nil
{
return
false
}
return
true
}
func
(
d
*
directory
)
processWriteHit
(
now
akita
.
VTimeInSec
,
trans
*
transaction
,
block
*
cache
.
Block
,
)
bool
{
...
...
@@ -165,8 +190,20 @@ func (d *directory) processWriteHit(
return
false
}
block
.
IsLocked
=
true
ok
:=
d
.
writeBottom
(
now
,
trans
)
if
!
ok
{
return
false
}
write
:=
trans
.
write
addr
:=
write
.
Address
blockSize
:=
uint64
(
1
<<
d
.
log2BlockSize
)
cacheLineID
:=
addr
/
blockSize
*
blockSize
block
.
IsLocked
=
true
block
.
Tag
=
cacheLineID
if
len
(
write
.
Data
)
==
1
<<
d
.
log2BlockSize
{
block
.
IsValid
=
true
}
d
.
dir
.
Visit
(
block
)
trans
.
bankAction
=
bankActionWrite
...
...
This diff is collapsed.
Click to expand it.
timing/newcaches/l1v/directory_test.go
+
43
−
0
View file @
6a626754
...
...
@@ -234,6 +234,7 @@ var _ = Describe("Directory", func() {
BeforeEach
(
func
()
{
write
=
mem
.
NewWriteReq
(
10
,
nil
,
nil
,
0x104
)
write
.
Data
=
[]
byte
{
1
,
2
,
3
,
4
}
write
.
PID
=
1
trans
=
&
transaction
{
write
:
write
,
}
...
...
@@ -244,6 +245,13 @@ var _ = Describe("Directory", func() {
inBuf
.
EXPECT
()
.
Peek
()
.
Return
(
trans
)
inBuf
.
EXPECT
()
.
Pop
()
mshr
.
EXPECT
()
.
Query
(
uint64
(
0x100
))
.
Return
(
mshrEntry
)
lowModuleFinder
.
EXPECT
()
.
Find
(
uint64
(
0x104
))
bottomPort
.
EXPECT
()
.
Send
(
gomock
.
Any
())
.
Do
(
func
(
write
*
mem
.
WriteReq
)
{
Expect
(
write
.
Address
)
.
To
(
Equal
(
uint64
(
0x104
)))
Expect
(
write
.
Data
)
.
To
(
Equal
([]
byte
{
1
,
2
,
3
,
4
}))
Expect
(
write
.
PID
)
.
To
(
Equal
(
ca
.
PID
(
1
)))
})
madeProgress
:=
d
.
Tick
(
10
)
...
...
@@ -262,6 +270,7 @@ var _ = Describe("Directory", func() {
BeforeEach
(
func
()
{
write
=
mem
.
NewWriteReq
(
10
,
nil
,
nil
,
0x104
)
write
.
Data
=
[]
byte
{
1
,
2
,
3
,
4
}
write
.
PID
=
1
trans
=
&
transaction
{
write
:
write
,
}
...
...
@@ -274,12 +283,19 @@ var _ = Describe("Directory", func() {
mshr
.
EXPECT
()
.
Query
(
uint64
(
0x100
))
.
Return
(
nil
)
dir
.
EXPECT
()
.
Lookup
(
uint64
(
0x100
))
.
Return
(
block
)
dir
.
EXPECT
()
.
Visit
(
block
)
lowModuleFinder
.
EXPECT
()
.
Find
(
uint64
(
0x104
))
bankBuf
.
EXPECT
()
.
CanPush
()
.
Return
(
true
)
bankBuf
.
EXPECT
()
.
Push
(
gomock
.
Any
())
.
Do
(
func
(
trans
*
transaction
)
{
Expect
(
trans
.
bankAction
)
.
To
(
Equal
(
bankActionWrite
))
Expect
(
trans
.
block
)
.
To
(
BeIdenticalTo
(
block
))
})
bottomPort
.
EXPECT
()
.
Send
(
gomock
.
Any
())
.
Do
(
func
(
write
*
mem
.
WriteReq
)
{
Expect
(
write
.
Address
)
.
To
(
Equal
(
uint64
(
0x104
)))
Expect
(
write
.
Data
)
.
To
(
Equal
([]
byte
{
1
,
2
,
3
,
4
}))
Expect
(
write
.
PID
)
.
To
(
Equal
(
ca
.
PID
(
1
)))
})
madeProgress
:=
d
.
Tick
(
10
)
...
...
@@ -288,6 +304,11 @@ var _ = Describe("Directory", func() {
})
It
(
"should send to bank in case of write miss"
,
func
()
{
block
.
Tag
=
0x200
block
.
IsValid
=
false
write
.
Address
=
0x100
write
.
Data
=
make
([]
byte
,
64
)
inBuf
.
EXPECT
()
.
Peek
()
.
Return
(
trans
)
inBuf
.
EXPECT
()
.
Pop
()
mshr
.
EXPECT
()
.
Query
(
uint64
(
0x100
))
.
Return
(
nil
)
...
...
@@ -300,11 +321,20 @@ var _ = Describe("Directory", func() {
Expect
(
trans
.
bankAction
)
.
To
(
Equal
(
bankActionWrite
))
Expect
(
trans
.
block
)
.
To
(
BeIdenticalTo
(
block
))
})
lowModuleFinder
.
EXPECT
()
.
Find
(
uint64
(
0x100
))
bottomPort
.
EXPECT
()
.
Send
(
gomock
.
Any
())
.
Do
(
func
(
write
*
mem
.
WriteReq
)
{
Expect
(
write
.
Address
)
.
To
(
Equal
(
uint64
(
0x100
)))
Expect
(
write
.
Data
)
.
To
(
HaveLen
(
64
))
Expect
(
write
.
PID
)
.
To
(
Equal
(
ca
.
PID
(
1
)))
})
madeProgress
:=
d
.
Tick
(
10
)
Expect
(
madeProgress
)
.
To
(
BeTrue
())
Expect
(
block
.
IsLocked
)
.
To
(
BeTrue
())
Expect
(
block
.
Tag
)
.
To
(
Equal
(
uint64
(
0x100
)))
Expect
(
block
.
IsValid
)
.
To
(
BeTrue
())
})
It
(
"should stall is the block is locked"
,
func
()
{
...
...
@@ -341,6 +371,19 @@ var _ = Describe("Directory", func() {
Expect
(
madeProgress
)
.
To
(
BeFalse
())
})
It
(
"should stall is send to bottom failed"
,
func
()
{
inBuf
.
EXPECT
()
.
Peek
()
.
Return
(
trans
)
mshr
.
EXPECT
()
.
Query
(
uint64
(
0x100
))
.
Return
(
nil
)
dir
.
EXPECT
()
.
Lookup
(
uint64
(
0x100
))
.
Return
(
block
)
bankBuf
.
EXPECT
()
.
CanPush
()
.
Return
(
true
)
lowModuleFinder
.
EXPECT
()
.
Find
(
uint64
(
0x104
))
bottomPort
.
EXPECT
()
.
Send
(
gomock
.
Any
())
.
Return
(
&
akita
.
SendError
{})
madeProgress
:=
d
.
Tick
(
10
)
Expect
(
madeProgress
)
.
To
(
BeFalse
())
})
})
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment