Advanced SIMD Algorithms in Pictures - Denis Yaroshevskiy - Meeting C++ 2023

Ғылым және технология

Advanced SIMD Algorithms in Pictures - Denis Yaroshevskiy - Meeting C++ 2023
Slides: slides.meetingcpp.com
Survey: survey.meetingcpp.com
Consider the difference between explaining the gist of quick-sort and actually writing a production implementation. The first is very quick and can be done in 5 minutes while the second can easily take you months. We will firmly plant ourselves in the first category and look at the basic ideas behind some non-trivial SIMD (i.e. vectorized) algorithms. The plan is to at least cover strcmp, set_intersect and sort but I hope to squize in a few more. The talk does not expect you to know anything but some CS101 algorithms. After the talk, hopefully, SIMD will not seem such a mysterious art.

Пікірлер: 10

  • @denisyaroshevskiy5679
    @denisyaroshevskiy56794 ай бұрын

    Other talks mentioned: My First Simd (there is 2 english recordings and one russian, I prefer this one): kzread.info/dash/bejne/gnyOtLavY8jYnKQ.htmlsi=4oIvMACw0I2JqnTF Eve: simd in c++20 (again a few versions online) kzread.info/dash/bejne/iY57sKWJcrCvnqw.htmlsi=9R0qEoLdhwgFb09_

  • @denisyaroshevskiy5679
    @denisyaroshevskiy56794 ай бұрын

    If you have a question, you can ask me below this comment

  • @DeathKillBot

    @DeathKillBot

    4 ай бұрын

    Why is the predicate omitted from copy_if()?

  • @denisyaroshevskiy5679

    @denisyaroshevskiy5679

    4 ай бұрын

    @@DeathKillBot this is a mistake on the slides. I can't post a link (youtube comments) but the real eve::algo::copy_if accepts a predicate.

  • @yuehuajia3176

    @yuehuajia3176

    4 ай бұрын

    40:06 does the benchmark mean small array size is 5 % to 95 % big array. the big array size is constant? also what the meaning of difference is branch prediction between different percentages ?

  • @denisyaroshevskiy5679

    @denisyaroshevskiy5679

    4 ай бұрын

    @@yuehuajia3176 20'000 bytes - 5'000 int32 - all the data. We split it into 2 vectors. size1 = size_total * percentage / 200; On the left we merge very small vector (5% - 125 with 95% 4'875 i32) On the right we merge equal vectors (100% - 2500 with 2500) 20% of the elements are common. When you set_intersection on the left - there is a branch "is the element from the left?" that's always false. When you set_intersection on the right - it's impossible to predict which way that branch will go. Now that I'm thinking about it, std::set_intersection might do better even further to the right due to how it's written in the standard libary: if __comp(*__first1, *__first2). I should test that. You can find my benchmarking code in unsq_eve repo under my name on github.

  • @denisyaroshevskiy5679

    @denisyaroshevskiy5679

    4 ай бұрын

    @@yuehuajia3176 the previous reply was deleted by some reason. 20'000 bytes total, distributed in 2 arrays. 5% of a 10'000 bytes in the left one. So tiny array with a big array on the left. Equal arrays on the right. Total size doesn't change

  • @snbv5real
    @snbv5real4 ай бұрын

    Why did you use the term "copy_compression" instead of the accepted and taught term "stream compaction"?

  • @denisyaroshevskiy5679

    @denisyaroshevskiy5679

    4 ай бұрын

    I'm not convinced tbh it's accepted and taught, I never saw this one. intel calls the instruction compress. c++ standard calls it compress. Arm calls compact. As far as the word copy compress_copy - this is analogous to std::copy_if, because the interface is following that.

Келесі