[mlir][GPU] Prevent adding duplicate async tokens
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Mon, 17 Oct 2022 17:47:56 +0000 (17:47 +0000)
committerKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Tue, 18 Oct 2022 15:37:20 +0000 (15:37 +0000)
commit44027f390854f3088bf85c5c4d8cf1405dd4bb4c
tree6423a88871c3108182e4f56b207974a936dec39d
parent44b7da89d774019dc52342712a0edd73f90ad90a
[mlir][GPU] Prevent adding duplicate async tokens

If, in the GPU async transformation, the operation being given an
async dependency already depended on the token in question, we
would add duplicate tokens, creating issues in GPU to LLVM lowering.

To resolve this issue, add a check to addAsyncDependency() to ensure
that duplicate tokens are not present in the token list.

(I'm open to a different approach here, this is just what I went with
initially)

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D136105
mlir/include/mlir/Dialect/GPU/IR/GPUBase.td
mlir/include/mlir/Dialect/GPU/IR/GPUDialect.h
mlir/test/Dialect/GPU/async-region.mlir