You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should always be possible to divert the IO state of a theta node (if it is invariant). In C(++), it is guaranteed that loops without side-effects, i.e., the IO state is invariant, always have to terminate as they are otherwise considered UB under the language's forward progress rules.
@sjalander@haved The code for the problematic benchmark looks like this:
int kernel(in_int_t a, in_int_t b) {
// Finding K, where K is the greatest power of 2 that divides both in0 and
// in1. for (int k = 0; ((in0 | in1) & 1) == 0; ++k)
unsigned k = 0;
while (((a | b) & 1) == 0) {
a >>= 1;
b >>= 1;
k++;
}
// Dividing in0 by 2 until in0 becomes odd
while ((a & 1) == 0)
a >>= 1;
// From here on, 'in0' is always odd.
// If in1 is even, remove all factor of 2 in in1
while ((b & 1) == 0)
b >>= 1;
// Now in0 and in1 are both odd. Swap if necessary so in0 <= in1, then set in1
// = in1 - in0 (which is even).
while (b > 0 && ((b & 1) == 0)) {
b = b - a;
}
// Restore common factors of 2
return a << k;
}
The purpose of it is to use Stein's algorithm for computing the gcd. However, looking at the code, I have my suspicions that it might not be correct. The function returns a<<k, but the last two loops neither contribute to a nor k, i.e., they are useless computations. @sjalander Where is this test case taken from?
@phate
We don't have a strong motivation for why this specific benchmark must be part of the test suit. We could simply remove it to get this PR merged.
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
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.
It should always be possible to divert the IO state of a theta node (if it is invariant). In C(++), it is guaranteed that loops without side-effects, i.e., the IO state is invariant, always have to terminate as they are otherwise considered UB under the language's forward progress rules.