BLOG_TOXA Telegram 457
SIMD

Я тут узнал (просто случайно), что в C++26 завезли data-parallel types и можно делать так:


void sinuses(std::span<float> data) {
using floatv = std::simd<float>;
auto it = data.begin();
for (; it <= data.end() - floatv::size(); it += floatv::size()) {
// Прочитает сразу floatv::size() чисел, допустим 8
floatv vec(it);

// Сразу для 8 чисел посчитает синус и запишет результат обратно в data
std::sin(vec).copy_to(it);
}
for (; it < data.end(); ++it) {
*it = std::sin(*it);
}
}

[source]

Выглядит как фантастика! Господа плюсовики, есть кто в канале, расскажите, как это работает, пробовали ли уже тыкаться в это? Звучит как очень вкусный сахар!
🔥11👎2🤣1



tgoop.com/blog_toxa/457
Create:
Last Update:

SIMD

Я тут узнал (просто случайно), что в C++26 завезли data-parallel types и можно делать так:


void sinuses(std::span<float> data) {
using floatv = std::simd<float>;
auto it = data.begin();
for (; it <= data.end() - floatv::size(); it += floatv::size()) {
// Прочитает сразу floatv::size() чисел, допустим 8
floatv vec(it);

// Сразу для 8 чисел посчитает синус и запишет результат обратно в data
std::sin(vec).copy_to(it);
}
for (; it < data.end(); ++it) {
*it = std::sin(*it);
}
}

[source]

Выглядит как фантастика! Господа плюсовики, есть кто в канале, расскажите, как это работает, пробовали ли уже тыкаться в это? Звучит как очень вкусный сахар!

BY Дратути Антон


Share with your friend now:
tgoop.com/blog_toxa/457

View MORE
Open in Telegram


Telegram News

Date: |

The main design elements of your Telegram channel include a name, bio (brief description), and avatar. Your bio should be: Commenting about the court's concerns about the spread of false information related to the elections, Minister Fachin noted Brazil is "facing circumstances that could put Brazil's democracy at risk." During the meeting, the information technology secretary at the TSE, Julio Valente, put forward a list of requests the court believes will disinformation. The imprisonment came as Telegram said it was "surprised" by claims that privacy commissioner Ada Chung Lai-ling is seeking to block the messaging app due to doxxing content targeting police and politicians. Ng, who had pleaded not guilty to all charges, had been detained for more than 20 months. His channel was said to have contained around 120 messages and photos that incited others to vandalise pro-government shops and commit criminal damage targeting police stations. ‘Ban’ on Telegram
from us


Telegram Дратути Антон
FROM American