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

✨ Add SyReC synthesis with Additional Lines #65

Merged
merged 14 commits into from
Sep 5, 2022

Conversation

SmaranTum
Copy link
Contributor

@SmaranTum SmaranTum commented Aug 24, 2022

This PR implements the original SyReC synthesis approach using additional lines. The syrec-editor GUI is updated accordingly.

…syrec.cpp/hpp)

Included the corresponding python bindings (bindings.cpp)

Added the corresponding tests (test_add_lines_synthesis.cpp, test_add_lines_simulation)

Included corresponding json files required for testing purpose (circuit_simulation_add_lines.cpp, circuit_synthesis_add_lines.cpp)

Included the corresponding python tests (test_syrec.cpp)

Made necessary minor changes to the respective cmake files.
@codecov
Copy link

codecov bot commented Aug 24, 2022

Codecov Report

Merging #65 (acbd748) into main (f898102) will decrease coverage by 0.2%.
The diff coverage is 94.9%.

@@           Coverage Diff           @@
##            main     #65     +/-   ##
=======================================
- Coverage   91.5%   91.2%   -0.3%     
=======================================
  Files         25      29      +4     
  Lines       1789    1825     +36     
=======================================
+ Hits        1638    1666     +28     
- Misses       151     159      +8     
Impacted Files Coverage Δ
include/core/circuit.hpp 76.1% <ø> (ø)
include/core/gate.hpp 20.0% <ø> (ø)
include/core/properties.hpp 50.0% <ø> (ø)
include/core/syrec/expression.hpp 100.0% <ø> (ø)
include/core/syrec/grammar.hpp 95.8% <ø> (ø)
include/core/syrec/module.hpp 90.9% <ø> (ø)
include/core/syrec/number.hpp 75.0% <ø> (ø)
include/core/syrec/parser.hpp 100.0% <ø> (ø)
include/core/syrec/program.hpp 100.0% <ø> (ø)
include/core/syrec/statement.hpp 95.3% <ø> (ø)
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just quickly went over all the changes here and as of now, this is not ready to be merged.
Please avoid code duplication at (almost) all cost. This tiny PR alone adds 1.8K lines of code to the repository of which most are duplicate code. For details, see the comments below.

include/algorithms/synthesis/syrec_synthesis.hpp Outdated Show resolved Hide resolved
mqt/syrec/bindings.cpp Outdated Show resolved Hide resolved
mqt/syrec/syrec_editor.py Outdated Show resolved Hide resolved
src/algorithms/synthesis/syrec_synthesis.cpp Outdated Show resolved Hide resolved
test/unittests/test_simulation.cpp Outdated Show resolved Hide resolved
mqt/syrec/syrec_editor.py Outdated Show resolved Hide resolved
mqt/syrec/syrec_editor.py Outdated Show resolved Hide resolved
mqt/syrec/syrec_editor.py Outdated Show resolved Hide resolved
mqt/syrec/syrec_editor.py Outdated Show resolved Hide resolved
mqt/syrec/syrec_editor.py Outdated Show resolved Hide resolved
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much better already! Thanks.
Still, i believe there is room for improvement and some easily avoidable code duplication remains. You can find the detailed comments below.

include/algorithms/synthesis/syrec_synthesis.hpp Outdated Show resolved Hide resolved
include/algorithms/synthesis/syrec_synthesis.hpp Outdated Show resolved Hide resolved
include/algorithms/synthesis/syrec_synthesis.hpp Outdated Show resolved Hide resolved
include/algorithms/synthesis/syrec_synthesis.hpp Outdated Show resolved Hide resolved
include/algorithms/synthesis/syrec_synthesis.hpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/syrec_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/syrec_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/syrec_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/syrec_synthesis.cpp Outdated Show resolved Hide resolved
mqt/syrec/syrec_editor.py Outdated Show resolved Hide resolved
@SmaranTum SmaranTum requested a review from burgholzer September 3, 2022 11:21
Signed-off-by: Lukas Burgholzer <lukas.burgholzer@jku.at>
Signed-off-by: Lukas Burgholzer <lukas.burgholzer@jku.at>
Signed-off-by: Lukas Burgholzer <lukas.burgholzer@jku.at>
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last round of changes didn't go the direction I would have hoped. In particular

  • it hardly reduced code duplication
  • it did not split up the individual classes
  • it introduced different names for the same functions.

