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

Find a solution to compile-time block size parameter. #3

Open
DerWaldschrat opened this issue Jan 18, 2019 · 2 comments
Open

Find a solution to compile-time block size parameter. #3

DerWaldschrat opened this issue Jan 18, 2019 · 2 comments

Comments

@DerWaldschrat
Copy link
Collaborator

By now, the block size is a template parameter of the reduce kernel to allow for dead code elimination and unrolling. Of course, this requires that it is known at compile time. But this is problematic for accelerators which have a block size that is device-dependent, like the CpuThreads. In theory (practically, this needs to be fixed anyways, see #1 ), in this case the number of cores would form a good block size, but this is dependent on the platform. Several solutions come to mind:

  • Calculate/provide the number of threads at compile time. I dont know if this is possible, but this has the problem of cross-compilation and portability.
  • Make blocksize a runtime parameter. This would probably require the kernel to be adjusted for optimal performance in the case of blockSize = 1.
  • Introduce a switch-statement like solution which allows for runtime computations against several compile-time reduce kernels with different block sizes. This is ugly, bloats the code size and unflexible if new architectures evolve.

By now, I have not found a satisfying solution.
However, this can be delayed until #1 is resolved, because the thread-based cpu accelerators dont work as expected anyways by now.
Still, I guess this requires discussion, @tdd11235813

@ax3l
Copy link
Member

ax3l commented Jan 18, 2019

If one can find a good configurable and abstract way to express the third option, it is not to bad imho.

@DerWaldschrat
Copy link
Collaborator Author

As discussed offline with @tdd11235813, this will be left open on purpose. Possible solutions are mentioned above, but as the design of primitives is not finalized anyways, it is still not clear which is the best solution.

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

2 participants