-
Notifications
You must be signed in to change notification settings - Fork 994
Make SigSpecConstIterator work with packed SigSpecs and use it instead of SigSpec::operator[] const in some places
#5415
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
base: main
Are you sure you want to change the base?
Conversation
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.
The code looks fine and matches what was set out to do, but similarly to #5417 (review) unfortunately there's an overall regresion to jpeg synthesis, but specifically opt_clean regresses by 10% with smaller but still significant hits to opt_expr and opt_dff. The change isn't performance transparent. Again this is with LTO on. The opt_expr and opt_dff regressions are observable on eff68a4 already, which surprises me, since I would have thought that SigSpec::find_chunk is where extra runtime would be coming from
|
I see most the regression happening in the very first commit, which is weird: I think the problem is that that commit switches the passed-in representation of some Another difference is that the new code builds a packed |
|
Taking this off the review queue while I study the problem and investigate alternatives. |
To make this efficient, the iterator keeps `chunk_index_hint` pointing to the current chunk. This is only a hint, since it is not possible to maintain its validity if the `SigSpec` representation is temporarily changed to unpacked. In that case we have to resync using binary search.
Currently we duplicate the `SigSpec` first and then iterate over the duplicate, updating its bits. Instead just generate new bits and add them to an empty `SigSpec`.
This avoids having to unpack.
8d012ee to
acd3cae
Compare
If your work is part of a larger effort, please discuss your general plans on Discourse first to align your vision with maintainers.
See https://yosyshq.discourse.group/t/parallel-optmergepass-implementation/87/10.
What are the reasons/motivation for this change?
SigSpec::operator[] constcurrently switches theSigSpecto the unpacked representation.constmethods that mutate the data make the type unsuitable for read-only sharing across threads, so we'd like to eliminate this. This PR is the start of that work.Explain how this is achieved.
We make
SigSpecConstIteratorwork efficiently with both packed and unpackedSigSpecs. Then we migrate some common in-tree users ofSigSpec::operator[] constto use iterators instead.In future work we will migrate more in-tree users. For the remaining users we will investigate some kind of caching scheme to make
SigSpec::operator[] constreasonably efficient without switching to the unpacked representation.