GithubHelp home page GithubHelp logo

Comments (11)

jeking3 avatar jeking3 commented on July 19, 2024

cc: @Izaron

from dynamic_bitset.

jeking3 avatar jeking3 commented on July 19, 2024

cc: @Izaron

from dynamic_bitset.

glenfe avatar glenfe commented on July 19, 2024

What is the plan if the user being CC'd doesn't respond by 1.70 deadlines? Is the change that was committed going to be reverted for 1.70?

from dynamic_bitset.

jeking3 avatar jeking3 commented on July 19, 2024

That's the easiest thing to do, unless someone else steps up to resolve it.

from dynamic_bitset.

pdimov avatar pdimov commented on July 19, 2024

James, since you committed the PR, it's your responsibility to deal with the regression/crash, one way or another. (The gcc __builtin_popcount path is fine, but the msvc-specific section isn't, so there are options, but something must be done.)

from dynamic_bitset.

jeking3 avatar jeking3 commented on July 19, 2024

Okay, thanks.

from dynamic_bitset.

jeking3 avatar jeking3 commented on July 19, 2024

@pdimov what would your preference be to resolve this:

  1. Disable the MSVC code (easiest).
  2. Add a definition such as BOOST_DYNAMIC_BITSET_HAVE_SSE4 that folks must define in order to enable the code (also easy, requires documentation). Of course, this means they know their code will always run on a modern CPU so it's their choice.
  3. Add static cpuid inspection (ideally C++11 only, so it is threadsafe) and fall back when not present (more difficult, may not have time to do...).

Right now I would opt for one of the first two, which makes the library no worse than it was in 1.68.0 for MSVC. It's unfortunate the original author @Izaron hasn't responded or taken action. For now we could do (1) and then open an issue for (3).

from dynamic_bitset.

glenfe avatar glenfe commented on July 19, 2024

I suggest #2 and document it accordingly: i.e. The opt-in macro would only affect MSVC; for GCC and Clang using __builtin_popcount unconditionally is fine. (#1 is also acceptable if you don't want to do #2).

from dynamic_bitset.

pdimov avatar pdimov commented on July 19, 2024

(1) is fine if we don't want to invest too much time into it.

On the surface silently doing the right thing, as in (3), is better than (2), but I'm not sure if the two tests - on the static guard variable and on the actual static variable - would not defeat the gains from using the popcnt instruction.

There is also the option of using an alternate popcount algorithm - the one used by gcc/clang for implementing the builtin when SSE4 isn't available, https://godbolt.org/z/VGP6Z_, https://en.wikipedia.org/wiki/Hamming_weight. This will need to be benchmarked if we choose to use it (on MSVC or in general).

from dynamic_bitset.

jeking3 avatar jeking3 commented on July 19, 2024

I was looking at https://github.com/kimwalisch/libpopcnt/ as there is an implementation in there as well, but I haven't done anything else but look. Benchmarks exist there for the decisions that were made to use different algorithms depending on the size of the bitset.

from dynamic_bitset.

pdimov avatar pdimov commented on July 19, 2024

FWIW, std::bitset on MSVC uses the same 8 bit table-based implementation as dynamic_bitset: https://godbolt.org/z/YuQqIj

This probably means that it was judged optimal there in the absence of hardware popcnt.

from dynamic_bitset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.