From 1d900b741d03fc86205e64a19abad5e06abaf775 Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Wed, 29 May 2024 14:55:12 +0200 Subject: [PATCH] [AMD] Fix clang warnings in AMD backend. --- third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/MFMA.cpp | 2 +- third_party/amd/lib/TritonAMDGPUToLLVM/ElementwiseOpToLLVM.cpp | 2 +- third_party/amd/lib/TritonAMDGPUToLLVM/LoadStoreOpToLLVM.cpp | 2 +- third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.cpp | 2 +- .../amd/lib/TritonAMDGPUTransforms/AccelerateAMDMatmul.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/MFMA.cpp b/third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/MFMA.cpp index 8b9bec629104..c190711f1022 100644 --- a/third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/MFMA.cpp +++ b/third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/MFMA.cpp @@ -71,7 +71,7 @@ struct DotOpMFMAConversionHelper { } int getNumSubmatrices(Type elementType, int mDim, int nDim) const { - if (mDim == 64 && nDim == 4 || mDim == 4 && nDim == 64) + if ((mDim == 64 && nDim == 4) || (mDim == 4 && nDim == 64)) return 1; assert(mDim == nDim); switch (mDim) { diff --git a/third_party/amd/lib/TritonAMDGPUToLLVM/ElementwiseOpToLLVM.cpp b/third_party/amd/lib/TritonAMDGPUToLLVM/ElementwiseOpToLLVM.cpp index d252b2d58b37..ac1d8c68d43c 100644 --- a/third_party/amd/lib/TritonAMDGPUToLLVM/ElementwiseOpToLLVM.cpp +++ b/third_party/amd/lib/TritonAMDGPUToLLVM/ElementwiseOpToLLVM.cpp @@ -900,7 +900,7 @@ struct FpToFpOpConversion if (srcMap.count(key) == 0) { return mlir::failure(); } - return mlir::FailureOr(srcMap.lookup(key)); + return srcMap.lookup(key); } SmallVector createDestOps(triton::FpToFpOp op, OpAdaptor adaptor, diff --git a/third_party/amd/lib/TritonAMDGPUToLLVM/LoadStoreOpToLLVM.cpp b/third_party/amd/lib/TritonAMDGPUToLLVM/LoadStoreOpToLLVM.cpp index d47818a2ea91..83f24d711633 100644 --- a/third_party/amd/lib/TritonAMDGPUToLLVM/LoadStoreOpToLLVM.cpp +++ b/third_party/amd/lib/TritonAMDGPUToLLVM/LoadStoreOpToLLVM.cpp @@ -114,8 +114,8 @@ struct LoadStoreConversionBase { } protected: - ModuleAxisInfoAnalysis &axisAnalysisPass; const AMD::TargetInfo &targetInfo; + ModuleAxisInfoAnalysis &axisAnalysisPass; }; struct LoadOpConversion : public ConvertOpToLLVMPattern, diff --git a/third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.cpp b/third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.cpp index 1e8f33c3f5a2..0e47e6daaf6c 100644 --- a/third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.cpp +++ b/third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.cpp @@ -1,6 +1,6 @@ #include "TargetInfo.h" +#include "TritonAMDGPUToLLVM/GCNAsmFormat.h" #include "Utility.h" -#include "amd/include/TritonAMDGPUToLLVM/GCNAsmFormat.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "triton/Conversion/TritonGPUToLLVM/Utility.h" diff --git a/third_party/amd/lib/TritonAMDGPUTransforms/AccelerateAMDMatmul.cpp b/third_party/amd/lib/TritonAMDGPUTransforms/AccelerateAMDMatmul.cpp index 86505386cd0c..489f3aac4fbf 100644 --- a/third_party/amd/lib/TritonAMDGPUTransforms/AccelerateAMDMatmul.cpp +++ b/third_party/amd/lib/TritonAMDGPUTransforms/AccelerateAMDMatmul.cpp @@ -372,7 +372,7 @@ class BlockedToMFMA : public mlir::RewritePattern { // in mfma 4x4 case argument matrix groups in 16 groups if (mDim == 4 && nDim == 4) kWidth = kDim / 16; - if (mDim == 4 && nDim == 64 || mDim == 64 && nDim == 4) + if ((mDim == 4 && nDim == 64) || (mDim == 64 && nDim == 4)) kWidth = kDim; // We want to extend kWidth by kPack (kPack=1 means no extension)