Repository navigation
[spirv] Properly handle subspan offset - #5403
Conversation
This commit implements a pass to flatten n-D MemRef subspan ops to 1-D MemRef ones and folds the byte offsets on subspan ops to the consumer load/store ops, in preparation for lowering to SPIR-V.
|
fantastic work lei! |
MaheshRavishankar
left a comment
There was a problem hiding this comment.
Nice! Just a few nits.
| memref::LoadOp loadOp, ArrayRef<Value> operands, | ||
| ConversionPatternRewriter &rewriter) const override { | ||
| typename memref::LoadOp::Adaptor adaptor(operands); | ||
| assert(isRankZeroOrOneMemRef(adaptor.memref().getType())); |
There was a problem hiding this comment.
Couple of points here.
- For zero-D memref it is better to check the rank and return failure.
- you could have a
memref<?xf32, affine_map<(d0)[s0] -> (d0 + s0)>. It is better to handle these as well.linearizeIndiceslogic must be able to handle this too.
There was a problem hiding this comment.
Done 1. For 2 shouldn't it already be handled by getStridesAndOffset (with strides = [1], offset = s0)?
|
FYI @asaadaldien this has the makings of the pass to linearize multi-dimensional memrefs to 1D memrefs like we discussed today. |
|
I found that this would break using workgroup memory in Linalg on tensors. To repro: This also breaks conv test (using workgroup memory). There are 1D and 3D cases in the file. If you want to test it, you will have to comment those conv_1d and conv_3d. (they will be disabled in #5375 , I probably should make another change to make it easier...) |
8c0afe9 should address this. |
This commit implements a pass to flatten n-D MemRef
subspan ops to 1-D MemRef ones and folds the byte
offsets on subspan ops to the consumer load/store
ops, in preparation for lowering to SPIR-V.
Addresses #5372