Skip to content

Commit

Permalink
Merge branch 'main' into quickcell
Browse files Browse the repository at this point in the history
  • Loading branch information
Drewniok authored Oct 8, 2024
2 parents 24baaaa + 2420ac8 commit 1f46e34
Show file tree
Hide file tree
Showing 25 changed files with 361 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pyfiction-pypi-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
run: echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV

- name: Build wheel
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.21.2
env:
CIBW_BEFORE_ALL_LINUX: /opt/python/cp39-cp39/bin/pip install z3-solver==${{ env.Z3_VERSION }}
CIBW_BUILD: ${{ matrix.python }}-*
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exclude: "^libs/|^benchmarks/|bindings/pyfiction/include/pyfiction/pybind11_mkdo
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -46,7 +46,7 @@ repos:

# clang-format the C++ part of the code base
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
rev: v19.1.1
hooks:
- id: clang-format
types_or: [ c++, c ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ inline void graph_oriented_layout_design(pybind11::module& m)
DOC(fiction_graph_oriented_layout_design_params_return_first))
.def_readwrite("planar", &fiction::graph_oriented_layout_design_params::planar,
DOC(fiction_graph_oriented_layout_design_params_planar))

;
.def_readwrite("enable_multithreading", &fiction::graph_oriented_layout_design_params::enable_multithreading,
DOC(fiction_graph_oriented_layout_design_params_enable_multithreading));

py::class_<fiction::graph_oriented_layout_design_stats>(m, "graph_oriented_layout_design_stats",
DOC(fiction_graph_oriented_layout_design_stats))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ void logic_simulation(pybind11::module& m, const std::string& type_name)
const auto store_po_names = [&po_names](const NtkOrLyt& ntk_or_lyt)
{
ntk_or_lyt.foreach_po(
[&ntk_or_lyt, &po_names]([[maybe_unused]] const auto& po, auto i) {
[&ntk_or_lyt, &po_names]([[maybe_unused]] const auto& po, auto i)
{
po_names.emplace_back(ntk_or_lyt.has_output_name(i) ? ntk_or_lyt.get_output_name(i) :
fmt::format("po{}", i));
});
Expand Down
32 changes: 30 additions & 2 deletions bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6623,8 +6623,6 @@ static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_max_pl

static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_ntk = R"doc(The network to be placed and routed.)doc";

static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_num_evaluated_paths = R"doc(Count evaluated paths in the search space graphs.)doc";

static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_num_search_space_graphs = R"doc(Number of search space graphs.)doc";

static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_num_search_space_graphs_high_efficiency = R"doc(In high-efficiency mode, only 2 search space graphs are used)doc";
Expand Down Expand Up @@ -6729,6 +6727,14 @@ static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_start

static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_timeout = R"doc(Timeout limit (in ms).)doc";

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

static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_update_stats =
R"doc(This function updates statistical metrics.

Parameter ``best_lyt``:
The new best layout found.)doc";

static const char *__doc_fiction_detail_graph_oriented_layout_design_impl_valid_layout =
R"doc(Validates the given layout based on the nodes in the network and their
mappings in the node dictionary. It checks if the placement of nodes
Expand Down Expand Up @@ -11820,6 +11826,28 @@ wider exploration increases the chance of finding optimal layouts but
also extends runtime. When a solution is found in any graph, its cost
is used to prune the remaining graphs.)doc";

static const char *__doc_fiction_graph_oriented_layout_design_params_enable_multithreading =
R"doc(BETA feature: Flag to enable or disable multithreading during the
execution of the layout design algorithm.

When set to `true`, the algorithm will utilize multiple threads to
process different search space graphs in parallel, improving
performance by distributing the workload across available CPU cores.
If set to `false`, the algorithm will run sequentially on a single
thread.

Only recommended for `HIGH_EFFORT` and `HIGHEST_EFFORT` modes and
complex networks (> 100 nodes).

Enabling multithreading can significantly speed up the algorithm,
especially when using multiple search space graphs and dealing with
complex networks, by concurrently expanding them. However, it may
introduce additional overhead for thread synchronization and can
increase memory usage. It is therefore not recommended for small input
networks.

Default value: `false`)doc";

static const char *__doc_fiction_graph_oriented_layout_design_params_mode = R"doc(The effort mode used. Defaults to HIGH_EFFORT.)doc";

