Kobzol / hardware-effects

Demonstration of various hardware effects.
MIT License
2.82k stars 157 forks source link

Compiler error, "error: ‘_mm_hint’ has not been declared" #3

Closed hak8or closed 5 years ago

hak8or commented 5 years ago

Build seems to be failing on my system, also seems some on reddit have the same issue. I am running on Arch, GCC 8.2.1 as can be seen when running cmake. Let me know if you need any other information and I will be happy to provide it.

Attached is the build log:

⋊> /t/l/b cmake -DCMAKE_BUILD_TYPE=Release ../hardware-effects/                                       22:29:04
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/lol/b
⋊> /t/l/b make -j                                                                                     22:29:26
Scanning dependencies of target cache-memory-bound
Scanning dependencies of target data-dependency
Scanning dependencies of target branch-misprediction
Scanning dependencies of target branch-target-misprediction
Scanning dependencies of target cache-hierarchy-bandwidth
Scanning dependencies of target cache-aliasing
Scanning dependencies of target prefetching
[  5%] Building CXX object cache-memory-bound/CMakeFiles/cache-memory-bound.dir/cache-memory-bound.cpp.o
Scanning dependencies of target false-sharing
[ 11%] Building CXX object data-dependency/CMakeFiles/data-dependency.dir/data-dependency.cpp.o
[ 16%] Building CXX object branch-misprediction/CMakeFiles/branch-target-misprediction.dir/branch-target-misprediction.cpp.o
[ 22%] Building CXX object branch-misprediction/CMakeFiles/branch-misprediction.dir/branch-misprediction.cpp.o
[ 27%] Building CXX object cache-aliasing/CMakeFiles/cache-aliasing.dir/cache-aliasing.cpp.o
[ 33%] Building CXX object cache-hierarchy-bandwidth/CMakeFiles/cache-hierarchy-bandwidth.dir/cache-hierarchy-bandwidth.cpp.o
[ 38%] Building CXX object false-sharing/CMakeFiles/false-sharing.dir/false-sharing.cpp.o
[ 44%] Building CXX object prefetching/CMakeFiles/prefetching.dir/prefetching.cpp.o
Scanning dependencies of target write-combining
[ 50%] Building CXX object write-combining/CMakeFiles/write-combining.dir/write-combining.cpp.o
[ 55%] Linking CXX executable cache-hierarchy-bandwidth
[ 61%] Linking CXX executable cache-aliasing
[ 66%] Linking CXX executable cache-memory-bound
[ 72%] Linking CXX executable data-dependency
[ 72%] Built target cache-aliasing
[ 72%] Built target cache-hierarchy-bandwidth
/tmp/lol/hardware-effects/prefetching/prefetching.cpp:19:26: error: ‘_mm_hint’ has not been declared
 template <bool Prefetch, _mm_hint Hint>
                          ^~~~~~~~
/tmp/lol/hardware-effects/prefetching/prefetching.cpp: In function ‘size_t test_memory(const std::vector<Data*>&, int)’:
/tmp/lol/hardware-effects/prefetching/prefetching.cpp:32:62: error: ‘Hint’ was not declared in this scope
             if (Prefetch) _mm_prefetch(memory[j + distance], Hint);
                                                              ^~~~
/tmp/lol/hardware-effects/prefetching/prefetching.cpp:32:62: note: suggested alternative: ‘uint’
             if (Prefetch) _mm_prefetch(memory[j + distance], Hint);
                                                              ^~~~
                                                              uint
/*** SNIP ****/
/tmp/lol/hardware-effects/prefetching/prefetching.cpp:20:8: note:   template argument deduction/substitution failed:
/tmp/lol/hardware-effects/prefetching/prefetching.cpp:75:65: error: template argument 2 is invalid
         sum = test_memory<false, _MM_HINT_T0>(pointers, distance);
                                                                 ^
[ 72%] Built target cache-memory-bound
[ 77%] Linking CXX executable branch-misprediction
[ 77%] Built target data-dependency
[ 83%] Linking CXX executable false-sharing
make[2]: *** [prefetching/CMakeFiles/prefetching.dir/build.make:63: prefetching/CMakeFiles/prefetching.dir/prefetching.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:460: prefetching/CMakeFiles/prefetching.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 88%] Linking CXX executable write-combining
[ 94%] Linking CXX executable branch-target-misprediction
[ 94%] Built target false-sharing
[ 94%] Built target branch-misprediction
[ 94%] Built target branch-target-misprediction
[ 94%] Built target write-combining
make: *** [Makefile:84: all] Error 2
Kobzol commented 5 years ago

I added the xmmintrin.h header, try it now please.