Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMD] NFC: Unified header guard in third_party/amd #5244

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions third_party/amd/include/Dialect/TritonAMDGPU/IR/Dialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef TRITON_DIALECT_AMDGPU_IR_DIALECT_H_
#define TRITON_DIALECT_AMDGPU_IR_DIALECT_H_
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_DIALECT_TRITONAMDGPU_IR_DIALECT_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_DIALECT_TRITONAMDGPU_IR_DIALECT_H_

#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
Expand All @@ -47,4 +47,4 @@ namespace amdgpu {} // namespace amdgpu
} // namespace triton
} // namespace mlir

#endif // TRITON_DIALECT_TRITONGPU_IR_DIALECT_H_
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_DIALECT_TRITONAMDGPU_IR_DIALECT_H_
6 changes: 3 additions & 3 deletions third_party/amd/include/TritonAMDGPUToLLVM/GCNAsmFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TRITON_CONVERSION_TRITON_GPU_TO_LLVM_GCN_FORMAT_H_
#define TRITON_CONVERSION_TRITON_GPU_TO_LLVM_GCN_FORMAT_H_
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_GCNASMFORMAT_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_GCNASMFORMAT_H_

#include "mlir/IR/Value.h"
#include "triton/Dialect/Triton/IR/Dialect.h"
Expand Down Expand Up @@ -400,4 +400,4 @@ struct GCNMemInstr : public GCNInstrBase<GCNMemInstr> {
} // namespace triton
} // namespace mlir

#endif // TRITON_CONVERSION_TRITON_GPU_TO_LLVM_ASM_FORMAT_H_
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_GCNASMFORMAT_H_
6 changes: 3 additions & 3 deletions third_party/amd/include/TritonAMDGPUToLLVM/Passes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITONAMDGPU_CONVERSION_PASSES_H
#define TRITONAMDGPU_CONVERSION_PASSES_H
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PASSES_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PASSES_H_

#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
Expand Down Expand Up @@ -49,4 +49,4 @@ createTritonAMDGPULowerInstructionSchedHintsPass(StringRef arch,

} // namespace mlir

#endif
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PASSES_H_
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITONAMDGPU_TO_LLVM_PATTERNS_AMDGPU_OP_TO_LLVM_H
#define TRITONAMDGPU_TO_LLVM_PATTERNS_AMDGPU_OP_TO_LLVM_H
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PATTERNTRITONAMDGPUTOLLVM_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PATTERNTRITONAMDGPUTOLLVM_H_

#include "mlir/Conversion/LLVMCommon/TypeConverter.h"

Expand All @@ -11,4 +11,4 @@ void populateExtractSliceOpToLLVMPatterns(

}

#endif
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PATTERNTRITONAMDGPUTOLLVM_H_
6 changes: 3 additions & 3 deletions third_party/amd/include/TritonAMDGPUToLLVM/TargetUtils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONGPU_TO_LLVM_TARGETUTILS_H
#define TRITON_CONVERSION_TRITONGPU_TO_LLVM_TARGETUTILS_H
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_TARGETUTILS_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_TARGETUTILS_H_

#include "llvm/ADT/StringRef.h"

Expand Down Expand Up @@ -32,4 +32,4 @@ enum class DppCtrl : uint32_t {

} // namespace mlir::triton::AMD

#endif // TRITON_CONVERSION_TRITONGPU_TO_LLVM_TARGETUTILS_H
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_TARGETUTILS_H_
6 changes: 3 additions & 3 deletions third_party/amd/include/TritonAMDGPUTransforms/MfmaGroup.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_DIALECT_TRITONAMDGPU_TRANSFORMS_MFMAGROUP_H_
#define TRITON_DIALECT_TRITONAMDGPU_TRANSFORMS_MFMAGROUP_H_
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_MFMAGROUP_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_MFMAGROUP_H_

#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
#include "llvm/ADT/DenseMap.h"
Expand Down Expand Up @@ -91,4 +91,4 @@ class MfmaInsn {
};
} // namespace mlir

#endif // TRITON_DIALECT_TRITONAMDGPU_TRANSFORMS_MFMAGROUP_H_
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_MFMAGROUP_H_
6 changes: 3 additions & 3 deletions third_party/amd/include/TritonAMDGPUTransforms/Passes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_DIALECT_TRITONAMDGPU_TRANSFORMS_PASSES_H_
#define TRITON_DIALECT_TRITONAMDGPU_TRANSFORMS_PASSES_H_
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_PASSES_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_PASSES_H_

