-
Notifications
You must be signed in to change notification settings - Fork 25
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
🎨 Improved usability of the on-the-fly SiDB gate library #634
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: GitHub Actions <actions@github.com>
Signed-off-by: GitHub Actions <actions@github.com>
Signed-off-by: GitHub Actions <actions@github.com>
# Conflicts: # bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
Signed-off-by: GitHub Actions <actions@github.com>
… into make_on_the_fly_more_accessible
… into make_on_the_fly_more_accessible
Signed-off-by: GitHub Actions <actions@github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (73.44%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #634 +/- ##
==========================================
- Coverage 98.14% 97.80% -0.35%
==========================================
Files 245 247 +2
Lines 37235 37844 +609
Branches 1805 1866 +61
==========================================
+ Hits 36546 37015 +469
- Misses 688 829 +141
+ Partials 1 0 -1
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -146,7 +166,7 @@ | |||
* @return Bestagon gate representation of `t` including mirroring. | |||
*/ | |||
template <typename GateLyt, typename CellLyt, typename Params> | |||
static fcn_gate set_up_gate(const GateLyt& lyt, const tile<GateLyt>& t, const Params& parameters = Params{}) | |||
static fcn_gate set_up_gate(const GateLyt& lyt, const tile<GateLyt>& t, const Params& params) |
Check warning
Code scanning / CodeQL
Poorly documented large function Warning
I know the coverage is still quite low, @marcelwa. Would it be possible to get some feedback on the structure before I increase the coverage? I would love to hear your feedback as I am curious to hear if there is a better way for the implementation. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for giving me the opportunity to review this PR early. I have a few suggestions here and there. Also, some questions remained from simply reading the code. Would be cool if we could discuss 🙂
@@ -258,7 +254,7 @@ template <typename CellLyt, typename GateLibrary, typename GateLyt> | |||
* @return A cell-level layout that implements `lyt`'s gate types with building blocks defined in `GateLibrary`. | |||
*/ | |||
template <typename CellLyt, typename GateLibrary, typename GateLyt, typename Params> | |||
[[nodiscard]] CellLyt apply_parameterized_gate_library(const GateLyt& lyt, const Params& params) | |||
CellLyt apply_parameterized_gate_library(const GateLyt& lyt, const Params& params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case would this function's return type not be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case the parameterized gate library does not terminate with a cell-level layout but throws an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I understand this correctly. The case you're talking about seems to be the one against noexcept
. If a function may throw an exception, it can't be noexcept
. However, if every single call to this function always assigns the return value to a variable, it should be [[nodiscard]]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right! I was not precise enough. If I remember correctly, I think I changed it since I got compiler warnings here:
CHECK_THROWS(apply_parameterized_gate_library<cell_lyt, sidb_on_the_fly_gate_library, hex_even_row_gate_clk_lyt>(layout, params));
However, I think this could also be solved by using (void)
, right?
include/fiction/algorithms/physical_design/on_the_fly_sidb_circuit_design.hpp
Outdated
Show resolved
Hide resolved
include/fiction/algorithms/physical_design/on_the_fly_sidb_circuit_design.hpp
Outdated
Show resolved
Hide resolved
include/fiction/algorithms/physical_design/on_the_fly_sidb_circuit_design.hpp
Outdated
Show resolved
Hide resolved
include/fiction/algorithms/physical_design/on_the_fly_sidb_circuit_design.hpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what is on_the_fly_but_predefined
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we use the sidb_on_the_fly_gate_library
, we have the option if all gates are designed on-the-fly, or if for complex gates aka double wire, cx, ha, predefined ones are tried to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can gladly rename it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hear "predefined" and "on-the-fly" are contradictory then? In this case, the file could be called simply predefined_double_wire.sqd
. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the naming you suggested is indeed sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you okay with on_the_fly_with_predefined_double_wire
?
...l_design_with_on_the_fly_gate_design/on_the_fly_sidb_circuit_design_on_defective_surface.cpp
Outdated
Show resolved
Hide resolved
template <typename GateLyt, typename CellLyt, typename Params> | ||
static fcn_gate set_up_gate(const GateLyt& lyt, const tile<GateLyt>& t, const Params& parameters = Params{}) | ||
static fcn_gate set_up_gate(const GateLyt& lyt, const tile<GateLyt>& t, const Params& params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really long function. Can it be broken down meaningfully?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I know, and I am not a big fan of long functions either. However, I don't see a reasonable way to split it up. We could put everything inside if (lyt.is_buf(n))
into another function, but then the question arises, why exactly for this one?
Signed-off-by: GitHub Actions <actions@github.com>
… into make_on_the_fly_more_accessible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
|
||
#include "fiction/algorithms/physical_design/apply_gate_library.hpp" | ||
#include "fiction/algorithms/physical_design/exact.hpp" | ||
#include "fiction/technology/cell_ports.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header exact.hpp is not used directly [misc-include-cleaner]
#include "fiction/technology/cell_ports.hpp" | |
#include "fiction/technology/cell_ports.hpp" |
/** | ||
* Parameters for the *exact* placement and routing algorithm. | ||
*/ | ||
exact_physical_design_params exact_design_parameters = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: unknown type name 'exact_physical_design_params' [clang-diagnostic-error]
exact_physical_design_params exact_design_parameters = {};
^
/** | ||
* The `stats` of the *exact* algorithm. | ||
*/ | ||
exact_physical_design_stats exact_stats{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: unknown type name 'exact_physical_design_stats' [clang-diagnostic-error]
exact_physical_design_stats exact_stats{};
^
|
||
on_the_fly_circuit_design_on_defective_surface_stats<GateLyt> st{}; | ||
|
||
exact_physical_design_stats exact_stats{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: unknown type name 'exact_physical_design_stats' [clang-diagnostic-error]
exact_physical_design_stats exact_stats{};
^
{ | ||
// P&R with *exact* and the pre-determined blacklist | ||
gate_level_layout = | ||
exact_with_blacklist<GateLyt>(ntk, black_list, params.exact_design_parameters, &exact_stats); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension [clang-diagnostic-c++20-extensions]
exact_with_blacklist<GateLyt>(ntk, black_list, params.exact_design_parameters, &exact_stats);
^
Description
This PR improves the usability of the on-the-fly SiDB gate library. Additionally, several bugs have been fixed.
Checklist: