[mlir] [VectorOps] Add scatter/gather operations to Vector dialect
authoraartbik <ajcbik@google.com>
Tue, 21 Jul 2020 17:57:18 +0000 (10:57 -0700)
committeraartbik <ajcbik@google.com>
Tue, 21 Jul 2020 17:57:40 +0000 (10:57 -0700)
commit19dbb230a245d3404a485d8684587c3d37c198d3
treee0335a02c610d99948ad93f27bd098bdbb18b3b0
parent0d3a5d09e3efae848b59db6497813bdda5fc951c
[mlir] [VectorOps] Add scatter/gather operations to Vector dialect

Introduces the scatter/gather operations to the Vector dialect
(important memory operations for sparse computations), together
with a first reference implementation that lowers to the LLVM IR
dialect to enable running on CPU (and other targets that support
the corresponding LLVM IR intrinsics).

The operations can be used directly where applicable, or can be used
during progressively lowering to bring other memory operations closer to
hardware ISA support for a gather/scatter. The semantics of the operation
closely correspond to those of the corresponding llvm intrinsics.

Note that the operation allows for a dynamic index vector (which is
important for sparse computations). However, this first reference
lowering implementation "serializes" the address computation when
base + index_vector is converted to a vector of pointers. Exploring
how to use SIMD properly during these step is TBD. More general
memrefs and idiomatic versions of striding are also TBD.

Reviewed By: arpith-jacob

Differential Revision: https://reviews.llvm.org/D84039
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/Dialect/Vector/VectorOps.td
mlir/integration_test/Dialect/Vector/CPU/test-gather.mlir [new file with mode: 0644]
mlir/integration_test/Dialect/Vector/CPU/test-scatter.mlir [new file with mode: 0644]
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
mlir/test/Dialect/Vector/invalid.mlir
mlir/test/Dialect/Vector/ops.mlir
mlir/test/Target/llvmir-intrinsics.mlir