Skip to content

Commit a5fc3cb

Browse files
committed
fix: rebase IR family split onto current main
1 parent 0fefd50 commit a5fc3cb

4 files changed

Lines changed: 17 additions & 6845 deletions

File tree

include/PTO/IR/PTO.h

Lines changed: 7 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
//===- PTO.h - PTO Dialect --------------------------------------*- C++ -*-===//
1010
//===----------------------------------------------------------------------===//
1111
//
12-
// This file defines the dialect for the PTO Dialect.
12+
// This compatibility header aggregates the common PTO IR declarations and all
13+
// PTO operation classes. Internal components should include their narrow owner
14+
// header when they do not require the complete operation surface.
1315
//
1416
//===----------------------------------------------------------------------===//
1517

@@ -30,123 +32,17 @@
3032
#include "mlir/Interfaces/InferTypeOpInterface.h"
3133
#include "mlir/Interfaces/ViewLikeInterface.h"
3234

33-
//===----------------------------------------------------------------------===//
34-
// PTO Dialect
35-
//===----------------------------------------------------------------------===//
36-
37-
#include "PTO/IR/PTODialect.h"
38-
39-
//===----------------------------------------------------------------------===//
40-
// PTO Enums
41-
//===----------------------------------------------------------------------===//
42-
43-
#include "PTO/IR/PTOEnums.h.inc"
44-
45-
//===----------------------------------------------------------------------===//
46-
// PTO Interfaces
47-
//===----------------------------------------------------------------------===//
48-
49-
#include "PTO/IR/PTOInterfaces.h.inc"
50-
#include "PTO/IR/VPTOInterfaces.h.inc"
51-
52-
//===----------------------------------------------------------------------===//
53-
// PTO Attributes
54-
//===----------------------------------------------------------------------===//
55-
56-
#define GET_ATTRDEF_CLASSES
57-
#include "PTO/IR/PTOAttrs.h.inc"
58-
59-
//===----------------------------------------------------------------------===//
60-
// PTO Types
61-
//===----------------------------------------------------------------------===//
62-
63-
#define GET_TYPEDEF_CLASSES
64-
#include "PTO/IR/PTOTypeDefs.h.inc"
65-
66-
//===----------------------------------------------------------------------===//
67-
// PTO Dialect Operations
68-
//===----------------------------------------------------------------------===//
69-
70-
namespace mlir {
71-
namespace pto {
72-
73-
//===----------------------------------------------------------------------===//
74-
// S Fractal Size Constants
75-
//===----------------------------------------------------------------------===//
76-
77-
/// Fractal size for mxBox layout (16x2 inner block, 32 bytes total).
78-
inline constexpr int32_t kFractalMxSize = 32;
79-
80-
/// Fractal size for AB matrices in matmul (16xN inner block, 512 bytes).
81-
inline constexpr int32_t kFractalABSize = 512;
82-
83-
/// Fractal size for C matrix in matmul (16x16 inner block, 1024 bytes).
84-
inline constexpr int32_t kFractalCSize = 1024;
85-
86-
struct DmaLoopConfig {
87-
Value count;
88-
Value srcStride;
89-
Value dstStride;
90-
};
91-
92-
struct DmaPadConfig {
93-
Value value;
94-
Value leftCount;
95-
Value rightCount;
96-
};
97-
98-
struct AccStoreModeConfig {
99-
AccStoreMode mode;
100-
std::optional<Value> split;
101-
std::optional<Value> loop0SrcStride;
102-
};
103-
104-
struct CubeLoadFracShapeConfig {
105-
Value nValue;
106-
Value dValue;
107-
};
108-
109-
struct CubeLoadFracSrcLayoutConfig {
110-
Value srcInnerStride;
111-
std::optional<Value> srcOuterStride;
112-
};
113-
114-
struct CubeLoadFracDstGroupConfig {
115-
Value groupCount;
116-
Value dstLoop2Stride;
117-
Value dstLoop3Stride;
118-
Value dstLoop4Stride;
119-
};
120-
121-
struct CubeLoadFracCtrlConfig {
122-
Value l2CacheCtrl;
123-
Value smallc0En;
124-
};
125-
126-
} // namespace pto
127-
} // namespace mlir
128-
129-
#define GET_OP_CLASSES
130-
#include "PTO/IR/PTOOps.h.inc"
35+
#include "PTO/IR/PTOBase.h"
36+
#include "PTO/IR/PTOTile.h"
37+
#include "PTO/IR/VMI.h"
38+
#include "PTO/IR/VPTO.h"
13139

