WIP: Improve BoutExpr CPU performance#3403
Open
bendudson wants to merge 2 commits into
Open
Conversation
Not needed in current use, and may prevent vectorization.
If iterating over Field3D, the RegionID can be used to get the Region and so the blocks. This avoids lookup of array indices and helps vectorize simple loops.
| #define BOUT_FORCEINLINE inline | ||
| #endif | ||
|
|
||
| #if defined(_MSC_VER) |
Contributor
There was a problem hiding this comment.
warning: preprocessor condition can be written more concisely using '#ifdef' [readability-use-concise-preprocessor-directives]
Suggested change
| #if defined(_MSC_VER) | |
| #ifdef _MSC_VER |
| #define BOUT_ASSUME(condition) __assume(condition) | ||
| #elif defined(__clang__) | ||
| #if __has_builtin(__builtin_assume) | ||
| #define BOUT_ASSUME(condition) __builtin_assume(condition) |
Contributor
There was a problem hiding this comment.
warning: function-like macro 'BOUT_ASSUME' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
#define BOUT_ASSUME(condition) __builtin_assume(condition)
^| class Field3DParallel; | ||
|
|
||
| namespace bout::detail { | ||
| const Region<Ind3D>& getField3DRegion(const Mesh* mesh, std::optional<size_t> regionID); |
Contributor
There was a problem hiding this comment.
warning: redundant 'getField3DRegion' declaration [readability-redundant-declaration]
Suggested change
| const Region<Ind3D>& getField3DRegion(const Mesh* mesh, std::optional<size_t> regionID); |
Additional context
include/bout/fieldops.hxx:27: previously declared here
const Region<Ind3D>& getField3DRegion(const Mesh* mesh, std::optional<size_t> regionID);
^| this->mul = mul; | ||
| this->div = div; | ||
| template <typename Mul, typename Div> | ||
| View& setScale(Mul, Div) { |
Contributor
There was a problem hiding this comment.
warning: all parameters should be named in a function [readability-named-parameter]
Suggested change
| View& setScale(Mul, Div) { | |
| View& setScale(Mul /*unused*/, Div /*unused*/) { |
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.
Some small improvements to encourage vectorization in BoutExpr::evaluate for common cases.