What I had in mind, was proper object oriented programming. I just pushed some commits that refactor the relevant classes in order to reduce the code duplication as much as possible.
Note how the additional lines synthesiser only defines 4 functions and that is it. Everything can be handled is handled in the base class.
This was made possible by just 1-2 small changes in some functions.
Overall the refactoring reduced the additional lines in this PR by roughly 300 lines.

All tests still pass. But please make sure that everything besides that still works as intended.

@SmaranTum
Copy link
Contributor Author

The last round of changes didn't go the direction I would have hoped. In particular

* it hardly reduced code duplication

* it did not split up the individual classes

* it introduced different names for the same functions.

What I had in mind, was proper object oriented programming. I just pushed some commits that refactor the relevant classes in order to reduce the code duplication as much as possible. Note how the additional lines synthesiser only defines 4 functions and that is it. Everything can be handled is handled in the base class. This was made possible by just 1-2 small changes in some functions. Overall the refactoring reduced the additional lines in this PR by roughly 300 lines.

All tests still pass. But please make sure that everything besides that still works as intended.

Thank you very much for this. I didn't know that I had to do this. Again, learnt a lot from this

@burgholzer
Copy link
Member

I just resolved all the conflicts so that CI starts properly.

@SmaranTum
Copy link
Contributor Author

Don't know why the CI is failing?

@burgholzer
Copy link
Member

Don't know why the CI is failing?

Seems to just be a sporadic failure. The upload of the codecov report sometimes fails for whatever reason. Usually a restart of the job is enough to fix this.

@SmaranTum SmaranTum requested a review from burgholzer September 5, 2022 15:40
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also looks great now. I'll again update the PR title and description and then merge the PR once CI passes.

Small side note: once this is merged, please wait a bit before creating the next PR. I am planning on introducing some more code quality features and improve some aspects of the python packaging during the rest of the day. I'll keep you posted (and you'll probably see the PRs)

@SmaranTum
Copy link
Contributor Author

This also looks great now. I'll again update the PR title and description and then merge the PR once CI passes.

Small side note: once this is merged, please wait a bit before creating the next PR. I am planning on introducing some more code quality features and improve some aspects of the python packaging during the rest of the day. I'll keep you posted (and you'll probably see the PRs)

This also looks great now. I'll again update the PR title and description and then merge the PR once CI passes.

Small side note: once this is merged, please wait a bit before creating the next PR. I am planning on introducing some more code quality features and improve some aspects of the python packaging during the rest of the day. I'll keep you posted (and you'll probably see the PRs)

I have already created the dd synthesis PR. is that going to be an issue?

@burgholzer burgholzer changed the title Included the original syrec functionality with additional lines ✨ Add SyReC synthesis with Additional Lines Sep 5, 2022
@burgholzer burgholzer added the feature New feature or request label Sep 5, 2022
@burgholzer burgholzer enabled auto-merge (squash) September 5, 2022 15:44
@burgholzer
Copy link
Member

This also looks great now. I'll again update the PR title and description and then merge the PR once CI passes.
Small side note: once this is merged, please wait a bit before creating the next PR. I am planning on introducing some more code quality features and improve some aspects of the python packaging during the rest of the day. I'll keep you posted (and you'll probably see the PRs)

This also looks great now. I'll again update the PR title and description and then merge the PR once CI passes.
Small side note: once this is merged, please wait a bit before creating the next PR. I am planning on introducing some more code quality features and improve some aspects of the python packaging during the rest of the day. I'll keep you posted (and you'll probably see the PRs)

I have already created the dd synthesis PR. is that going to be an issue?

Most certainly not, but you'll have to deal with the merge conflicts 🙃

@burgholzer burgholzer merged commit f1e591a into cda-tum:main Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants