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

Use a scalar pointer when emitting IR for a scalar bucket #25

Open
drhagen opened this issue Nov 26, 2023 · 0 comments
Open

Use a scalar pointer when emitting IR for a scalar bucket #25

drhagen opened this issue Nov 26, 2023 · 0 comments

Comments

@drhagen
Copy link
Owner

drhagen commented Nov 26, 2023

Right now, a point-like bucket, looks like this:

double* restrict bucket_y_0 = y_vals + p_y_0_0;
int32_t i_bucket_y_0 = 0;
while (i_bucket_y_0 < 1) {
  bucket_y_0[i_bucket_y_0] = 0;
  i_bucket_y_0++;
}

// *** Computation of expression ***
bucket_y_0[0] += A_vals[p_A_1_1] * x_vals[p_x_2_0];

This is not wrong, and it is probably all optimized down by LLVM, but it would be fairly simple to emit this instead, which looks a lot nicer:

double* restrict bucket_y_0 = y_vals + p_y_0_0
*bucket_y_0 = 0

// *** Computation of expression ***
*bucket_y_0 += A_vals[p_A_1_1] * x_vals[p_x_2_0];
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