-
Notifications
You must be signed in to change notification settings - Fork 86
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
[WIP] TensorTiler2D #1870
base: main
Are you sure you want to change the base?
[WIP] TensorTiler2D #1870
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Coverage ReportCreated: 2024-10-25 14:52Click here for information about interpreting this report.
Generated by llvm-cov -- llvm version 14.0.0 |
How hard is it to generalize from 2d? |
@fifield Great question but I'm not sure... This needs some work before it's ready for merge due to some complexities with translating between the sizes/strides generated by the TensorTiler2D and the limitations in sizes/sizes allowed by the hardware. My plan right now is to get a bit more confident about the problem space in 2D (which is also easier to visualize) before moving on to something more complex. |
Description
This PR introduces some classes to help with data transformations/tiling and data visualization. The main classes introduced are:
TensorTile
: A class representing information for specifying a 'chunk' of data, suitable for use in describing anpu_dma_memcpy_nd
operation; also includes code for visualizing theTensorTile
.TensorTile2DIter
: An iterator class that producesTensorTile
s based on anoffset_fn
TensorTiler2D
: A class for representing data tiling. Provides atile_iter()
method to aid in generating iterative patterns of tiling over the tensor; includes code for visualizing the the transformation.I also include:
test/python/tensortiler
dma_transpose
,matrix_scalar_add
,row_wise_bias_add
) to show how to use theTensorTiler2D
programming_examples/basic/tiling_exploration
) that use the device to create an access order map that can be compared to the map provided by theTensorTiler2D
. These examples are meant to verify theTensorTiler2D
can produce valid access patterns but also illustrate how to use the tensor tiling code.npu_dma_memcpy_nd
to support taking aTensorTile
directly instead of sizes/strides/offsetSome incidental things that got included in this PR:
TODO List
tiling_exploration
examplestile_repeat
intile_iter()
tile_stride
(skips, for height and width) intile_iter()
TensorTile2DIter
and/ortiler_iter()
where some iterations may be a 'partial' transformation (e.g., in some cases where factors do not divide evenly)Wish List (probably not included in this PR)
Notes
Credit to Andre for his really excellent tool here: https://andreroesti.com/data-layout-viz/data_layout.html
This is my attempt at making something similar that can be integrated into a development tool directly, with the additional step of generating sizes/strides for you.