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

✨ Graph-Oriented Layout Design (GOLD) #456

Merged
merged 89 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
2eb76df
basic framework for a star pr
simon1hofmann Jan 30, 2024
8a19ed9
Merge remote-tracking branch 'origin/a_star_pr' into a_star_pr
simon1hofmann Feb 1, 2024
f574662
initial a* pr version
simon1hofmann Feb 5, 2024
72818b4
a* pr
simon1hofmann Feb 12, 2024
c8760c5
working solution
simon1hofmann Feb 25, 2024
81c97d4
Merge branch 'cda-tum:main' into a_star_pr
simon1hofmann Jun 10, 2024
c0d36ef
:memo: Update pyfiction docstrings
actions-user Jun 10, 2024
4e6e0d9
update algorithm
simon1hofmann Jun 12, 2024
dda9890
:memo: Update pyfiction docstrings
actions-user Jun 12, 2024
321b2b4
simplified algorithm
simon1hofmann Jun 12, 2024
2780e4c
major rewrite
simon1hofmann Jun 13, 2024
c0cd5dc
:memo: Update pyfiction docstrings
actions-user Jun 13, 2024
815ad40
add cli command
simon1hofmann Jun 13, 2024
133473d
small bug fixes
simon1hofmann Jun 13, 2024
ed07f19
increase coverage
simon1hofmann Jun 13, 2024
304f1d7
:memo: Update pyfiction docstrings
actions-user Jun 13, 2024
dcaa0c8
typo
simon1hofmann Jun 13, 2024
f7cd99f
add docs
simon1hofmann Jun 13, 2024
e5b21cd
expose to python
simon1hofmann Jun 13, 2024
23c3d43
add parameters to binding
simon1hofmann Jun 13, 2024
0ff400e
fix parameter name
simon1hofmann Jun 13, 2024
5f0e200
improved code readability
simon1hofmann Jun 13, 2024
73e6f4c
fix test
simon1hofmann Jun 13, 2024
c3ad9cb
fix bugs
simon1hofmann Jun 14, 2024
f1f1251
:memo: Update pyfiction docstrings
actions-user Jun 14, 2024
0536d0b
update tests
simon1hofmann Jun 14, 2024
71e3045
update algorithm name
simon1hofmann Jun 14, 2024
a1f83fd
:memo: Update pyfiction docstrings
actions-user Jun 14, 2024
83cd4bd
typo
simon1hofmann Jun 14, 2024
92d42b9
update name in bindings
simon1hofmann Jun 14, 2024
a922a2f
update name
simon1hofmann Jun 14, 2024
3101ade
update timeouts
simon1hofmann Jun 14, 2024
9433ce4
more simplifications
simon1hofmann Jun 14, 2024
e1b80c6
:memo: Update pyfiction docstrings
actions-user Jun 14, 2024
0fc15f1
update tests
simon1hofmann Jun 14, 2024
5cfc814
further improvements
simon1hofmann Jun 14, 2024
615ebfc
first refactoring
simon1hofmann Jun 17, 2024
188c5d2
:memo: Update pyfiction docstrings
actions-user Jun 17, 2024
241759c
second refactoring
simon1hofmann Jun 17, 2024
a2bd20b
:memo: Update pyfiction docstrings
actions-user Jun 17, 2024
5c069ed
third refactoring
simon1hofmann Jun 18, 2024
09486f2
:memo: Update pyfiction docstrings
actions-user Jun 18, 2024
efb2559
update tests
simon1hofmann Jun 18, 2024
16a7fe0
delete unused views
simon1hofmann Jun 18, 2024
f1e6365
:memo: Update pyfiction docstrings
actions-user Jun 18, 2024
6942506
small fix
simon1hofmann Jun 18, 2024
6405e19
benchmark file
simon1hofmann Jun 20, 2024
78c5672
:art: Small code cleanup and consistency
marcelwa Jun 28, 2024
2da9431
Merge branch 'main' into a_star_pr
marcelwa Jun 28, 2024
c0f73dc
:memo: Update pyfiction docstrings
actions-user Jun 28, 2024
766ac31
:art: More `const`
marcelwa Jul 3, 2024
4cd1b14
Merge remote-tracking branch 'origin/a_star_pr' into a_star_pr
marcelwa Jul 3, 2024
895ec01
Merge branch 'main' into a_star_pr
marcelwa Jul 3, 2024
9d5ca23
optimize POs
simon1hofmann Jul 4, 2024
61e746d
resolve merge conflicts
simon1hofmann Jul 4, 2024
24da2e4
renamed folder
simon1hofmann Jul 4, 2024
d13c1c2
:art: More `const` and further small code adjustments for consistency
marcelwa Jul 4, 2024
e64b3f5
:art: Adjusted the CLI command `gold` and its help strings for consis…
marcelwa Jul 4, 2024
e2a1d97
:memo: Update pyfiction docstrings
actions-user Jul 4, 2024
1246a8c
Merge branch 'main' into a_star_pr
simon1hofmann Jul 17, 2024
e4b804a
code review
simon1hofmann Jul 17, 2024
629c5d9
:memo: Update pyfiction docstrings
actions-user Jul 17, 2024
3340901
Merge branch 'main' into a_star_pr
simon1hofmann Jul 17, 2024
e47330f
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Jul 17, 2024
1e8a971
:memo: Update pyfiction docstrings
actions-user Jul 17, 2024
39352de
Update graph_oriented_layout_design.hpp
simon1hofmann Jul 18, 2024
d3e14d0
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Jul 18, 2024
886a9a2
Update test_graph_oriented_layout_design.py
simon1hofmann Jul 18, 2024
291cc89
Merge branch 'main' into a_star_pr
simon1hofmann Jul 18, 2024
9320ee4
Merge branch 'main' into a_star_pr
simon1hofmann Jul 19, 2024
628b359
Apply suggestions from code review
simon1hofmann Jul 24, 2024
badbdf1
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Jul 24, 2024
e2c3b5b
implement review
simon1hofmann Jul 24, 2024
24e24fd
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Jul 24, 2024
9b920ed
:memo: Update pyfiction docstrings
actions-user Jul 24, 2024
4de42b6
small fix
simon1hofmann Jul 24, 2024
8f7646f
Merge branch 'main' into a_star_pr
simon1hofmann Jul 24, 2024
2d7e27f
fix typos
simon1hofmann Jul 24, 2024
24ef20d
100% test coverage
simon1hofmann Jul 24, 2024
552aa83
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Jul 24, 2024
d63beaf
progress bars
simon1hofmann Jul 30, 2024
55c7a0b
Merge remote-tracking branch 'origin/a_star_pr' into a_star_pr
simon1hofmann Jul 30, 2024
e3f79d8
Merge branch 'main' into a_star_pr
simon1hofmann Jul 30, 2024
098dbb2
:art: Display the default parameter value for `--num_vertex_expansion…
marcelwa Aug 7, 2024
c5bd548
Apply suggestions from code review
simon1hofmann Aug 9, 2024
7cc4f6a
small adjustments
simon1hofmann Aug 9, 2024
930b3ff
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Aug 9, 2024
fbcabf9
Merge branch 'main' into a_star_pr
simon1hofmann Aug 9, 2024
3b12c43
:memo: Update pyfiction docstrings
actions-user Aug 9, 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
162 changes: 162 additions & 0 deletions bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,53 @@ static const char *__doc_fiction_a_star_params_crossings =
R"doc(Allow paths to cross over obstructed tiles if they are occupied by
wire segments.)doc";

static const char *__doc_fiction_a_star_pr =
R"doc(Executes the A* P&R algorithm for the given network and returns the
resulting layout.

Template parameter ``Lyt``:
Cartesian gate-level layout type.

Template parameter ``Ntk``:
Network type.

Parameter ``ntk``:
The network to be placed and routed.

Parameter ``ps``:
The parameters for the A* priority routing algorithm. Defaults to
an empty parameter set.

Parameter ``pst``:
A pointer to a statistics object to record execution details.
Defaults to nullptr.

Returns:
The resulting layout after applying the A* priority routing
algorithm.

Throws:
high_degree_fanin_exception If the network has nodes with a fanin
degree higher than 2.)doc";

static const char *__doc_fiction_a_star_pr_params = R"doc(Parameters for the A* P&R algorithm.)doc";

static const char *__doc_fiction_a_star_pr_params_high_effort = R"doc(High effort mode.)doc";

static const char *__doc_fiction_a_star_pr_params_timeout = R"doc(Timeout limit.)doc";

static const char *__doc_fiction_a_star_pr_params_verbose = R"doc(Verbosity.)doc";

static const char *__doc_fiction_a_star_pr_stats = R"doc(This struct stores statistics about the A* P&R process.)doc";

static const char *__doc_fiction_a_star_pr_stats_duration = R"doc(Runtime of the A* P&R process.)doc";

static const char *__doc_fiction_a_star_pr_stats_report =
R"doc(Reports the statistics to the given output stream.

Parameter ``out``:
Output stream.)doc";

static const char *__doc_fiction_all_coordinates_in_spanned_area =
R"doc(Generates a vector of all coordinates within an area spanned by two
coordinates.
Expand Down Expand Up @@ -5691,6 +5738,23 @@ static const char *__doc_fiction_detail_maximum_defect_influence_position_and_di

static const char *__doc_fiction_detail_maximum_defect_influence_position_and_distance_impl_run = R"doc()doc";

static const char *__doc_fiction_detail_nested_vector_hash =
R"doc(This struct defines a hash function for a nested vector of layout
tiles. It calculates a combined hash value for a vector of tiles based
on the coordinates of each tile.

Template parameter ``Lyt``:
Cartesian gate-level layout type.)doc";

static const char *__doc_fiction_detail_nested_vector_hash_operator_call =
R"doc(Computes a hash value for a vector of `fiction::tile` objects.

Parameter ``vec``:
The vector of tiles to be hashed.

Returns:
A combined hash value for the vector of tiles.)doc";

static const char *__doc_fiction_detail_network_balancing_impl = R"doc()doc";

static const char *__doc_fiction_detail_network_balancing_impl_network_balancing_impl = R"doc()doc";
Expand Down Expand Up @@ -6058,6 +6122,38 @@ static const char *__doc_fiction_detail_post_layout_optimization_impl_pst = R"do

static const char *__doc_fiction_detail_post_layout_optimization_impl_run = R"doc()doc";

static const char *__doc_fiction_detail_priority_queue =
R"doc(A priority queue class for managing elements with associated
priorities. The elements are stored in a priority queue, with the
highest priority elements being retrieved first.

Template parameter ``Lyt``:
Cartesian gate-level layout type.)doc";

static const char *__doc_fiction_detail_priority_queue_counter = R"doc()doc";

static const char *__doc_fiction_detail_priority_queue_empty =
R"doc(Checks if the priority queue is empty.

Returns:
True if the priority queue is empty, false otherwise.)doc";

static const char *__doc_fiction_detail_priority_queue_get =
R"doc(Retrieves and removes the element with the highest priority from the
queue.

Returns:
The element with the highest priority.)doc";

static const char *__doc_fiction_detail_priority_queue_put =
R"doc(Adds an element to the priority queue with a given priority.

Parameter ``item``:
The element to be added.

Parameter ``priority``:
The priority of the element.)doc";

static const char *__doc_fiction_detail_qca_energy_dissipation_impl = R"doc()doc";

static const char *__doc_fiction_detail_qca_energy_dissipation_impl_lyt = R"doc()doc";
Expand Down Expand Up @@ -15006,6 +15102,72 @@ seconds.)doc";

static const char *__doc_fiction_time_to_solution_stats_time_to_solution = R"doc(Time-to-solution in seconds.)doc";

static const char *__doc_fiction_topo_view_ci_to_co = R"doc()doc";

static const char *__doc_fiction_topo_view_ci_to_co_2 = R"doc()doc";

static const char *__doc_fiction_topo_view_ci_to_co_3 = R"doc()doc";

static const char *__doc_fiction_topo_view_ci_to_co_create_topo_rec = R"doc()doc";

static const char *__doc_fiction_topo_view_ci_to_co_foreach_gate = R"doc(! Reimplementation of `foreach_gate`. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_foreach_gate_reverse = R"doc(! Implementation of `foreach_gate` in reverse topological order. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_foreach_node = R"doc(! Reimplementation of `foreach_node`. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_foreach_node_reverse = R"doc(! Implementation of `foreach_node` in reverse topological order. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_index_to_node = R"doc(! Reimplementation of `index_to_node`. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_node_to_index = R"doc(! Reimplementation of `node_to_index`. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_num_gates = R"doc(! Reimplementation of `num_gates`. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_size = R"doc(! Reimplementation of `size`. */)doc";

static const char *__doc_fiction_topo_view_ci_to_co_topo_order = R"doc()doc";

static const char *__doc_fiction_topo_view_ci_to_co_topo_view_ci_to_co =
R"doc(! Default constructor.

Constructs topological view on another network.)doc";

static const char *__doc_fiction_topo_view_ci_to_co_update_topo = R"doc()doc";

static const char *__doc_fiction_topo_view_co_to_ci = R"doc()doc";

static const char *__doc_fiction_topo_view_co_to_ci_2 = R"doc()doc";

static const char *__doc_fiction_topo_view_co_to_ci_3 = R"doc()doc";

static const char *__doc_fiction_topo_view_co_to_ci_create_topo_rec = R"doc()doc";

static const char *__doc_fiction_topo_view_co_to_ci_foreach_gate = R"doc(! Reimplementation of `foreach_gate`. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_foreach_gate_reverse = R"doc(! Implementation of `foreach_gate` in reverse topological order. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_foreach_node = R"doc(! Reimplementation of `foreach_node`. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_foreach_node_reverse = R"doc(! Implementation of `foreach_node` in reverse topological order. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_index_to_node = R"doc(! Reimplementation of `index_to_node`. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_node_to_index = R"doc(! Reimplementation of `node_to_index`. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_num_gates = R"doc(! Reimplementation of `num_gates`. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_size = R"doc(! Reimplementation of `size`. */)doc";

static const char *__doc_fiction_topo_view_co_to_ci_topo_order = R"doc()doc";

static const char *__doc_fiction_topo_view_co_to_ci_topo_view_co_to_ci =
R"doc(! Default constructor.

Constructs topological view on another network.)doc";

static const char *__doc_fiction_topo_view_co_to_ci_update_topo = R"doc()doc";

static const char *__doc_fiction_transition_type =
R"doc(Possible types of charge transitions that can occur in an SiDB layout.
These transitions represent changes in the charge state of SiDBs,
Expand Down
102 changes: 102 additions & 0 deletions experiments/a_star_pr/a_star_pr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//
// Created by Simon Hofmann on 30.01.24.
//
#include "fiction_experiments.hpp"

#include <fiction/algorithms/physical_design/a_star_pr.hpp> // wiring reduction algorithm
#include <fiction/algorithms/physical_design/orthogonal.hpp>
#include <fiction/algorithms/properties/critical_path_length_and_throughput.hpp> // critical path and throughput calculations
#include <fiction/algorithms/verification/equivalence_checking.hpp> // SAT-based equivalence checking
#include <fiction/io/network_reader.hpp> // read networks from files
#include <fiction/layouts/bounding_box.hpp>
#include <fiction/layouts/cartesian_layout.hpp>
#include <fiction/layouts/clocked_layout.hpp>
#include <fiction/layouts/gate_level_layout.hpp>
#include <fiction/layouts/tile_based_layout.hpp>
#include <fiction/networks/technology_network.hpp>

#include <fmt/format.h> // output formatting

#include <chrono>
#include <cstdlib>
#include <string>

template <typename Ntk>
Ntk read_ntk(const std::string& name)
{
fmt::print("[i] processing {}\n", name);

std::ostringstream os{};
fiction::network_reader<fiction::tec_ptr> reader{fiction_experiments::benchmark_path(name), os};
const auto nets = reader.get_networks();
const auto network = *nets.front();

return network;
}

int main() // NOLINT
{
using gate_lyt =
fiction::gate_level_layout<fiction::clocked_layout<fiction::tile_based_layout<fiction::cartesian_layout<>>>>;

experiments::experiment<std::string, uint32_t, uint32_t, uint32_t, uint64_t, uint64_t, uint64_t, uint32_t, uint32_t,
uint64_t, uint64_t, double, std::string>
a_star_pr_exp{"a_star_pr_exp",
"benchmark",
"inputs",
"outputs",
"initial nodes",
"layout width (in tiles)",
"layout height (in tiles)",
"layout area (in tiles)",
"gates",
"wires",
"critical path",
"throughput",
"runtime a_star_pr (in sec)",
"equivalent"};

fiction::a_star_pr_stats a_star_pr_stats{};
fiction::a_star_pr_params a_star_pr_params{};
a_star_pr_params.high_effort = true;
a_star_pr_params.verbose = true;
a_star_pr_params.timeout = 1000;

static constexpr const uint64_t bench_select = fiction_experiments::xor5_maj;

for (const auto& benchmark : fiction_experiments::all_benchmarks(bench_select))
{
auto network = read_ntk<fiction::tec_nt>(benchmark);

auto gate_level_layout =
fiction::a_star_pr<gate_lyt, fiction::tec_nt>(network, a_star_pr_params, &a_star_pr_stats);

// compute critical path and throughput
const auto cp_tp = fiction::critical_path_length_and_throughput(gate_level_layout);

// check equivalence
const auto eq_stats =
fiction::equivalence_checking<fiction::technology_network, gate_lyt>(network, gate_level_layout);

const std::string eq_result = eq_stats == fiction::eq_type::STRONG ? "STRONG" :
eq_stats == fiction::eq_type::WEAK ? "WEAK" :
"NO";

// calculate bounding box
const auto bounding_box = fiction::bounding_box_2d(gate_level_layout);

const auto width = bounding_box.get_x_size() + 1;
const auto height = bounding_box.get_y_size() + 1;
const auto area = width * height;

// log results
a_star_pr_exp(benchmark, network.num_pis(), network.num_pos(), network.num_gates(), width, height, area,
gate_level_layout.num_gates(), gate_level_layout.num_wires(), cp_tp.critical_path_length,
cp_tp.throughput, mockturtle::to_seconds(a_star_pr_stats.time_total), eq_result);

a_star_pr_exp.save();
a_star_pr_exp.table();
}

return EXIT_SUCCESS;
}
Loading
Loading