MLIR 24.0.0git
IntelGpuXe2.h
Go to the documentation of this file.
1//===--- IntelGpuXe2.h ------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// \file
10// Xe2 uArch definition. Xe2 is the second generation of Intel Xe GPUs.
11// This file defines the uArch details for Xe2 and its derived architectures.
12// This includes Ponte Vecchio (PVC) and Battlemage (BMG) architectures.
13//
14//===----------------------------------------------------------------------===//
15#ifndef MLIR_DIALECT_XEGPU_UARCH_INTELGPUXE2_H
16#define MLIR_DIALECT_XEGPU_UARCH_INTELGPUXE2_H
17
19
20namespace mlir {
21namespace xegpu {
22namespace uArch {
23
24struct Xe2 : public uArch {
27 int getSubgroupSize() const override { return 16; }
28 unsigned getGeneralPackedFormatBitSize() const override { return 32; }
29
30 // Restrictions Xe2 places on the 2D memory region accessed by the subgroup 2D
31 // block load / store / prefetch instructions.
32 //
33 // These are the hardware requirements as implemented by the Intel Graphics
34 // Compiler, and may differ from the restrictions documented for the Khronos
35 // extension that the XeVM lowering emits calls to. That extension only states
36 // that behavior is undefined when its restrictions are not met; it does not
37 // require an implementation to reject such cases, so the compiler is free to
38 // support them.
39 //
40 // The base address must be cache-line (64 byte) aligned. The base width must
41 // be at least 32 bytes and a multiple of 4 bytes. The base pitch must be at
42 // least 32 bytes and a multiple of 16 bytes.
45 static constexpr BlockIOMemoryRestrictions restrictions = {
46 /*baseAddressAlignmentBytes=*/64,
47 /*minBaseWidthBytes=*/32,
48 /*baseWidthAlignmentBytes=*/4,
49 /*minBasePitchBytes=*/32,
50 /*basePitchAlignmentBytes=*/16,
51 };
52 return restrictions;
53 }
54
55 static bool classof(const uArch *u) {
56 return u->getKind() >= Kind::Xe2_First && u->getKind() <= Kind::Xe2_Last;
57 }
58};
59
60//===----------------------------------------------------------------------===//
61// uArch instances
62//
63// PVC and BMG share the same Khronos-extension instruction set.
64//===----------------------------------------------------------------------===//
65
66namespace detail {
68 static const SubgroupMatrixMultiplyAcc dpasInst{16, 32};
69 static const Subgroup2DBlockLoadInstruction loadNdInst;
70 static const Subgroup2DBlockStoreInstruction storeNdInst;
71 static const Subgroup2DBlockPrefetchInstruction prefetchNdInst;
72 static const StoreScatterInstruction storeScatterInst;
73 static const LoadGatherInstruction loadGatherInst;
74 static const Instruction *arr[] = {&dpasInst, &loadNdInst,
75 &storeNdInst, &prefetchNdInst,
76 &storeScatterInst, &loadGatherInst};
77 return arr;
78}
79} // namespace detail
80
81struct PVCuArch final : public Xe2 {
82 PVCuArch() : Xe2(Kind::PVC, detail::getXe2InstructionRegistry()) {}
83 static bool classof(const uArch *u) { return u->getKind() == Kind::PVC; }
84 static const uArch *getInstance() {
85 static const PVCuArch instance;
86 return &instance;
87 }
88};
89
90struct BMGuArch final : public Xe2 {
91 BMGuArch() : Xe2(Kind::BMG, detail::getXe2InstructionRegistry()) {}
92 static bool classof(const uArch *u) { return u->getKind() == Kind::BMG; }
93 static const uArch *getInstance() {
94 static const BMGuArch instance;
95 return &instance;
96 }
97};
98
99} // namespace uArch
100} // namespace xegpu
101} // namespace mlir
102
103#endif // MLIR_DIALECT_XEGPU_UARCH_INTELGPUXE2_H
llvm::ArrayRef< const Instruction * > getXe2InstructionRegistry()
Definition IntelGpuXe2.h:67
Include the generated interface declarations.
static bool classof(const uArch *u)
Definition IntelGpuXe2.h:92
static const uArch * getInstance()
Definition IntelGpuXe2.h:93
static bool classof(const uArch *u)
Definition IntelGpuXe2.h:83
static const uArch * getInstance()
Definition IntelGpuXe2.h:84
int getSubgroupSize() const override
Definition IntelGpuXe2.h:27
unsigned getGeneralPackedFormatBitSize() const override
Definition IntelGpuXe2.h:28
const BlockIOMemoryRestrictions & getBlockIOMemoryRestrictions() const override
Definition IntelGpuXe2.h:44
static bool classof(const uArch *u)
Definition IntelGpuXe2.h:55
Xe2(Kind kind, llvm::ArrayRef< const Instruction * > instructionRegistry)
Definition IntelGpuXe2.h:25
llvm::SmallDenseMap< InstructionKind, const Instruction *, 32 > instructionRegistry
Definition uArchBase.h:160
uArch(Kind kind, llvm::ArrayRef< const Instruction * > instructionRegistry)
Definition uArchBase.h:131