-
Notifications
You must be signed in to change notification settings - Fork 18
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
RFC: Implement access::components higher-order range mapper #193
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I'm not sure about the kernel_dim
name, but I do like components
.
Check-perf-impact results: (9e900a306dc9f17e4a27439205a7680c) ❓ No new benchmark data submitted. ❓ |
Live bikeshedding update about the naming of
More shower thoughts from my side:
|
RFC, based on #182.
A common parallelization pattern, e.g. in dense matrix-vector products, is to map 1D thread-ids to the rows of a 2D matrix while iterating over all columns on each item. This currently requires a custom range mapper:
While we could just have
access::rows
andaccess::columns
convenience range mappers with all the confusion about row-major vs column-major vs fastest-dimensions that would entail, I have come up with a generic solution for the entire class of these "component mappings".Let me introduce the first higher-order range mapper,
access::components
. It constructs a(chunk<KernelDims>, range<BufferDims>) -> subrange<BufferDims>
range mapper fromBufferDims
individual mappers of type(chunk<KernelDim>, range<1>) -> subrange<1>
.Together with the new, straight-forward mapper
access::kernel_dim
that creates asubrange<1>
from a single kernel dimension, this allows us to re-write the custom range mapper above like so:Note that any other range mapper that produces
subrange<1>
can be used for each component, such asfixed
or.neighborhood