[mlir][AMDGPU] Remove buffer ops that are statically out of bounds
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Wed, 9 Nov 2022 22:26:33 +0000 (22:26 +0000)
committerKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Mon, 21 Nov 2022 16:47:21 +0000 (16:47 +0000)
commitd6abdf46bc4d305f6046a8134316dd19cc6b5598
treea80c6750aea4d046000c3dd7548995741ffad027
parent3f9d64a2adc53fa7dc3e8fa482cfcaba7e81c4b0
[mlir][AMDGPU] Remove buffer ops that are statically out of bounds

When the bounds check attribute is true, the raw buffer load, store,
and atomic operations have well-defined behavior (returning 0 for
loads and ignoring stores) when the buffer access exceeds the bounds
of the memory being accessed.

Because of how LLVM currently implements these buffer operations (as
opaque intrinsics), the backend cannot optimize out this known
behavior and eliminate the memory operations. Therefore, use MLIR's
canonicalization system to eliminate these operations.

Reviewed By: nirvedhmeshram

Differential Revision: https://reviews.llvm.org/D138146
mlir/include/mlir/Dialect/AMDGPU/AMDGPU.td
mlir/lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp
mlir/lib/Dialect/AMDGPU/IR/CMakeLists.txt
mlir/test/Dialect/AMDGPU/canonicalize.mlir [new file with mode: 0644]