-
Notifications
You must be signed in to change notification settings - Fork 214
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
[WIP] TokenPartitionTree refactoring / "Choice" nodes support #1328
Draft
mglb
wants to merge
13
commits into
chipsalliance:master
Choose a base branch
from
antmicro:mglb/TokenPartitionTreeRefactor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[WIP] TokenPartitionTree refactoring / "Choice" nodes support #1328
mglb
wants to merge
13
commits into
chipsalliance:master
from
antmicro:mglb/TokenPartitionTreeRefactor
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mglb
force-pushed
the
mglb/TokenPartitionTreeRefactor
branch
from
April 30, 2022 16:25
06ae10c
to
7d77d45
Compare
Codecov Report
@@ Coverage Diff @@
## master #1328 +/- ##
==========================================
- Coverage 92.87% 92.69% -0.19%
==========================================
Files 340 341 +1
Lines 23693 24048 +355
==========================================
+ Hits 22006 22292 +286
- Misses 1687 1756 +69
Continue to review full report at Codecov.
|
mglb
force-pushed
the
mglb/TokenPartitionTreeRefactor
branch
from
April 30, 2022 17:15
7d77d45
to
73947e5
Compare
mglb
force-pushed
the
mglb/TokenPartitionTreeRefactor
branch
4 times, most recently
from
May 10, 2022 16:51
818c6b4
to
352d73a
Compare
TODO: - Tests - Documentation - Resolve a few smaller in-code TODOs
TODO: - Documentation
TODO: - Use detectors for clear, erase, insert
TODO: - Extract Choice-related class and code to a separate commit - Documentation - Tests - Cleanup
It doesn't understand non-type template parameters with default value: https://releases.llvm.org/11.1.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.html
mglb
force-pushed
the
mglb/TokenPartitionTreeRefactor
branch
from
May 23, 2022 11:11
352d73a
to
806ba2e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objectives
Design decisions
TokenPartitionTree uses a variant for storing nodes instead of regular polymorphism
Main reason: I wanted to do something that would work without requiring bigger changes in code that uses TokenPartitionTree. Regular polymorphism would change node objects stored in Children list into pointers, which would require a lot of changes at once in the whole codebase.
With the use of a variant there was only one thing that required a change in the whole code base:
Children()
now returns pointer instead of reference, and can return nullptr. This is mostly change of.
into->
.nullptr
is handled mostly through the use ofis_leaf()
instead ofChildren()->empty()
.Minor reason: this will allow linear storage of child nodes in memory. I didn't do any benchmarks, so I can only guess whether this helps much.
Custom Variant implementation
I've implemented Variant class from scratch instead of using
std::variant
.Main reason: I wanted a possibility to "cast" pointer to object stored in variant into a pointer to the Variant holding it. This requires a guarantee that the variant's data member which stores the value is the first member, or at least access to this member in order to use
offsetof
. Neither is provided bystd::variant
.This possibility is used in TokenPartition node implementations (which are stored in a Variant) to "cast"
this
into pointer to Variant, which is then assigned as parent pointer in child nodes.