Skip to content
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

s258 benchmark function could be cheated #8

Open
pinskia opened this issue Jan 20, 2025 · 0 comments
Open

s258 benchmark function could be cheated #8

pinskia opened this issue Jan 20, 2025 · 0 comments

Comments

@pinskia
Copy link

pinskia commented Jan 20, 2025

s258 contains this inside the inner loop

	  if (a[i] > 0.)
	    {
	      s = d[i] * d[i];
	    }

BUT a[i] > 0. is always true due to the initialization of a array which does:

if (!strcmp(name, "s258")) {
        set_1d_array(a, LEN_1D, any,frac);

set_1d_array does this for frac (SET1D_RECIP_IDX):

        for (int i = 0; i < length; i++) {
            arr[i] = 1. / (real_t) (i+1);
        }

If the compiler decides not to generate a conditional move, the HW might be able to predict the branch correctly through the loop and that is cheating what the benchmark is trying to benchmark here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant