-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGARelAttr.td
More file actions
73 lines (58 loc) · 1.84 KB
/
Copy pathGARelAttr.td
File metadata and controls
73 lines (58 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef GAREL_ATTR
#define GAREL_ATTR
include "mlir/IR/BuiltinAttributeInterfaces.td"
include "GARelDialect.td"
class GARel_Attr<string name, string attrMnemonic, list<Trait> traits = []>
: AttrDef<GARel_Dialect, name, traits> {
let mnemonic = attrMnemonic;
}
def JoinPredicate : GARel_Attr<"JoinPredicate", "join_pred"> {
let summary = "A binary equality join predicate";
let parameters = (ins
"std::int32_t":$lhsRelIdx,
"ColumnIdx":$lhsColIdx,
"std::int32_t":$rhsRelIdx,
"ColumnIdx":$rhsColIdx);
let assemblyFormat = [{
`<` $lhsRelIdx `[` $lhsColIdx `]` `=` $rhsRelIdx `[` $rhsColIdx `]` `>`
}];
}
def JoinPredicates : ArrayOfAttr<
GARel_Dialect,
"JoinPredicates",
"join_preds",
"JoinPredicateAttr">;
def AggregateFunc : I64EnumAttr<
"AggregateFunc", "",
[
I64EnumAttrCase<"SUM", 0>,
I64EnumAttrCase<"MIN", 1>,
I64EnumAttrCase<"MAX", 2>,
I64EnumAttrCase<"LOR", 3>, /* Logical OR (over i1) */
I64EnumAttrCase<"ARGMIN", 4>,
I64EnumAttrCase<"COUNT", 5>,
]
> {
let cppNamespace = "::garel";
}
// NOTE: assumes an aggregator produces exactly one output column.
def Aggregator : GARel_Attr<"Aggregator", "aggregator"> {
let summary = "Aggregate function with bound input columns";
let parameters = (ins
"AggregateFunc":$func,
OptionalArrayRefParameter<"ColumnIdx">:$inputs);
let assemblyFormat = [{
`<` $func (`>`) : ($inputs^ `>`)?
}];
let genVerifyDecl = 1;
let extraClassDeclaration = [{
/** Type for values in the output column. */
mlir::Type getResultType(::mlir::Type relType);
}];
}
def Aggregators : ArrayOfAttr<
GARel_Dialect,
"Aggregators",
"aggregators",
"AggregatorAttr">;
#endif // GAREL_ATTR