gpu::LaunchOp: canonicalize away constant kernel arguments
authorAlex Zinenko <zinenko@google.com>
Mon, 1 Jul 2019 21:38:02 +0000 (14:38 -0700)
committerjpienaar <jpienaar@google.com>
Tue, 2 Jul 2019 00:03:03 +0000 (17:03 -0700)
commit0b468b01014a21c72ee31b62fc64ca1446c72210
tree90f96c389f987486dcdd3c04cc5083db345afc94
parent705b80918d136c51b75f66bb1d9955621b5236ed
gpu::LaunchOp: canonicalize away constant kernel arguments

The GPU Launch operation may take constants as arguments, in particular
affine-to-GPU mapping pass automatically forwards potentially constant lower
bounds of loops into the kernel.  Define a canonicalization pattern for
LaunchOp that recreates the constants inside the kernel region instead of
accepting them as kernel arguments.  This is currently restricted to standard
constants but may be extended to other constant operations.

Also fix an off-by-one indexing bug in OperandStorage::eraseOperand.

PiperOrigin-RevId: 256035437
mlir/include/mlir/GPU/GPUDialect.h
mlir/include/mlir/IR/Operation.h
mlir/lib/GPU/IR/GPUDialect.cpp
mlir/lib/IR/OperationSupport.cpp
mlir/test/GPU/canonicalize.mlir [new file with mode: 0644]