[PATCH][libstdc++-v3 parallel mode] PR 42712 search_n serial fallbacks

Johannes Singler singler@kit.edu
Tue Jan 19 10:25:00 GMT 2010


Paolo Carlini wrote:
> On 01/18/2010 03:11 PM, Paolo Carlini wrote:
>> If I understand correctly what you are doing here, adding the new data
>> member at the *end* of the existing ones should minimize the possible
>> problems: I think the only existing applications that could break are
>> those using sizeof(_Settings), which seems really unlikely to me. Then I
>> would consider the trade-off vs parallel-mode stability certainly
>> acceptable. What do you think?
>>   
> Well, of course I would suggest you conducting a few little experiments:
> preparing a snippet of code running search_n and a couple other
> algorithms (among those reading the _Settings data members close to the
> one you are adding), compile it pre-patch and keep the binary around.
> Then installing the patch, installing the new library, linking the old
> binary vs the new library and running it. My hope is that with the new
> member at the end, everything should be still fine...

I tested it using dynamic linking.  The thing breaks when inserting
search_minimal_n somewhere inbetween, wrong values are read out of
_Settings.  Everything stays as is when adding search_minimal_n to the end.

Find the updated patch attached.

2010-01-19  Johannes Singler  <singler@kit.edu>

        PR libstdc++/42712
        * include/parallel/settings.h (_Settings): Add search_minimal_n.
        * include/parallel/algo.h (__search_switch):
        Add serial fallback for too small inputs.
        (__search_n_switch): Likewise.  Call serial fallback on higher
        level to gain special treatment for __count 0 or 1.
        * testsuite/25_algorithms/search_n/iterator.cc:
        Reenable full test depth for parallel mode.

Johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: search_n_fallbacks.patch
Type: text/x-patch
Size: 4023 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20100119/cfa3080b/attachment.bin>


More information about the Libstdc++ mailing list