static const char *__doc_fiction_graph_oriented_layout_design_params_num_vertex_expansions =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ void charge_distribution_surface_layout(pybind11::module& m, const std::string&
"increase_charge_index_by_one",
[](py_cds& cds, fiction::dependent_cell_mode dependent_cell_fixed,
fiction::energy_calculation recompute_system_energy,
fiction::charge_distribution_history consider_history, fiction::exact_sidb_simulation_engine engine) {
fiction::charge_distribution_history consider_history, fiction::exact_sidb_simulation_engine engine)
{
return cds.increase_charge_index_by_one(dependent_cell_fixed, recompute_system_energy, consider_history,
engine);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_graph_oriented_layout_design_with_different_parameters(self):
params.num_vertex_expansions = 5
params.planar = False
params.cost = gold_cost_objective.WIRES
params.enable_multithreading = False

layout = graph_oriented_layout_design(network, params)

Expand All @@ -76,5 +77,17 @@ def custom_cost_objective(layout):

self.assertNotEqual(equivalence_checking(network, layout), eq_type.NO)

def test_graph_oriented_layout_design_with_multithreading(self):
network = read_technology_network(dir_path + "/../../resources/mux21.v")

params = graph_oriented_layout_design_params()
params.return_first = True
params.mode = gold_effort_mode.HIGH_EFFORT
params.enable_multithreading = True

layout = graph_oriented_layout_design(network, params)

self.assertNotEqual(equivalence_checking(network, layout), eq_type.NO)

if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions cli/cmd/physical_design/gold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class gold_command : public command
add_flag("--return_first,-r", ps.return_first,
"Terminate on the first found layout; reduces runtime but might sacrifice result quality");
add_flag("--planar,-p", ps.planar, "Enable planar layout generation");
add_flag("--multithreading,-m", ps.enable_multithreading, "Enable multithreading (beta feature)");
add_flag("--verbose,-v", ps.verbose, "Be verbose");
}

Expand Down
14 changes: 4 additions & 10 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@ All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_.

Unreleased```
-------------

Added
#####
- Experiments:
- Script to conduct 3-state physical simulation of SiDB layouts.

Unreleased```
-------------
Unreleased
----------

Added
#####
Expand All @@ -23,6 +15,7 @@ Added
- Algorithms:
- Added support for different ways of implementing input information in SiDB technology to the BDL input iterator


v0.6.4 - 2024-08-30
-------------------

Expand All @@ -44,6 +37,7 @@ Fixed
- Fixed several typos and docstrings in the codebase
- Addressed some ``clang-tidy`` warnings


v0.6.3 - 2024-08-22
-------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sphinx==8.0.2
breathe==4.35.0
sphinx-rtd-theme==3.0.0rc1
sphinx-rtd-theme==3.0.0rc4
sphinx-tabs==3.4.5
z3-solver>=4.8.0
12 changes: 8 additions & 4 deletions include/fiction/algorithms/physical_design/exact.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,8 @@ class exact_impl
{
layout.foreach_outgoing_clocked_zone(
t,
[this, &t, &disj, &tgt, &ae](const auto& at) {
[this, &t, &disj, &tgt, &ae](const auto& at)
{
disj.push_back((get_tn(at, tgt) || get_te(at, ae)) &&
get_tc(t, at));
});
Expand Down Expand Up @@ -1180,7 +1181,8 @@ class exact_impl
{
layout.foreach_incoming_clocked_zone(
t,
[this, &t, &disj, &src, &iae](const auto& iat) {
[this, &t, &disj, &src, &iae](const auto& iat)
{
disj.push_back((get_tn(iat, src) || get_te(iat, iae)) &&
get_tc(iat, t));
});
Expand Down Expand Up @@ -1528,7 +1530,8 @@ class exact_impl
else
{
network.foreach_pi(
[this, &restrict_2ddwave_entry_tiles](const auto& pi) {
[this, &restrict_2ddwave_entry_tiles](const auto& pi)
{
network.foreach_fanout(pi, [&restrict_2ddwave_entry_tiles](const auto& fn)
{ restrict_2ddwave_entry_tiles(fn); });
});
Expand All @@ -1549,7 +1552,8 @@ class exact_impl
else
{
network.foreach_po(
[this, &define_length](const auto& po) {
[this, &define_length](const auto& po)
{
network.foreach_fanin(po, [this, &define_length](const auto& fi)
{ define_length(network.get_node(fi)); });
});
Expand Down
Loading

0 comments on commit 1f46e34

Please sign in to comment.