This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse][vectorization] implement "index" vectorization
ClosedPublic

Authored by aartbik on Nov 29 2022, 3:06 PM.

Details

Summary

This adds the capability to vectorize computations like a[i] = i.
This also generalizes the supported unary and binary ops and
adds a test for each to ensure actual SIMD code can result.

Diff Detail

Event Timeline

aartbik created this revision.Nov 29 2022, 3:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2022, 3:06 PM
aartbik requested review of this revision.Nov 29 2022, 3:06 PM
aartbik updated this revision to Diff 478739.Nov 29 2022, 3:34 PM

removed TABs

aartbik updated this revision to Diff 478747.Nov 29 2022, 4:12 PM

rebased with main

bixia accepted this revision.Nov 29 2022, 4:56 PM
bixia added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
297

I don't understand why we call this "TYPED" "UNAOP". Compared with "UNAOP" above, this macro generate vector op. Why don't we call them "vectorizable unary op"?

349

Is this branch only for an invariant?

mlir/test/Dialect/SparseTensor/sparse_vector_index.mlir
2

Can we add this line if the check is generated by the script?

// NOTE: Assertions have been autogenerated by utils/generate-test-checks.py

This revision is now accepted and ready to land.Nov 29 2022, 4:56 PM
aartbik marked 3 inline comments as done.Nov 30 2022, 10:29 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
297

I am open for a better name. Both macro's generate a vector op, but in this particular TYPED case, we also need to specify the destination type explicitly (besides the source vector type which is present in both cases).

349

Also reduction. I added some comments on what happens.

aartbik updated this revision to Diff 479033.Nov 30 2022, 11:18 AM
aartbik marked 2 inline comments as done.

addressed comments, rebased with main