TensorComprehensions icon indicating copy to clipboard operation
TensorComprehensions copied to clipboard

Add support for strided tensors

Open abadams opened this issue 7 years ago • 4 comments

We currently incorrectly treat all tensors as dense. Need to add support for strided tensors. This can be done by adding the strides as extra params, and either constructing the tensor views in the emitted source using the strides instead of the sizes, or just doing the storage flattening ourselves before or during codegen.

checklist after talking to @ftynse [~@prigoyal~ @protonu is working on it]

  • [ ] propagate DLTensor stride information to Halide (it has similar struct and already takes bits, lanes info, so should be easy)
  • [ ] codegen, where we emit "tensor views" by casting a pointer into a multidimensional array - the casting should be aware of strides. Also, Halide->polyhedral, there is a place that creates constraints on tensor sizes for polyhedral; it may or may not be adapted to strides.
  • [ ] add the stride info to the tuner proto
  • [ ] make proper changes to the frontend (aten, pytorch, caffe2 etc.)

abadams avatar Feb 14 '18 16:02 abadams

@abadams do you have time to look into this?

prigoyal avatar Feb 20 '18 23:02 prigoyal

assigning this to myself, I'll work on it soon.

prigoyal avatar Feb 21 '18 13:02 prigoyal

Sorry, snowed under with Halide work I neglected during the TC release.

abadams avatar Feb 21 '18 16:02 abadams

no worries at all, I will probably have some time next week and can look into it :)

prigoyal avatar Feb 21 '18 21:02 prigoyal