[Mlir-commits] [mlir] ba6d7a0 - [mlir][AMDGPU] Add gfx941 to buffer atomics emulation
Krzysztof Drewniak
llvmlistbot at llvm.org
Wed Sep 13 09:07:13 PDT 2023
Author: Krzysztof Drewniak
Date: 2023-09-13T16:07:07Z
New Revision: ba6d7a0f25f335a3106d2949dda18a15ac188792
URL: https://github.com/llvm/llvm-project/commit/ba6d7a0f25f335a3106d2949dda18a15ac188792
DIFF: https://github.com/llvm/llvm-project/commit/ba6d7a0f25f335a3106d2949dda18a15ac188792.diff
LOG: [mlir][AMDGPU] Add gfx941 to buffer atomics emulation
Reviewed By: fmorac
Differential Revision: https://reviews.llvm.org/D152299
Added:
Modified:
mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp b/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp
index 8147de5ba5c3ba7..f89e2537897e804 100644
--- a/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp
+++ b/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp
@@ -152,7 +152,7 @@ void mlir::amdgpu::populateAmdgpuEmulateAtomicsPatterns(
}
// gfx9 has no to a very limited support for floating-point min and max.
if (chipset.majorVersion == 9) {
- if (chipset.minorVersion >= 0x0a) {
+ if (chipset.minorVersion >= 0x0a && chipset.minorVersion != 0x41) {
// gfx90a supports f64 max (and min, but we don't have a min wrapper right
// now) but all other types need to be emulated.
target.addDynamicallyLegalOp<RawBufferAtomicFmaxOp>(
@@ -162,10 +162,18 @@ void mlir::amdgpu::populateAmdgpuEmulateAtomicsPatterns(
} else {
target.addIllegalOp<RawBufferAtomicFmaxOp>();
}
+ if (chipset.minorVersion == 0x41) {
+ // gfx941 requires non-CAS atomics to be implemented with CAS loops.
+ // The workaround here mirrors HIP and OpenMP.
+ target.addIllegalOp<RawBufferAtomicFaddOp, RawBufferAtomicFmaxOp,
+ RawBufferAtomicSmaxOp, RawBufferAtomicUminOp>();
+ }
}
patterns.add<
RawBufferAtomicByCasPattern<RawBufferAtomicFaddOp, arith::AddFOp>,
- RawBufferAtomicByCasPattern<RawBufferAtomicFmaxOp, arith::MaximumFOp>>(
+ RawBufferAtomicByCasPattern<RawBufferAtomicFmaxOp, arith::MaximumFOp>,
+ RawBufferAtomicByCasPattern<RawBufferAtomicSmaxOp, arith::MaxSIOp>,
+ RawBufferAtomicByCasPattern<RawBufferAtomicUminOp, arith::MinUIOp>>(
patterns.getContext());
}
More information about the Mlir-commits
mailing list