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
The following code is bugged when MT_UNROLL_MORE is set.
// i = [0 ... 226]
while (i < DIFF)
{
/*
* We're doing 226 = 113*2, an even number of steps, so we can safely
* unroll one more step here for speed:
*/
UNROLL(i + PERIOD);
#ifdef MT_UNROLL_MORE
UNROLL(i + PERIOD);
#endif
}
With MT_UNROLL_MORE, the last iteration begins with i set to 226. The loop enters and completes two more iterations, ending with i = 228, completing one more iteration than it should've. Interestingly, G++ is smart enough to produce a warning about this.
With MT_UNROLL_MORE, the following code fixes the bug and produces the same output as without MT_UNROLL_MORE:
while (i < DIFF - 2)
{
/*
* We're doing 226 = 113*2, an even number of steps, so we can safely
* unroll one more step here for speed:
*/
UNROLL(i + PERIOD);
#ifdef MT_UNROLL_MORE
UNROLL(i + PERIOD);
#endif
}
UNROLL(i + PERIOD);
The text was updated successfully, but these errors were encountered:
Please excuse my shallow understanding if I were wrong. Literally, the total execution times of UNROLL is determined by SIZE (see the following loop), so the above modifications will not affect the final execution result.
The expression passed to UNROLL is different. I discovered this bug when I was comparing the output against std::mt19937 and it was different. Implementing the fix I mentioned brings this code back in line with the output of std::mt19937.
The following code is bugged when MT_UNROLL_MORE is set.
With MT_UNROLL_MORE, the last iteration begins with i set to 226. The loop enters and completes two more iterations, ending with i = 228, completing one more iteration than it should've. Interestingly, G++ is smart enough to produce a warning about this.
With MT_UNROLL_MORE, the following code fixes the bug and produces the same output as without MT_UNROLL_MORE:
The text was updated successfully, but these errors were encountered: