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

Precompute indices in cuda-ico #996

Open
Stagno opened this issue Jun 16, 2020 · 0 comments
Open

Precompute indices in cuda-ico #996

Stagno opened this issue Jun 16, 2020 · 0 comments
Labels
backend dawn related

Comments

@Stagno
Copy link
Contributor

Stagno commented Jun 16, 2020

Instead of recomputing the "final" index to access a field each time (for each field), like:

... u_vert(kIter * NumVertices + nbhIdx) * dual_normal_x[kIter * NumEdges * E_C_V_SIZE + nbhIter * NumEdges + pidx]) + (v_vert[kIter * NumVertices + nbhIdx] ...

we should store, at the beginning of the relevant scope, such index, so that

  • we help nvcc with common subexpression elimination
  • can assert that the index is not out of bounds
const int sparseIdx = kIter * NumEdges * E_C_V_SIZE + nbhIter * NumEdges + pidx;
assert(sparseIdx < NumEdges * E_C_V_SIZE * kSize);
@Stagno Stagno added the backend dawn related label Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend dawn related
Projects
None yet
Development

No branches or pull requests

1 participant