MLIR 24.0.0git
IntelGpuXe3p.h
Go to the documentation of this file.
1//===--- IntelGpuXe3p.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// Xe3p uArch definition. Xe3p is a derivative of the third generation of Intel
11// Xe GPUs and includes Crescent Island (CRI). Note that plain Xe3 exposes no
12// XeGPU-relevant differences over Xe2 and is therefore covered by
13// IntelGpuXe2.h; only the Xe3p derivative is modelled here.
14//
15// The base instruction set comes from the shared Khronos OpenCL extensions
16// defined in uArchBase.h; on top of those Xe3p adds the scaled DPAS (MXFP)
17// extension and relaxes the 2D block memory restrictions. Subclass and override
18// here only when an Xe3p-specific instruction diverges from the SPIRV defaults.
19//
20//===----------------------------------------------------------------------===//
21#ifndef MLIR_DIALECT_XEGPU_UARCH_INTELGPUXE3P_H
22#define MLIR_DIALECT_XEGPU_UARCH_INTELGPUXE3P_H
23
25
26namespace mlir {
27namespace xegpu {
28namespace uArch {
29struct Xe3p : public uArch {
32 int getSubgroupSize() const override { return 16; }
33 unsigned getGeneralPackedFormatBitSize() const override { return 32; }
34
35 // Restrictions Xe3p places on the 2D memory region accessed by the subgroup
36 // 2D block load / store / prefetch instructions.
37 //
38 // Xe3p relaxes every one of these relative to Xe2, which requires a 64 byte
39 // aligned base address, a base width and pitch of at least 32 bytes, and a
40 // pitch that is a multiple of 16 bytes. On Xe3p the base address, width and
41 // pitch all only need to be a multiple of 4 bytes. There is no minimum size
42 // restriction on the width or the pitch, so their minimum is just that 4 byte
43 // granularity -- a zero-sized surface would be meaningless.
46 static constexpr BlockIOMemoryRestrictions restrictions = {
47 /*baseAddressAlignmentBytes=*/4,
48 /*minBaseWidthBytes=*/4,
49 /*baseWidthAlignmentBytes=*/4,
50 /*minBasePitchBytes=*/4,
51 /*basePitchAlignmentBytes=*/4,
52 };
53 return restrictions;
54 }
55
56 static bool classof(const uArch *u) {
57 return u->getKind() >= Kind::Xe3p_First && u->getKind() <= Kind::Xe3p_Last;
58 }
59};
60
61//===----------------------------------------------------------------------===//
62// uArch instances
63//===----------------------------------------------------------------------===//
64
65namespace detail {
67 static const SubgroupMatrixMultiplyAcc dpasInst{16, 32};
68 static const SubgroupScaledMatrixMultiplyAcc dpasMxInst{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[] = {
75 &dpasInst, &dpasMxInst, &loadNdInst, &storeNdInst,
76 &prefetchNdInst, &storeScatterInst, &loadGatherInst};
77 return arr;
78}
79} // namespace detail
80
81struct CRIuArch final : public Xe3p {
82 CRIuArch() : Xe3p(Kind::CRI, detail::getXe3pInstructionRegistry()) {}
83 static bool classof(const uArch *u) { return u->getKind() == Kind::CRI; }
84 static const uArch *getInstance() {
85 static const CRIuArch instance;
86 return &instance;
87 }
88};
89} // namespace uArch
90} // namespace xegpu
91} // namespace mlir
92
93#endif // MLIR_DIALECT_XEGPU_UARCH_INTELGPUXE3P_H
llvm::ArrayRef< const Instruction * > getXe3pInstructionRegistry()
Include the generated interface declarations.
static const uArch * getInstance()
static bool classof(const uArch *u)
Xe3p(Kind kind, llvm::ArrayRef< const Instruction * > instructionRegistry)
const BlockIOMemoryRestrictions & getBlockIOMemoryRestrictions() const override
int getSubgroupSize() const override
static bool classof(const uArch *u)
unsigned getGeneralPackedFormatBitSize() const override
llvm::SmallDenseMap< InstructionKind, const Instruction *, 32 > instructionRegistry
Definition uArchBase.h:160
uArch(Kind kind, llvm::ArrayRef< const Instruction * > instructionRegistry)
Definition uArchBase.h:131