Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Illegal Instruction #4

Open
victorstewart opened this issue Mar 15, 2021 · 7 comments
Open

Illegal Instruction #4

victorstewart opened this issue Mar 15, 2021 · 7 comments

Comments

@victorstewart
Copy link

victorstewart commented Mar 15, 2021

incredibly bizzare but I'm getting an illegal instruction thrown on this line in compute_number_of_PD:

size_t res = (std::size_t) ceil(max_number_of_elements / ((double) b));

i think it's something to do with the multiplication into b, since when i try to print b i get the illegal instruction on that line:

double b = max_capacity * l1_load;
std::cout << "b is: "<< b << std::endl;

i tried playing around with it but i'm perplexed!

running on Clear Linux 5.10.19-1032.native

@TheHolyJoker
Copy link
Owner

TheHolyJoker commented Mar 15, 2021

Hey Victor,

I think I had some problems with this function sometime along the way. After running a different target without the optimization flags, the error was more informative.

building

For debugging, you should build and run the target named valid_test.
You can build this target by running the following command from the build directory:

cmake..
cmake --build ./ --target valid_test

You can build the optimized target named Filters by running the following command from the build directory:

cmake..
cmake --build ./ --target Filters

Running

To run a specific target, named myTarget42, run the following command from the build directory:
./myTarget42

Please let me know if it solves the problem.

@victorstewart
Copy link
Author

sorry it took forever to circle back to this. I just tried running both builds, still get the illegal instruction.

@TheHolyJoker
Copy link
Owner

No problem.

Currently, there are no extensive tests on the input to verify it is legal.
Just to make sure we on the same page, you are using the default branch, i.e. minimal, right?

Could you please add the main function you are using?
Which filter version are you trying to use?

If I have to guess, I think it is one of the two following scenarios:

  1. The input to the filter is too small. (let's say less than 1000).
  2. The load is too small. (maybe less than 0.1).

But I might be completely wrong.

@dongdongwcpp
Copy link

Illegal instruction is here ,the x is too big for __builtin_log2

#0  ceil_log2<unsigned long> (x=140737488348848) at /root/Comparing_Filters/PD_Filter/TPD_Filter/basic_function_util.h:15
#1  0x0000555555564ae2 in Dict320<hashTable_Aligned<unsigned long, 4ul, hashing::TwoIndependentMultiplyShift>, unsigned long, unsigned long, hashing::TwoIndependentMultiplyShift, 8ul, 32ul, 32ul>::Dict320 (this=0x7fffffffe090,
    max_number_of_elements=100000, level1_load_factor=0.95499999999999996, level2_load_factor=0.5) at /root/Comparing_Filters/PD_Filter/Dict320/Dict320.hpp:59
#2  0x00005555555625d4 in FilterAPI<Dict320<hashTable_Aligned<unsigned long, 4ul, hashing::TwoIndependentMultiplyShift>, unsigned long, unsigned long, hashing::TwoIndependentMultiplyShift, 8ul, 32ul, 32ul> >::ConstructFromAddCount (
    add_count=100000) at /root/Comparing_Filters/Tests/wrappers.hpp:227
#3  0x00005555555610f4 in w_validate_filter<Dict320<hashTable_Aligned<unsigned long, 4ul, hashing::TwoIndependentMultiplyShift>, unsigned long, unsigned long, hashing::TwoIndependentMultiplyShift, 8ul, 32ul, 32ul>, unsigned long, false> (
    filter_max_capacity=100000, lookup_reps=200000, error_power_inv=8, level1_load_factor=42, level2_load_factor=42, ss=0x7fffffffe310) at /root/Comparing_Filters/Tests/tests.hpp:312
#4  0x000055555556072d in default_validation_test_single<Dict320<hashTable_Aligned<unsigned long, 4ul, hashing::TwoIndependentMultiplyShift>, unsigned long, unsigned long, hashing::TwoIndependentMultiplyShift, 8ul, 32ul, 32ul>, unsigned lon
g> () at /root/Comparing_Filters/Tests/minimal_tests.hpp:9
#5  0x00005555555595b2 in main (argc=1, argv=0x7fffffffe6b8) at /root/Comparing_Filters/main.cpp:22
(gdb) p x
$3 = 140737488348848
(gdb) n
(gdb) n
(gdb) s
std::log2<unsigned long> (__x=12540111712851102720) at /usr/include/c++/9/cmath:1582
(gdb) p __
(gdb) p __x$4 = 12540111712851102720
(gdb) n
(gdb) n

Program received signal SIGILL, Illegal instruction.
std::log2<unsigned long> (__x=32) at /usr/include/c++/9/cmath:1583

```

@dongdongwcpp
Copy link

@TheHolyJoker what platform were you using? the coredump Illegal instruction happened @ubuntu 20.04

@dongdongwcpp
Copy link

I am sorry, maybe the simd compatibility issues, the x is not to big ,but maybe my cpu not support this

Starting program: /root/Comparing_Filters/bui/Filters
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
std::log2<unsigned long> (__x=32) at /usr/include/c++/9/cmath:1583
(gdb) p __x
$2 = 32
(gdb)

@dongdongwcpp
Copy link

turns out the flag -mavx512bw cause everything.

#include <iostream>

#include <math.h>       /* ceil */


using namespace std;

int main ()
{
        int x = 32;
         size_t res = std::ceil(log2(x));
         cout <<res<<endl;
}
`g++   -mavx512bw -faligned-new  -mbmi -mbmi2 -mlzcnt   test.cpp `
`./a.out` will got Illegal instruction on my cpu: model Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants