Repository navigation
Add the Base/SIMD tutorial - #187
Merged
Merged
Conversation
Part 1 shows what lets the compiler vectorize a ParallelFor kernel on CPU: the same function with a non-inlined call and a branch (for illustration only), and inlined and branch-free, timed with BL_PROFILE. Part 2 uses the explicit SIMD layer, ParallelForSIMD with simd::load_1d/store_1d and a Vectorized functor, which runs scalar without AMReX_SIMD and on GPUs. The superbuild fetches vir-simd for AMReX_SIMD=ON (cmake/DependencySIMD.cmake). The tests no longer trap floating-point exceptions: vectorized code raises them in inactive SIMD lanes and when the compiler speculates both arms of a select, with correct results, so the traps are a debugging aid for scalar runs. The trap arguments and the clang maytrap flag are removed from CMake, and AMReX_TESTING from the CI jobs, which all check their answers. A new CI job builds Base with AMReX_SIMD=ON; it drops -fno-operator-names, which vir-simd's alternative tokens reject.
Stop the configure when AMReX_SIMD is combined with a GPU backend, allow a few epsilon in the part-1 check for fast-math sqrt, start the docs listing at the illustration-only comment, shorten the f_select comment and inline the MPMD agent arguments.
Keep AMReX_TESTING in the CI jobs (it only fills new data with signaling NaNs; the tutorials add no compiler flags for it), use an array length that is not a multiple of the SIMD width so the scalar remainder runs, describe amrex::For as ParallelFor without the CPU promise of independent iterations, and keep compiler internals out of the Sphinx section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 shows what lets the compiler vectorize a ParallelFor kernel on CPU: the same function with a non-inlined call and a branch (for illustration only), and inlined and branch-free, timed with BL_PROFILE. Part 2 uses the explicit SIMD layer, ParallelForSIMD with simd::load_1d/store_1d and a Vectorized functor, which runs scalar without AMReX_SIMD and on GPUs. The superbuild fetches vir-simd for AMReX_SIMD=ON (cmake/DependencySIMD.cmake).
The tests no longer trap floating-point exceptions: vectorized code raises them in inactive SIMD lanes and when the compiler speculates both arms of a select, with correct results, so the traps are a debugging aid for scalar runs. The trap arguments and the clang maytrap flag are removed from CMake, and AMReX_TESTING from the CI jobs, which all check their answers. A new CI job builds Base with AMReX_SIMD=ON; it drops -fno-operator-names, which vir-simd's alternative tokens reject.