#include "mlir/Pass/Pass.h"
#include "third_party/amd/include/Dialect/TritonAMDGPU/IR/Dialect.h"
Expand Down Expand Up @@ -32,4 +32,4 @@ std::unique_ptr<Pass> createTritonAMDGPUConvertToBufferOpsPass();
#include "TritonAMDGPUTransforms/Passes.h.inc"

} // namespace mlir
#endif
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_PASSES_H_
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef TRITON_DIALECT_TRITONGPU_TRANSFORMS_TRITONGPUCONVERSION_H_
#define TRITON_DIALECT_TRITONGPU_TRANSFORMS_TRITONGPUCONVERSION_H_
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_TRITONGPUCONVERSION_H_
#define TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_TRITONGPUCONVERSION_H_

#include "mlir/Transforms/DialectConversion.h"

Expand Down Expand Up @@ -35,4 +35,4 @@ class TritonGPUConversionTarget : public ConversionTarget {

} // namespace mlir

#endif // TRITON_DIALECT_TRITONGPU_TRANSFORMS_TRITONGPUCONVERSION_H_
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTRANSFORMS_TRITONGPUCONVERSION_H_
6 changes: 3 additions & 3 deletions third_party/amd/lib/TritonAMDGPUToLLVM/BufferOpsEmitter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_BUFFER_OPS_EMITTER_H
#define TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_BUFFER_OPS_EMITTER_H
#ifndef TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_BUFFEROPSEMITTER_H_
#define TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_BUFFEROPSEMITTER_H_

#include "TargetInfo.h"
#include "TritonAMDGPUToLLVM/GCNAsmFormat.h"
Expand Down Expand Up @@ -90,4 +90,4 @@ struct BufferEmitter {

} // namespace mlir::LLVM::AMD

#endif // TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_BUFFER_OPS_EMITTER_H
#endif // TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_BUFFEROPSEMITTER_H_
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONGPU_TO_LLVM_SHARED_TO_DOT_OPERAND_MATRIXCORE_H
#define TRITON_CONVERSION_TRITONGPU_TO_LLVM_SHARED_TO_DOT_OPERAND_MATRIXCORE_H
#ifndef TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_CONVERTLAYOUTOPTOLLVM_SHAREDTODOTOPERANDHELPER_H_
#define TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_CONVERTLAYOUTOPTOLLVM_SHAREDTODOTOPERANDHELPER_H_

#include "Utility.h"

Expand Down Expand Up @@ -61,4 +61,4 @@ llvm::SmallVector<Value> computeOffsetsBType(

} // namespace mlir::triton::AMD

#endif
#endif // TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_CONVERTLAYOUTOPTOLLVM_SHAREDTODOTOPERANDHELPER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ llvm::SmallVector<llvm::SmallVector<Value>> computeTensorElemMappingInBlock(

Value laneVOffset = urem(laneId, nonKDim);
Value laneHOffset;
if (iNonKDim == 32)
if (iNonKDim == 32) {
laneHOffset = select(icmp_uge(laneId, _32), i32_val(numOfElems), _0);
else {
} else {
// In this configuration warp contains 16 copies of same data
if ((iKDim == 1 || iKDim == 4) && iNonKDim == 4) {
laneHOffset = i32_val(0);
Expand Down
6 changes: 4 additions & 2 deletions third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/MFMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,19 @@ struct DotOpMFMAConversionHelper {
// rocdl.mfma.f32.32x32x8bf16.1k calls for input of i16 type
auto cast = bitcast(val, i16_ty);
vec = insert_element(vecTy, vec, cast, i32_val(elemId));
} else
} else {
vec = insert_element(vecTy, vec, val, i32_val(elemId));
}
}
if (type.getIntOrFloatBitWidth() == 8) {
if (4 == kBase)
// This is for int8 on pre- MI300 GPUs
results.push_back(bitcast(vec, i32_ty));
if (8 == kBase)
results.push_back(bitcast(vec, i64_ty));
} else
} else {
results.push_back(vec);
}
}
return results;
}
Expand Down
6 changes: 3 additions & 3 deletions third_party/amd/lib/TritonAMDGPUToLLVM/OptimizeLDSUtility.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_OPTIMIZE_LDS_UTILITY_H
#define TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_OPTIMIZE_LDS_UTILITY_H
#ifndef TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_OPTIMIZELDSUTILITY_H_
#define TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_OPTIMIZELDSUTILITY_H_

