-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust block size for reduce-then-scan based on input type #1782
Adjust block size for reduce-then-scan based on input type #1782
Conversation
7865493
to
deb9be3
Compare
deb9be3
to
4dd3068
Compare
constexpr std::uint8_t __block_size_factor = sizeof(_ValueType) > sizeof(std::uint32_t) ? sizeof(_ValueType) / sizeof(std::uint32_t) : sizeof(std::uint32_t) / sizeof(_ValueType); | ||
constexpr std::uint16_t __max_inputs_per_item = sizeof(_ValueType) > sizeof(std::uint32_t) ? 128 / __block_size_factor : 128 * __block_size_factor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we adjust this so our baseline is for sizeof(double)
types: 64
elements, then scale it by however much smaller the ValueType
is?
std::uint8_t __scale = std::min(1, sizeof(double) / sizeof(_ValueType));
std::uing16_t __max_inputs_per_item = 64 * __scale;
We could also limit it to 4x scale if we don't think think 1 byte types will benefit from 512.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a cleaner way to write this expression. Although I believe we want to use std::max
here instead of std::min
.
Can we also adjust the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Targeting to be included in #1762. This PR adjusts the block size to be bigger or smaller based on the input type.