Виправити помилку у використанні SIMD (SSE i AVX) C++
11 USDКод весь написаний, треба тільки у двох методах виправлення зробити: який рахує за допомогою SSE, який рахує за допомогою AVX.
Є імплементація алгоритму на чистому CPU, яка працює правильно (це метод computeConvolutionOutputCPU).
Сам алгоритм наступний:
Помилка вже також відома, про неї написали на stackoverflow наступні два коментарі з розбором проблеми і навіть вирішенням!!!
1) "*(pInputSignal + i - j) is incorrect in case of SSE, because it's not an i-j offset away from current value, it's (i-j) * 4 . THe thing is, as I remember it, the idea of using pointer that way is incorrect unless intrinsics had changed since then - in my time one had to "load" values into an instance of __m128 in this case, as H(J) and X(I-J) are in unaligned location (and sequence breaks). "
2) "Since you care about individual floats and their order, probably best to use const float*, with _mm_loadu_ps instead of just dereferencing (which is like _mm_load_ps). That way you can easily do unaligned loads that get the floats you want into the vector element positions you want, and the pointer math works the same as for scalar. You just have to take into account that load(ptr) actually gets you a vector of elements from ptr+0..3."
Необхідно виправити помилки, а саме правильно реалізувати адресацію елементів (вони ідентичні - тобто якщо напишете правильно в одному, то інший аналогічно робиться) в методах computeConvolutionOutputSSE і computeConvolutionOutputAVX
Після запуску коду в результаті останньої перевірки на рівність трьох файлів (від CPU, від SSE, від AVX) має виявитись, що вони всі рівні (даний метод вже написаний), ну і відповідно має вийти так, що SSE є рахує в рази швидше, ніж CPU, a AVX - в рази швидше від SSE. (воно так зараз і є, але результати неправильні).
Applications 1
Current freelance projects in the category C & C++
Reverse engineering of console utilities for querying SSD controllers (Flash ID)1. Purpose of the work Extraction of the application programming interface (API) for interaction with SSD/NVMe controllers from the provided set of console utilities (Phison, Silicon Motion, Realtek, Maxiotek, Marvell, JMicron, etc.). The result should be working code in C/C++… C & C++, Desktop Apps ∙ 12 days 6 hours back ∙ 6 proposals |
Development of a Minecraft Java Seed Map / Seed Viewer for the websiteDevelopment of Minecraft Java Seed Map / Seed Viewer for the websiteProject Description A browser-based tool Minecraft Java Seed Map / Seed Viewer needs to be developed, which will work on our website and allow the user to enter a seed from Minecraft Java Edition and view an… C & C++, HTML & CSS ∙ 12 days 13 hours back ∙ 17 proposals |

