[mlir] add a simple gpu barrier elimination mechanism
authorAlex Zinenko <zinenko@google.com>
Fri, 7 Jul 2023 14:35:04 +0000 (14:35 +0000)
committerAlex Zinenko <zinenko@google.com>
Fri, 7 Jul 2023 18:51:49 +0000 (18:51 +0000)
commit9ab34689b08ee66f0868d38456fccc8b80d1b656
treec6111fb768e62f77fca041c80f0c356b6106a1f8
parent9b79e15da189b01da477a64f8987b5f836ce5847
[mlir] add a simple gpu barrier elimination mechanism

GPU code generation, and specifically the shared memory copy insertion
may introduce spurious barriers guarding read-after-read dependencies or
read-after-write on non-aliasing data, which degrades performance due to
unnecessary synchronization. Add a pattern and transform op that removes
such barriers by analyzing memory effects that the barrier actually
guards that are not also guarded by other barriers. The code is adapted
from the Polygeist incubator project.

Co-authored-by: William Moses <gh@wsmoses.com>
Co-authored-by: Ivan Radanov Ivanov <ivanov.i.aa@m.titech.ac.jp>
Reviewed By: nicolasvasilache, wsmoses

Differential Revision: https://reviews.llvm.org/D154720
mlir/include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.td
mlir/lib/Dialect/GPU/TransformOps/CMakeLists.txt
mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp
mlir/test/Dialect/GPU/barrier-elimination.mlir [new file with mode: 0644]
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel