Extend AffineToGPU to support Linalg loops
authorAlex Zinenko <zinenko@google.com>
Tue, 9 Jul 2019 12:26:18 +0000 (05:26 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Tue, 9 Jul 2019 12:26:50 +0000 (05:26 -0700)
commit80e287108771685d1eb20ad3f27f4459068604f0
tree46d49baf4ea0a5e8075c82c59bf09d1e4c6e0878
parent2002087f1ab88bbdc6329c3871caadd46ac371c4
Extend AffineToGPU to support Linalg loops

Extend the utility that converts affine loop nests to support other types of
loops by abstracting away common behavior through templates.  This also
slightly simplifies the existing Affine to GPU conversion by always passing in
the loop step as an additional kernel argument even though it is a known
constant.  If it is used, it will be propagated into the loop body by the
existing canonicalization pattern and can be further constant-folded, otherwise
it will be dropped by canonicalization.

This prepares for the common loop abstraction that will be used for converting
to GPU kernels, which is conceptually close to Linalg loops, while maintaining
the existing conversion operational.

PiperOrigin-RevId: 257172216
13 files changed:
mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPU.h [moved from mlir/include/mlir/Conversion/AffineToGPU/AffineToGPU.h with 60% similarity]
mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h [moved from mlir/include/mlir/Conversion/AffineToGPU/AffineToGPUPass.h with 68% similarity]
mlir/include/mlir/Transforms/RegionUtils.h
mlir/lib/Conversion/AffineToGPU/AffineToGPU.cpp [deleted file]
mlir/lib/Conversion/AffineToGPU/CMakeLists.txt [deleted file]
mlir/lib/Conversion/CMakeLists.txt
mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt [new file with mode: 0644]
mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp [new file with mode: 0644]
mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp [moved from mlir/lib/Conversion/AffineToGPU/AffineToGPUPass.cpp with 73% similarity]
mlir/test/Conversion/LoopsToGPU/linalg_to_gpu.mlir [new file with mode: 0644]
mlir/test/Conversion/LoopsToGPU/step_one.mlir [moved from mlir/test/Conversion/AffineToGPU/step_one.mlir with 76% similarity]
mlir/test/Conversion/LoopsToGPU/step_positive.mlir [moved from mlir/test/Conversion/AffineToGPU/step_positive.mlir with 54% similarity]
mlir/tools/mlir-opt/CMakeLists.txt