13240
namespace mlir {
13341
class MLIRContext;
13442
class TypeConverter;
13543

13644
namespace pto {
13745

138-
inline constexpr char kPTOTargetArchAttrName[] = "pto.target_arch";
139-
140-
/// Get PTO Address Space Attr from input type.
141-
AddressSpaceAttr getPTOAddressSpaceAttr(Type type);
142-
143-
/// Return true if type is a ptr/memref in GM address space (or default).
144-
145-
enum class PTOArch {
146-
A3,
147-
A5,
148-
};
149-
15046
/// The semantic form selected by the optional third tile of pto.tmov. The
15147
/// public operand remains named `fp` for API compatibility; address space is
15248
/// the sole discriminator between legacy FP and exponent X-to-ZZ lowering.
@@ -166,47 +62,11 @@ bool isTargetArchA5(ModuleOp module);
16662
bool isTargetArchA3(Operation *op);
16763
bool isTargetArchA5(Operation *op);
16864

169-
enum class PTOParserTargetArch {
170-
Unspecified,
171-
A3,
172-
A5,
173-
};
174-
175-
void setPTOParserTargetArch(MLIRContext *context, PTOParserTargetArch arch);
176-
PTOParserTargetArch getPTOParserTargetArch(MLIRContext *context);
177-
178-
class ScopedPTOParserTargetArch {
179-
public:
180-
explicit ScopedPTOParserTargetArch(MLIRContext *context,
181-
PTOParserTargetArch arch);
182-
~ScopedPTOParserTargetArch();
183-
184-
private:
185-
MLIRContext *context;
186-
PTOParserTargetArch previousArch;
187-
};
188-
18965
/// Return the target-specific alignment size in bytes for a supported
19066
/// load/store vector op. Unsupported operations, modes, and targets return
19167
/// std::nullopt.
19268
std::optional<int64_t> getLoadStoreVecAlignmentSize(Operation *op);
19369

194-
/// Function attributes that mark an explicit PTO kernel entry.
195-
inline constexpr llvm::StringLiteral kPTOEntryAttrName = "pto.entry";
196-
inline constexpr llvm::StringLiteral kLegacyHACCEntryAttrName = "hacc.entry";
197-
inline constexpr llvm::StringLiteral kPTOKernelAttrName = "pto.kernel";
198-
inline constexpr llvm::StringLiteral kLegacyPTOAICoreAttrName = "pto.aicore";
199-
inline constexpr llvm::StringLiteral kPTOSimtEntryAttrName = "pto.simt_entry";
200-
inline constexpr llvm::StringLiteral kPTOSimtMaxThreadsAttrName =
201-
"pto.simt_max_threads";
202-
inline constexpr llvm::StringLiteral kPTOSimtMaxRegistersAttrName =
203-
"pto.simt_max_regs";
204-
inline constexpr llvm::StringLiteral kPTOVisibilityAttrName = "pto.visibility";
205-
inline constexpr llvm::StringLiteral kPTOVisibilityInternalValue = "internal";
206-
inline constexpr llvm::StringLiteral kPTOVisibilityExternalValue = "external";
207-
inline constexpr llvm::StringLiteral kPTODSLLogicalNameAttrName =
208-
"pto.ptodsl.logical_name";
209-
21070
/// Return the PTODSL logical function name when present, otherwise fall back to
21171
/// the current symbol name. PTODSL uses this to mark ABI-specialized helper and
21272
/// kernel-module symbols without relying on symbol-name parsing.

0 commit comments

Comments
 (0)