SIMD implementation and examples#2556
Conversation
|
Did you changed anything on the job generator? Looks like only reformating. |
51bbfc1 to
8ca9828
Compare
9793c02 to
46cedf6
Compare
62faf14 to
37d34ab
Compare
I removed, just reformatting. |
37d34ab to
a157a5d
Compare
psychocoderHPC
left a comment
There was a problem hiding this comment.
I checked only the beginning, this is not a complete review
|
|
||
| option(alpaka_BUILD_EXAMPLES "Build the examples" OFF) | ||
| option(alpaka_BUILD_BENCHMARKS "Build the benchmarks" OFF) | ||
| option(ALPAKA_FORCE_DISABLE_STD_SIMD "Force use of fallback PortableSimd implementation instead of std::experimental::simd" OFF) |
There was a problem hiding this comment.
please rename to alpaka_USE_STD_SIMD set the value to off to use our portable simd type.
If you have disable in the name you have a double negation if you set it to off. This is making things complicated.
btw all variable start always with a small alpaka
There was a problem hiding this comment.
ok, changed to alpaka_USE_STD_SIMD and corrected code accordingly . Default is ON.
|
|
||
| # Propagate force-disable SIMD flag if requested | ||
| if(ALPAKA_FORCE_DISABLE_STD_SIMD) | ||
| add_compile_definitions(ALPAKA_FORCE_DISABLE_STD_SIMD=1) |
There was a problem hiding this comment.
take care that you have somewhere in the code a macro which is falling back to a usefull default in case the define is not set. This is e.g. the case in standalone headers where cmake is not used.
There was a problem hiding this comment.
oki will add this into the code; to make it available even cmake is not used.
#ifndef ALPAKA_USE_STD_SIMD #define ALPAKA_USE_STD_SIMD 1 #endif
There is also internal variable ALPAKA_SIMD_USE_STD_EXPERIMENTAL, i will change its name sincethey are very similar.
There was a problem hiding this comment.
Ok i removed internal variable ALPAKA_SIMD_USE_STD_EXPERIMENTAL from the code. If ALPAKA_USE_STD_SIMD is ON at the cmake-configuration AND alpaka is technically available by internal code macro ALPAKA_SIMD_ENV_STD_EXP_SIMD_AVAILABLE; then std::simd will be used.
0326b48 to
b2fead3
Compare
bf3fdfb to
2e6f6c6
Compare
| Always use: | ||
|
|
||
| * ``-O3`` (Release build) | ||
| * ``-march=native`` (CPU-specific optimizations) |
There was a problem hiding this comment.
To make the resulting binaries a bit more generic, rather than -march=native you could use the x86-64 micro-architectures:
-march=x86-64-v2to enable only SSE3/SSE4;-march=x86-64-v3to enable also AVX/AVX2 and FMA;-march=x86-64-v4to enable also AVX512.
There was a problem hiding this comment.
Ok added, thanks i did not know. (Although i could ONLY test at clang and g++, i also added corresponding flags for other compilers.)
There was a problem hiding this comment.
I guess the new tests should be added in alphabetical order, like to existing ones ?
There was a problem hiding this comment.
done, thanks.
8afb4dd to
8834c72
Compare
Alpaka SIMD implementation
A Two-Level SIMD Architecture
Level 1: std::experimental::simd
Level 2: Array-Based Fallback Backend
Cpu-gpu mixed backendandcpu-serial backend with clang + libc++ buildsuse this fallbackKey Features
SIMD width determined depending on the accelerator type at compile-time
APIs
2 different APIs: Low-level explicit SIMD types/operations and high-level SimdAlgo forEach abstraction.
Three SIMD Examples
vectorAddSIMD: Has 2 kernels. Shows both
explicit SIMD type/operatorusage andSimdAlgo forEachapproachesreduceRGBSIMD: Real-world RGB-to-grayscale conversion with 8.8x-10.7x speedups
sumOfSquaresSIMD: Demonstration of SIMD usage (reduction)
Performance Results
TEST1: RUN of EXAMPLE with FALLBACK Simd-Policy:
(Cmake fallback simd-policy setting: ALPAKA_FORCE_DISABLE_STD_SIMD ON)
TEST2: RUN with default Simd-Policy (std::experimental::simd)