#include "triton/Dialect/TritonGPU/IR/Dialect.h"

Expand Down Expand Up @@ -47,4 +47,4 @@ estimateResourcesForReplacement(OpBuilder builder,

} // namespace mlir::triton::AMD

#endif // TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_OPTIMIZE_LDS_UTILITY_H
#endif // TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_OPTIMIZELDSUTILITY_H_
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONAMDPU_TO_LLVM_PATTERNS_TRITON_GPU_OP_TO_LLVM_H
#define TRITON_CONVERSION_TRITONAMDPU_TO_LLVM_PATTERNS_TRITON_GPU_OP_TO_LLVM_H
#ifndef TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_PATTERNTRITONGPUOPTOLLVM_H_
#define TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_PATTERNTRITONGPUOPTOLLVM_H_

#include "TargetInfo.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
Expand Down Expand Up @@ -41,4 +41,4 @@ void populateUpcastMXFPToLLVMPatterns(LLVMTypeConverter &typeConverter,

} // namespace mlir::triton::AMD

#endif
#endif // TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_PATTERNTRITONGPUOPTOLLVM_H_
6 changes: 3 additions & 3 deletions third_party/amd/lib/TritonAMDGPUToLLVM/SchedInstructions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_SCHED_INSTRUCTIONS_H
#define TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_SCHED_INSTRUCTIONS_H
#ifndef TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_SCHEDINSTRUCTIONS_H_
#define TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_SCHEDINSTRUCTIONS_H_

#include "mlir/IR/Types.h"
#include "third_party/amd/include/Dialect/TritonAMDGPU/IR/Dialect.h"
Expand All @@ -23,4 +23,4 @@ void storeOpConversionCallback(triton::gpu::LocalStoreOp op, size_t llvmOpCount,
triton::DotOp getSingleDotOpIfExists(scf::ForOp forOp);
} // namespace mlir::triton

#endif
#endif // TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_SCHEDINSTRUCTIONS_H_
6 changes: 3 additions & 3 deletions third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONGPU_TO_LLVM_TARGETINFOAMD_H
#define TRITON_CONVERSION_TRITONGPU_TO_LLVM_TARGETINFOAMD_H
#ifndef TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_TARGETINFO_H_
#define TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_TARGETINFO_H_

#include "TritonAMDGPUToLLVM/TargetUtils.h"
#include "triton/Conversion/TritonGPUToLLVM/TargetInfoBase.h"
Expand Down Expand Up @@ -68,4 +68,4 @@ class TargetInfo : public mlir::triton::TargetInfoBase {
};
} // namespace mlir::triton::AMD

#endif // TRITON_CONVERSION_TRITONGPU_TO_LLVM_TARGETINFOAMD_H
#endif // TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_TARGETINFO_H_
6 changes: 3 additions & 3 deletions third_party/amd/lib/TritonAMDGPUToLLVM/Utility.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_UTILITY_H
#define TRITON_CONVERSION_TRITONAMDGPU_TO_LLVM_UTILITY_H
#ifndef TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_UTILITY_H_
#define TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_UTILITY_H_

#include "TritonAMDGPUToLLVM/GCNAsmFormat.h"
#include "TritonAMDGPUToLLVM/TargetUtils.h"
Expand Down Expand Up @@ -49,4 +49,4 @@ void llStore(RewriterBase &rewriter, Location loc, Value ptr, Value val,
triton::CacheModifier cm = triton::CacheModifier::NONE);
} // namespace mlir::LLVM::AMD

#endif
#endif // TRITON_THIRD_PARTY_AMD_LIB_TRITONAMDGPUTOLLVM_UTILITY_H_
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ warpsPerTile(Operation *dotOp, ArrayRef<int64_t> shape, int numWarps,
tensorShape[1] / shapePerWarp.second / ret[1]) {
if (ret[0] < tensorShape[0] / shapePerWarp.first) {
ret[0] *= 2;
} else
} else {
ret[1] *= 2;
}
} else {
ret[1] *= 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class PointerCanonicalizer {
// Utility copy functions
FatPtr copy(Value newBasePtr, Value newOffset) {
return FatPtr{newBasePtr, newOffset, canNarrow};
};
}
FatPtr copyWithBase(Value newOffset) {
return FatPtr{basePtr, newOffset, canNarrow};
}
Expand Down
Loading