Commit c510ccb8 by sakundu

Merge branch 'main' of github.com:TILOS-AI-Institute/MacroPlacement into main

parents cfdb672b 1804a82f
{
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"typeinfo": "cpp"
}
}
\ No newline at end of file
...@@ -1057,15 +1057,15 @@ class PBFNetlist: ...@@ -1057,15 +1057,15 @@ class PBFNetlist:
y_dir = 0 y_dir = 0
src_width = src_ux - src_lx src_width = src_ux - src_lx
src_height = src_uy - src_ly src_height = src_uy - src_ly
target_width = target_ux - target_lx target_width = target_ux - target_lx
target_height = target_uy - target_ly target_height = target_uy - target_ly
src_cx = (src_lx + src_ux) / 2.0 src_cx = (src_lx + src_ux) / 2.0
src_cy = (src_ly + src_uy) / 2.0 src_cy = (src_ly + src_uy) / 2.0
target_cx = (target_lx + target_ux) / 2.0 target_cx = (target_lx + target_ux) / 2.0
target_cy = (target_ly + target_uy) / 2.0 target_cy = (target_ly + target_uy) / 2.0
min_dist = 1e-4 min_dist = 1e-4
x_min_dist = (src_width + target_width) / 2.0 x_min_dist = (src_width + target_width) / 2.0
y_min_dist = (src_height + target_height) / 2.0 y_min_dist = (src_height + target_height) / 2.0
...@@ -1075,8 +1075,8 @@ class PBFNetlist: ...@@ -1075,8 +1075,8 @@ class PBFNetlist:
if (abs(target_cy - src_cy) > (y_min_dist - min_dist)): if (abs(target_cy - src_cy) > (y_min_dist - min_dist)):
# there is no overlap # there is no overlap
return None, None return None, None
# there is no overlap # there is no overlap
if (src_cx == target_cx and src_cy == target_cy): if (src_cx == target_cx and src_cy == target_cy):
# fully overlap # fully overlap
x_dir = -1.0 x_dir = -1.0
......
...@@ -35,10 +35,38 @@ Here f_x_max (f_y_max) is the absolute value of f_x (f_y) which has the maximum ...@@ -35,10 +35,38 @@ Here f_x_max (f_y_max) is the absolute value of f_x (f_y) which has the maximum
After normalization, the standard-cell clusters are moved based on the forces exerted on them. The move which will push the standard-cell clusters outside of canvas will be canceled. After normalization, the standard-cell clusters are moved based on the forces exerted on them. The move which will push the standard-cell clusters outside of canvas will be canceled.
## How to run our implementation
We provide implementations in both [python](https://github.com/TILOS-AI-Institute/MacroPlacement/blob/main/CodeElements/FDPlacement/FD.py) and [c++](https://github.com/TILOS-AI-Institute/MacroPlacement/tree/main/CodeElements/FDPlacement/src).
To run the FD placer implemented in python, you need to install all the dependencies of [Circuit Training](https://github.com/google-research/circuit_training.git).
You can set the testcase and related parameters in [FD.py](https://github.com/TILOS-AI-Institute/MacroPlacement/blob/449e837dc1c2ec927a08976ec7925ddfe53f9f04/CodeElements/FDPlacement/FD.py#L1395).
Then you can our FD placer as following:
```
python FD.py
```
To run the FD placer implemented in c++, you need to compile c++ codes as following:
```
mkdir build
cd build
cmake ..
```
You can set the related parameters in [main.cpp](https://github.com/TILOS-AI-Institute/MacroPlacement/blob/449e837dc1c2ec927a08976ec7925ddfe53f9f04/CodeElements/FDPlacement/src/main.cpp#L14) before you compile the codes.
Then you can run FD placer as following:
```
./build/fd_placer ariane133/ariane.pb.txt ariane133/ariane.plc
```
## **Experimental results** ## **Experimental results**
We have tested our codes on the Ariane133 (NanGate45). The experimental results are presented below. We have tested our codes on the Ariane133 (NanGate45). The experimental results are presented below.
The results from our python implementation and our c++ implementation are a little different. This is due to the precision loss while converting from python codes to C++ codes.
<p align="center"> <p align="center">
<img src="./ariane133/FD_result_1225.png" width= "1200"/> <img src="./ariane133/FD_result_20230112.png" width= "1200"/>
</p> </p>
<p align="center"> <p align="center">
Figure 1. results for Ariane133 (NanGate45). Figure 1. results for Ariane133 (NanGate45).
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"C_Cpp.errorSquiggles": "disabled"
}
\ No newline at end of file
...@@ -6,23 +6,27 @@ int main(int argc, char* argv[]) { ...@@ -6,23 +6,27 @@ int main(int argc, char* argv[]) {
std::string netlist_file = argv[1]; std::string netlist_file = argv[1];
std::string plc_file = argv[2]; std::string plc_file = argv[2];
PBFNetlist design(netlist_file); PBFNetlist design(netlist_file);
std::string new_netlist_file = netlist_file + ".new"; std::string new_netlist_file = netlist_file + ".os_cpp.txt";
design.WriteNetlist(new_netlist_file); design.WriteNetlist(new_netlist_file);
design.RestorePlacement(plc_file); design.RestorePlacement(plc_file);
const float io_factor = 1.0; const float io_factor = 1.0;
const std::vector<int> num_steps { 10, 10, 10 };
const std::vector<float> attract_factor { 100, 1.0e-3, 1.0e-5 }; const std::vector<int> num_steps { 100, 100, 100 };
const std::vector<float> repel_factor { 0.0, 1.0e6, 1.0e6 }; const std::vector<float> attract_factor { 100.0, 1.0e-3, 1.0e-5 };
const std::vector<float> repel_factor { 0.0, 1.0e6, 1.0e7 };
const std::vector<float> move_distance_factor { 1.0, 1.0, 1.0 }; const std::vector<float> move_distance_factor { 1.0, 1.0, 1.0 };
const bool use_current_loc = false; const bool use_current_loc = false;
const bool debug_mode = false; const bool debug_mode = true;
auto start_timestamp_global = std::chrono::high_resolution_clock::now(); auto start_timestamp_global = std::chrono::high_resolution_clock::now();
design.FDPlacer(io_factor, num_steps, design.FDPlacer(io_factor, num_steps,
move_distance_factor, move_distance_factor,
attract_factor, attract_factor,
repel_factor, repel_factor,
use_current_loc, use_current_loc,
debug_mode); debug_mode);
auto end_timestamp_global = std::chrono::high_resolution_clock::now(); auto end_timestamp_global = std::chrono::high_resolution_clock::now();
double total_global_time double total_global_time
= std::chrono::duration_cast<std::chrono::nanoseconds>( = std::chrono::duration_cast<std::chrono::nanoseconds>(
...@@ -30,6 +34,6 @@ int main(int argc, char* argv[]) { ...@@ -30,6 +34,6 @@ int main(int argc, char* argv[]) {
.count(); .count();
total_global_time *= 1e-9; total_global_time *= 1e-9;
std::cout << "Runtime of FDPlacer : " << total_global_time << std::endl; std::cout << "Runtime of FDPlacer : " << total_global_time << std::endl;
design.WritePlcFile(plc_file + ".new"); design.WritePlcFile(plc_file + ".os_cpp.txt");
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment