Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
macroplacement
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
macroplacement
Commits
7474f481
Commit
7474f481
authored
Aug 31, 2022
by
Dinple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overhaul WIP + plugging plc_client_os into placement_util WIP
parent
fdeb44ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
12 deletions
+24
-12
CodeElements/Plc_client/placement_util_os.py
+7
-5
CodeElements/Plc_client/plc_client_os.py
+9
-1
CodeElements/Plc_client/plc_client_os_test.py
+8
-6
No files found.
CodeElements/Plc_client/placement_util_os.py
View file @
7474f481
...
...
@@ -31,7 +31,7 @@ import numpy as np
# Internal gfile dependencies
# done
def
nodes_of_types
(
plc
:
plc_client
.
PlacementCost
,
type_list
:
List
[
str
])
->
Iterator
[
int
]:
"""Yields the index of a node of certain types."""
...
...
@@ -76,7 +76,7 @@ def restore_macro_orientations(plc: plc_client.PlacementCost,
for
node_index
,
orientation
in
macro_orientations
.
items
():
plc
.
update_macro_orientation
(
node_index
,
orientation
)
#
def
extract_attribute_from_comments
(
attribute
:
str
,
filenames
:
List
[
str
])
->
Optional
[
str
]:
"""Parses the files' comments section, tries to extract the attribute.
...
...
@@ -104,7 +104,7 @@ def extract_attribute_from_comments(attribute: str,
break
return
None
#done
def
get_blockages_from_comments
(
filenames
:
Union
[
str
,
List
[
str
]])
->
Optional
[
List
[
List
[
float
]]]:
"""Returns list of blockages if they exist in the file's comments section."""
...
...
@@ -130,7 +130,7 @@ def get_blockages_from_comments(
if
blockages
:
return
blockages
#done
def
extract_sizes_from_comments
(
filenames
:
List
[
str
])
->
Optional
[
Tuple
[
float
,
float
,
int
,
int
]]:
"""Parses the file's comments section, tries to extract canvas/grid sizes.
...
...
@@ -793,7 +793,7 @@ def create_placement_cost_using_common_arguments(
for
filename
in
[
netlist_file
,
init_placement
]:
if
filename
is
None
:
continue
blockages
=
get_blockages_from_comments
(
filename
)
blockages
=
get_blockages_from_comments
(
[
filename
]
)
# Only read blockages from one file.
if
blockages
:
break
...
...
@@ -964,6 +964,8 @@ def main():
netlist_file
=
os
.
path
.
join
(
test_netlist_dir
,
'netlist.pb.txt'
)
init_placement
=
os
.
path
.
join
(
test_netlist_dir
,
'initial.plc'
)
plc
=
create_placement_cost
(
netlist_file
=
netlist_file
,
init_placement
=
init_placement
)
plc
=
create_placement_cost_using_common_arguments
(
netlist_file
=
netlist_file
,
init_placement
=
init_placement
,
grid_cols
=
10
,
grid_rows
=
10
,
congestion_smooth_range
=
2.0
,
overlap_threshold
=
0.004
,
use_incremental_cost
=
False
)
# plc.nodes_of_types()
if
__name__
==
'__main__'
:
...
...
CodeElements/Plc_client/plc_client_os.py
View file @
7474f481
...
...
@@ -86,6 +86,8 @@ class PlacementCost(object):
self
.
hard_macros_to_inpins
=
{}
self
.
soft_macros_to_inpins
=
{}
# unknown
self
.
use_incremental_cost
=
False
# blockage
self
.
blockages
=
[]
# read netlist
...
...
@@ -1444,12 +1446,18 @@ class PlacementCost(object):
return
self
.
modules_w_pins
[
node_idx
]
.
get_type
()
except
IndexError
:
# NOTE: Google's API return NONE if out of range
print
(
"[INDEX OUT OF RANGE
ERROR
] Can not process index at {}"
.
format
(
node_idx
))
print
(
"[INDEX OUT OF RANGE
WARNING
] Can not process index at {}"
.
format
(
node_idx
))
return
None
def
make_soft_macros_square
(
self
):
pass
def
set_use_incremental_cost
(
self
,
use_incremental_cost
):
self
.
use_incremental_cost
=
use_incremental_cost
def
get_use_incremental_cost
(
self
):
return
self
.
use_incremental_cost
def
get_macro_adjacency
(
self
)
->
list
:
"""
Compute Adjacency Matrix
...
...
CodeElements/Plc_client/plc_client_os_test.py
View file @
7474f481
...
...
@@ -238,12 +238,14 @@ class PlacementCostTest():
self
.
plc_os
.
set_canvas_size
(
self
.
CANVAS_WIDTH
,
self
.
CANVAS_HEIGHT
)
self
.
plc_os
.
set_placement_grid
(
self
.
GRID_COL
,
self
.
GRID_ROW
)
# TODO: Setting blockage has no effect on proxy cost computation
self
.
plc
.
create_blockage
(
0
,
0
,
400
,
400
,
1
)
self
.
plc
.
create_blockage
(
0
,
0
,
200
,
200
,
1
)
print
(
self
.
plc
.
get_blockages
())
print
(
self
.
plc
.
make_soft_macros_square
())
print
(
self
.
plc_os
.
get_soft_macros_count
())
# TODO: [IGNORE] Setting blockage has no effect on proxy cost computation
if
False
:
self
.
plc
.
create_blockage
(
0
,
0
,
400
,
400
,
1
)
self
.
plc
.
create_blockage
(
0
,
0
,
200
,
200
,
1
)
print
(
self
.
plc
.
get_blockages
())
print
(
self
.
plc
.
make_soft_macros_square
())
print
(
self
.
plc
.
set_use_incremental_cost
(
True
))
print
(
self
.
plc_os
.
get_soft_macros_count
())
# HPWL
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment