-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault when calling mipp::load<float>() #22
Comments
Hi @psycha0s, I think it is not normal to have a segfault when calling a |
I tried both, aligned and unaligned loads. Also, I tried to use #include "mipp.h"
int main()
{
auto ptr = mipp::malloc<double>(100);
mipp::load<double>(ptr); // SEGFAULT
return 0;
} I narrowed it down to this: #include "mipp.h"
__m256d load(const double* ptr)
{
return _mm256_load_pd(ptr);
}
int main()
{
auto ptr = mipp::malloc<double>(100);
auto reg = _mm256_load_pd(ptr); // success
reg = load(ptr); // SEGFAULT
return 0;
} As soon as I change my compiler optimisation level to #include "mipp.h"
inline __m256d __attribute__((always_inline)) load(const double* ptr)
{
return _mm256_load_pd(ptr);
}
int main()
{
auto ptr = mipp::malloc<double>(100);
auto reg = _mm256_load_pd(ptr); // success
reg = load(ptr); // success
return 0;
} |
I'm facing a similar problem as well. Here's my simple function: void AddMIPPLLR(std::vector<mippf>& L_d, const std::vector<mippf>& L_s,
const int GFq) {
assert(L_d.size() == GFq / mippN && L_d.size() == GFq / mippN);
for (int i = 0; i < GFq / mippN; i++) {
L_d[i] = mipp::add(L_d[i], L_s[i]);
}
} These lines run well, but as long as I set gcc optimization, the What's more, if I change the line It's interesting that segment fault would only be raised after a few iterators.
|
Hi @Sciroccogti, I think that you can't have a I hope it helps. |
I get a segmentation fault when I call
mipp::load<float>(ptr)
when optimizations are turned off (my GCC flags-O0 -march=skylake
). As far as I can tell, it happens because the body of the function is not inlined. It can be fixed by adding an attribute to all such functions (__attribute__((always_inline))
for GCC and Clang). I'm not sure about MSVS, though. Is it a known issue or maybe I just don't know/understand something? I wouldn't like to completely disable intrinsics for my debug builds. Is there a chance you will add this attribute?The text was updated successfully, but these errors were encountered: