Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
54ef742134
!60 [sync] PR-58: [MLIR17] Adaptation to llvm17/mlir17.
From: @openeuler-sync-bot 
Reviewed-by: @wumingchuan 
Signed-off-by: @wumingchuan
2024-04-10 11:11:43 +00:00
Mingchuan Wu
648012d1a0 [MLIR17] Adaptation to llvm17/mlir17.
(cherry picked from commit a92d7d08db52a84bcd1c3f2b9ebb4eb860f46455)
2024-04-10 15:52:07 +08:00
Mingchuan Wu
cfa9847203 [sync] Sync patch from openEuler/pin-server
(cherry picked from commit dc67116851cf691609f9677eb8a40ce7e1bf99e1)
2024-04-10 15:52:07 +08:00
openeuler-ci-bot
cf6aaf2eb6
!54 【LLVM平行宇宙】Add toolchain switch support
From: @liyunfei33 
Reviewed-by: @wumingchuan 
Signed-off-by: @wumingchuan
2023-08-24 13:30:13 +00:00
liyunfei
03dedd2449 Add toolchain switch support 2023-08-23 10:12:39 +08:00
openeuler-ci-bot
25c7020d10
!52 [FIX] fix the adaptation to grpc-1.54.2
From: @dguangya 
Reviewed-by: @wumingchuan 
Signed-off-by: @wumingchuan
2023-08-14 08:08:36 +00:00
dingguangya
8dbcfb5cd0 [FIX] fix the adaptation to grpc-1.54.2 2023-08-14 15:47:33 +08:00
openeuler-ci-bot
739194e106
!50 [Pin-server] Adaptation to llvm15/mlir15 and gcc12 only solves the build problem
From: @dguangya 
Reviewed-by: @wumingchuan 
Signed-off-by: @wumingchuan
2023-08-07 11:42:49 +00:00
dingguangya
af2386040b [FIX] Adaptation to gcc12 only solves the build problem 2023-08-07 19:31:44 +08:00
dingguangya
a6436edf4d [FIX] Adaptation to llvm15/mlir15 only solves the build problem 2023-08-07 19:29:58 +08:00
8 changed files with 3695 additions and 7 deletions

View File

@ -0,0 +1,594 @@
From 2a7a5172e49b769b1cee968ed3cbe49ef4174d04 Mon Sep 17 00:00:00 2001
From: dingguangya <dingguangya1@huawei.com>
Date: Mon, 7 Aug 2023 16:59:17 +0800
Subject: [PATCH 1/2] [Pin-server] Adaptation to llvm15/mlir15 only solves the
build problem
diff --git a/include/Dialect/PluginDialect.td b/include/Dialect/PluginDialect.td
index 56f2e4c..7627be8 100644
--- a/include/Dialect/PluginDialect.td
+++ b/include/Dialect/PluginDialect.td
@@ -24,6 +24,7 @@
#define PLUGIN_DIALECT_TD
include "mlir/IR/OpBase.td"
+include "mlir/IR/EnumAttr.td"
//===----------------------------------------------------------------------===//
// Plugin Dialect Definition.
@@ -36,6 +37,10 @@ def Plugin_Dialect : Dialect {
let summary = "The Plugin Dialect.";
let description = [{}];
let cppNamespace = "::mlir::Plugin";
+
+ let extraClassDeclaration = [{
+ void registerTypes();
+ }];
}
// Base class for Plugin dialect operations. This operation inherits from the base
@@ -43,7 +48,7 @@ def Plugin_Dialect : Dialect {
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Plugin_Op<string mnemonic, list<OpTrait> traits = []> :
+class Plugin_Op<string mnemonic, list<Trait> traits = []> :
Op<Plugin_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
@@ -58,7 +63,7 @@ def IComparisonLTGT : I32EnumAttrCase<"ltgt", 4>;
def IComparisonEQ : I32EnumAttrCase<"eq", 5>;
def IComparisonNE : I32EnumAttrCase<"ne", 6>;
def IComparisonUNDEF : I32EnumAttrCase<"UNDEF", 7>;
-def IComparisonAttr : I32EnumAttr<
+def IComparisonCode : I32EnumAttr<
"IComparisonCode", "plugin comparison code",
[IComparisonLT, IComparisonLE, IComparisonGT, IComparisonGE,
IComparisonLTGT, IComparisonEQ, IComparisonNE, IComparisonUNDEF]>{
@@ -80,7 +85,7 @@ def IDefineCodeBLOCK : I32EnumAttrCase<"BLOCK", 11>;
def IDefineCodeCOMPONENT : I32EnumAttrCase<"COMPONENT", 12>;
def IDefineCodeTYPEDECL : I32EnumAttrCase<"TYPEDECL", 13>;
def IDefineCodeUNDEF : I32EnumAttrCase<"UNDEF", 14>;
-def IDefineCodeAttr : I32EnumAttr<
+def IDefineCode : I32EnumAttr<
"IDefineCode", "plugin define code",
[IDefineCodeMemRef, IDefineCodeIntCST, IDefineCodeSSA, IDefineCodeLIST,
IDefineCodeStrCST, IDefineCodeArrayRef, IDefineCodeDecl, IDefineCodeFieldDecl, IDefineCodeAddrExp,
@@ -102,7 +107,7 @@ def IExprCodeLshift : I32EnumAttrCase<"Lshift", 9>;
def IExprCodeRshift : I32EnumAttrCase<"Rshift", 10>;
def IExprCodeNop : I32EnumAttrCase<"Nop", 11>;
def IExprCodeUNDEF : I32EnumAttrCase<"UNDEF", 12>;
-def IExprCodeAttr : I32EnumAttr<
+def IExprCode : I32EnumAttr<
"IExprCode", "plugin expr code",
[IExprCodePlus, IExprCodeMinus, IExprCodeMult,
IExprCodePtrPlus, IExprCodeMin, IExprCodeMax,
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
index c06a4ad..51a2b10 100644
--- a/include/Dialect/PluginOps.td
+++ b/include/Dialect/PluginOps.td
@@ -38,7 +38,7 @@ def CGnodeOp : Plugin_Op<"callgraphnode", [NoSideEffect]> {
// the `state` that MLIR uses to create operations, i.e. these are used when
// using `builder.create<Op>(...)`.
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id,
+ OpBuilder<(ins "uint64_t":$id,
"StringRef":$symbolName,
"bool":$definition,
"uint32_t":$order)>
@@ -67,11 +67,11 @@ def FunctionOp : Plugin_Op<"function", [NoSideEffect]> {
// the `state` that MLIR uses to create operations, i.e. these are used when
// using `builder.create<Op>(...)`.
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id,
+ OpBuilder<(ins "uint64_t":$id,
"StringRef":$funcName,
"bool":$declaredInline,
"Type":$type, "bool":$validType)>,
- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$funcName, "bool":$declaredInline, "bool":$validType)>
+ OpBuilder<(ins "uint64_t":$id, "StringRef":$funcName, "bool":$declaredInline, "bool":$validType)>
];
let extraClassDeclaration = [{
@@ -91,7 +91,7 @@ def LocalDeclOp : Plugin_Op<"declaration", [NoSideEffect]> {
OptionalAttr<UI64Attr>:$typeWidth);
let regions = (region AnyRegion:$bodyRegion);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$symName,
+ OpBuilder<(ins "uint64_t":$id, "StringRef":$symName,
"int64_t":$typeID, "uint64_t":$typeWidth)>
];
}
@@ -108,7 +108,7 @@ def LoopOp : Plugin_Op<"loop", [NoSideEffect]> {
OptionalAttr<UI32Attr>:$numBlock);
let regions = (region AnyRegion:$bodyRegion);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "uint32_t":$index,
+ OpBuilder<(ins "uint64_t":$id, "uint32_t":$index,
"uint64_t":$innerLoopId, "uint64_t":$outerLoopId,
"uint32_t":$numBlock)>
];
@@ -143,13 +143,13 @@ def CallOp : Plugin_Op<"call", [
OptionalAttr<FlatSymbolRefAttr>:$callee,
Variadic<AnyType>:$inputs);
let builders = [
- OpBuilderDAG<(ins "int64_t":$id, "StringRef":$callee,
+ OpBuilder<(ins "int64_t":$id, "StringRef":$callee,
"ArrayRef<Value>":$arguments)>,
- OpBuilderDAG<(ins "int64_t":$id,
+ OpBuilder<(ins "int64_t":$id,
"ArrayRef<Value>":$arguments)>,
// Only for server.
- OpBuilderDAG<(ins "Value":$func, "ArrayRef<Value>":$arguments)>,
- OpBuilderDAG<(ins "ArrayRef<Value>":$arguments)>
+ OpBuilder<(ins "Value":$func, "ArrayRef<Value>":$arguments)>,
+ OpBuilder<(ins "ArrayRef<Value>":$arguments)>
];
let extraClassDeclaration = [{
bool SetLHS(Value lhs);
@@ -164,7 +164,7 @@ def PhiOp : Plugin_Op<"phi", [NoSideEffect]> {
UI32Attr:$nArgs,
Variadic<AnyType>:$operands);
let builders = [
- OpBuilderDAG<(ins "ArrayRef<Value>":$operands,
+ OpBuilder<(ins "ArrayRef<Value>":$operands,
"uint64_t":$id,
"uint32_t":$capacity,
"uint32_t":$nArgs)>
@@ -182,13 +182,13 @@ def AssignOp : Plugin_Op<"assign", [NoSideEffect]> {
let summary = "assign op";
let description = [{TODO}];
let arguments = (ins UI64Attr:$id,
- IExprCodeAttr:$exprCode,
+ IExprCode:$exprCode,
Variadic<AnyType>:$operands);
let builders = [
- OpBuilderDAG<(ins "ArrayRef<Value>":$operands,
+ OpBuilder<(ins "ArrayRef<Value>":$operands,
"uint64_t":$id, "IExprCode":$exprCode)>,
// Only for server.
- OpBuilderDAG<(ins "ArrayRef<Value>":$operands,
+ OpBuilder<(ins "ArrayRef<Value>":$operands,
"IExprCode":$exprCode)>
];
let extraClassDeclaration = [{
@@ -204,7 +204,7 @@ def NopOp : Plugin_Op<"nop", [NoSideEffect]> {
let arguments = (ins UI64Attr:$id);
let results = (outs AnyType);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id)>,
+ OpBuilder<(ins "uint64_t":$id)>,
];
}
@@ -213,13 +213,13 @@ def EHElseOp : Plugin_Op<"eh_else", [NoSideEffect]> {
let description = [{TODO}];
let arguments = (ins UI64Attr:$id, ArrayAttr:$nBody, ArrayAttr:$eBody);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "ArrayRef<uint64_t>":$nBody, "ArrayRef<uint64_t>":$eBody)>,
+ OpBuilder<(ins "uint64_t":$id, "ArrayRef<uint64_t>":$nBody, "ArrayRef<uint64_t>":$eBody)>,
];
}
class Placeholder<string mnemonic> : Plugin_Op<mnemonic, [SameVariadicOperandSize]> {
dag commonArgs = (ins UI64Attr:$id,
- OptionalAttr<IDefineCodeAttr>:$defCode,
+ OptionalAttr<IDefineCode>:$defCode,
OptionalAttr<BoolAttr>:$readOnly);
let results = (outs AnyType);
let arguments = commonArgs;
@@ -311,7 +311,7 @@ def PlaceholderOp : Placeholder<"palceholder"> {
let summary = "PlaceHolder";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "Type":$retType)>
];
}
@@ -320,7 +320,7 @@ def DeclBaseOp : DeclBase<"decl"> {
let summary = "DeclBaseOp";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "bool":$addressable, "bool":$used, "int":$uid, "Value":$initial,
"Value":$name, "Optional<uint64_t>":$chain, "Type":$retType)>
];
@@ -336,7 +336,7 @@ def BlockOp : BLOCK<"block"> {
let summary = "BlockOp";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "Optional<Value>":$vars, "Optional<uint64_t>":$supercontext,
"Optional<Value>":$subblocks, "Optional<Value>":$chain,
"Optional<Value>":$abstract_origin, "Type":$retType)>
@@ -355,7 +355,7 @@ def VecOp : Vec<"vector"> {
let summary = "VectorOp";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "int":$len, "ArrayRef<Value>":$elements, "Type":$retType)>
];
}
@@ -365,7 +365,7 @@ def FieldDeclOp : FieldDecl<"field"> {
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "bool":$addressable, "bool":$used, "int":$uid, "Value":$initial,
"Value":$name, "uint64_t":$chain, "Value":$fieldOffset, "Value":$fieldBitOffset, "Type":$retType)>
];
@@ -396,7 +396,7 @@ def AddressOp : Address<"address"> {
let summary = "AddressOp";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "Value":$operand, "Type":$retType)>
];
let extraClassDeclaration = [{
@@ -409,7 +409,7 @@ def ConstructorOp : Constructor<"constructor"> {
let summary = "ConstructorOp";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "int32_t":$len, "ArrayRef<Value>":$idx, "ArrayRef<Value>":$val,
"Type":$retType)>
];
@@ -422,7 +422,7 @@ def ComponentOp : ComponentRef<"component"> {
let summary = "Component reference op";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
"Value":$component, "Value":$field, "Type":$retType)>
];
let results = (outs AnyType);
@@ -437,7 +437,7 @@ def PointerOp : Pointer<"pointer"> {
let summary = "pointer";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
"bool":$readOnly, "Type":$retType,
"bool":$pointerReadOnly)>
];
@@ -447,7 +447,7 @@ def MemOp : MemRef<"MemRef"> {
let summary = "Memory reference op";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
"Value":$base, "Value":$offset, "Type":$retType)>
];
let results = (outs AnyType);
@@ -462,7 +462,7 @@ def SSAOp : SSA<"SSA"> {
let summary = "SSA";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
"uint64_t":$nameVarId, "uint64_t":$ssaParmDecl, "uint64_t":$version,
"uint64_t":$definingId, "Type":$retType)>
];
@@ -480,7 +480,7 @@ def ConstOp : Constant<"constant value"> {
let summary = "const value";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
"Attribute":$init, "Type":$retType)>
];
let extraClassDeclaration = [{
@@ -493,7 +493,7 @@ def ListOp : List<"list"> {
let summary = "ListOp";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
"bool":$hasPurpose, "ArrayRef<Value>":$operands, "Type":$retType)>
];
let results = (outs AnyType);
@@ -506,7 +506,7 @@ def StrOp : StringCST<"string"> {
let summary = "string";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,"StringRef":$str, "Type":$retType)>
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,"StringRef":$str, "Type":$retType)>
];
}
@@ -514,7 +514,7 @@ def ArrayOp : ArrayRef<"array ref"> {
let summary = "array ref";
let description = [{TODO}];
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
+ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,
"Value":$base, "Value":$offset, "Type":$retType)>
];
let results = (outs AnyType);
@@ -531,7 +531,7 @@ def BaseOp : Plugin_Op<"statement_base", [NoSideEffect]> {
let arguments = (ins UI64Attr:$id, StrAttr:$opCode);
let results = (outs AnyType);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$opCode)>
+ OpBuilder<(ins "uint64_t":$id, "StringRef":$opCode)>
];
}
@@ -541,7 +541,7 @@ def DebugOp : Plugin_Op<"debug", [NoSideEffect]> {
let arguments = (ins UI64Attr:$id);
let results = (outs AnyType);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id)>
+ OpBuilder<(ins "uint64_t":$id)>
];
}
def AsmOp : Plugin_Op<"asm", [NoSideEffect]> {
@@ -551,7 +551,7 @@ def AsmOp : Plugin_Op<"asm", [NoSideEffect]> {
Variadic<AnyType>:$operands);
let results = (outs AnyType:$result);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$statement, "uint32_t":$nInputs, "uint32_t":$nOutputs,
+ OpBuilder<(ins "uint64_t":$id, "StringRef":$statement, "uint32_t":$nInputs, "uint32_t":$nOutputs,
"uint32_t":$nClobbers, "ArrayRef<Value>":$operands)>
];
@@ -572,7 +572,7 @@ def LabelOp : Plugin_Op<"label", [NoSideEffect]> {
let results = (outs AnyType:$result);
let arguments = (ins UI64Attr:$id, AnyType:$index);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "Value":$index)>
+ OpBuilder<(ins "uint64_t":$id, "Value":$index)>
];
let extraClassDeclaration = [{
Value GetLabelLabel() { return this->getOperation()->getOperand(0); };
@@ -585,7 +585,7 @@ def EHMntOp : Plugin_Op<"eh_mnt", [NoSideEffect]> {
let results = (outs AnyType:$result);
let arguments = (ins UI64Attr:$id, AnyType:$decl);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "Value":$decl)>
+ OpBuilder<(ins "uint64_t":$id, "Value":$decl)>
];
let extraClassDeclaration = [{
Value Getfndecl() { return decl(); };
@@ -598,7 +598,7 @@ def BindOp : Plugin_Op<"Bind", [NoSideEffect]> {
let results = (outs AnyType:$result);
let arguments = (ins UI64Attr:$id, AnyType:$vars, ArrayAttr:$body, AnyType:$block);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "Value":$vars, "ArrayRef<uint64_t>":$body, "Value":$block)>
+ OpBuilder<(ins "uint64_t":$id, "Value":$vars, "ArrayRef<uint64_t>":$body, "Value":$block)>
];
let extraClassDeclaration = [{
Value GetVars() { return vars(); };
@@ -612,7 +612,7 @@ def TryOp : Plugin_Op<"try", [NoSideEffect]> {
let results = (outs AnyType:$result);
let arguments = (ins UI64Attr:$id, ArrayAttr:$eval, ArrayAttr:$cleanup, UI64Attr:$kind);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "ArrayRef<uint64_t>":$eval, "ArrayRef<uint64_t>":$cleanup, "uint64_t":$kind)>
+ OpBuilder<(ins "uint64_t":$id, "ArrayRef<uint64_t>":$eval, "ArrayRef<uint64_t>":$cleanup, "uint64_t":$kind)>
];
}
@@ -622,7 +622,7 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> {
let results = (outs AnyType:$result);
let arguments = (ins UI64Attr:$id, AnyType:$types, ArrayAttr:$handler);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "Value":$types, "ArrayRef<uint64_t>":$handler)>
+ OpBuilder<(ins "uint64_t":$id, "Value":$types, "ArrayRef<uint64_t>":$handler)>
];
let extraClassDeclaration = [{
Value GetTypes() { return types(); };
@@ -631,7 +631,7 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> {
// Terminators
// Opaque builder used for terminator operations that contain successors.
-class Plugin_TerminatorOp<string mnemonic, list<OpTrait> traits = []> :
+class Plugin_TerminatorOp<string mnemonic, list<Trait> traits = []> :
Plugin_Op<mnemonic, !listconcat(traits, [Terminator])>;
def SwitchOp : Plugin_TerminatorOp<"switch", [NoSideEffect]> {
@@ -645,7 +645,7 @@ def SwitchOp : Plugin_TerminatorOp<"switch", [NoSideEffect]> {
UI64Attr:$defaultaddr, ArrayAttr:$caseaddrs);
let results = (outs AnyType:$result);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel,
+ OpBuilder<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel,
"ArrayRef<Value>":$operands, "Block*":$defaultDestination, "uint64_t":$defaultaddr,
"ArrayRef<Block*>":$caseDestinations, "ArrayRef<uint64_t>":$caseaddrs)>
];
@@ -665,9 +665,9 @@ def FallThroughOp : Plugin_TerminatorOp<"fallthrough", [NoSideEffect]> {
let arguments = (ins UI64Attr:$address, UI64Attr:$destaddr);
let results = (outs AnyType);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$address, "Block*":$dest, "uint64_t":$destaddr)>,
+ OpBuilder<(ins "uint64_t":$address, "Block*":$dest, "uint64_t":$destaddr)>,
// Only for server.
- OpBuilderDAG<(ins "Block*":$src, "Block*":$dest)>
+ OpBuilder<(ins "Block*":$src, "Block*":$dest)>
];
}
@@ -675,7 +675,7 @@ def CondOp : Plugin_TerminatorOp<"condition", [NoSideEffect]> {
let summary = "condition op";
let description = [{TODO}];
let arguments = (ins UI64Attr:$id, UI64Attr:$address,
- IComparisonAttr:$condCode,
+ IComparisonCode:$condCode,
AnyType:$LHS, AnyType:$RHS,
UI64Attr:$tbaddr,
UI64Attr:$fbaddr,
@@ -683,12 +683,12 @@ def CondOp : Plugin_TerminatorOp<"condition", [NoSideEffect]> {
OptionalAttr<TypeAttr>:$falseLabel);
let successors = (successor AnySuccessor:$tb, AnySuccessor:$fb);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "IComparisonCode":$condCode,
+ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "IComparisonCode":$condCode,
"Value":$lhs, "Value":$rhs, "Block*":$tb, "Block*":$fb,
"uint64_t":$tbaddr, "uint64_t":$fbaddr, "Value":$trueLabel,
"Value":$falseLabel)>,
// Only for server.
- OpBuilderDAG<(ins "IComparisonCode":$condCode, "Value":$lhs,
+ OpBuilder<(ins "IComparisonCode":$condCode, "Value":$lhs,
"Value":$rhs, "Block*":$tb, "Block*":$fb)>
];
let extraClassDeclaration = [{
@@ -704,7 +704,7 @@ def RetOp : Plugin_TerminatorOp<"ret", [NoSideEffect]> {
let arguments = (ins UI64Attr:$address); // for bb address
let results = (outs AnyType);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$address)>
+ OpBuilder<(ins "uint64_t":$address)>
];
}
@@ -715,7 +715,7 @@ def GotoOp : Plugin_TerminatorOp<"goto", [NoSideEffect]> {
let results = (outs AnyType);
let successors = (successor AnySuccessor:$success);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "Value":$dest, "Block*":$success, "uint64_t":$successaddr)>
+ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "Value":$dest, "Block*":$success, "uint64_t":$successaddr)>
];
let extraClassDeclaration = [{
@@ -731,7 +731,7 @@ def TransactionOp : Plugin_TerminatorOp<"transaction", [NoSideEffect]> {
let results = (outs AnyType);
let successors = (successor AnySuccessor:$fallthrough, AnySuccessor:$abort);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "ArrayRef<uint64_t>":$stmtaddr, "Value":$labelNorm,
+ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "ArrayRef<uint64_t>":$stmtaddr, "Value":$labelNorm,
"Value":$labelUninst, "Value":$labelOver, "Block*":$fallthrough, "uint64_t":$fallthroughaddr,
"Block*":$abort, "uint64_t":$abortaddr)>
];
@@ -749,7 +749,7 @@ def ResxOp : Plugin_TerminatorOp<"resx", [NoSideEffect]> {
let arguments = (ins UI64Attr:$id, UI64Attr:$address, UI64Attr:$region);
let results = (outs AnyType);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region)>
+ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region)>
];
let extraClassDeclaration = [{
uint64_t GetTransactionNormal() { return region(); }
@@ -763,7 +763,7 @@ def EHDispatchOp : Plugin_TerminatorOp<"dispatch", [NoSideEffect]> {
let results = (outs AnyType);
let successors = (successor VariadicSuccessor<AnySuccessor>:$ehHandlers);
let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region, "ArrayRef<Block*>":$ehHandlers,
+ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region, "ArrayRef<Block*>":$ehHandlers,
"ArrayRef<uint64_t>":$ehHandlersaddrs)>
];
let extraClassDeclaration = [{
diff --git a/lib/Dialect/PluginDialect.cpp b/lib/Dialect/PluginDialect.cpp
index 95a78da..7431d4b 100644
--- a/lib/Dialect/PluginDialect.cpp
+++ b/lib/Dialect/PluginDialect.cpp
@@ -27,23 +27,16 @@
using namespace mlir;
using namespace mlir::Plugin;
+#include "Dialect/PluginOpsDialect.cpp.inc"
+#include "Dialect/PluginOpsEnums.cpp.inc"
+
// ===----------------------------------------------------------------------===//
// Plugin dialect.
// ===----------------------------------------------------------------------===//
void PluginDialect::initialize()
{
- addTypes<
- PluginIR::PluginIntegerType,
- PluginIR::PluginFloatType,
- PluginIR::PluginPointerType,
- PluginIR::PluginArrayType,
- PluginIR::PluginVectorType,
- PluginIR::PluginFunctionType,
- PluginIR::PluginStructType,
- PluginIR::PluginBooleanType,
- PluginIR::PluginVoidType,
- PluginIR::PluginUndefType>();
+ registerTypes();
addOperations<
#define GET_OP_LIST
diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp
index a3462ed..3602856 100644
--- a/lib/Dialect/PluginOps.cpp
+++ b/lib/Dialect/PluginOps.cpp
@@ -673,7 +673,9 @@ void CallOp::build(OpBuilder &builder, OperationState &state,
{
state.addAttribute("id", builder.getI64IntegerAttr(id));
state.addOperands(arguments);
- state.addAttribute("callee", builder.getSymbolRefAttr(callee));
+ //state.addAttribute("callee", builder.getSymbolRefAttr(callee));
+ state.addAttribute("callee",
+ mlir::SymbolRefAttr::get(builder.getContext(), callee));
}
void CallOp::build(OpBuilder &builder, OperationState &state,
@@ -723,7 +725,9 @@ void CallOp::build(OpBuilder &builder, OperationState &state,
state.addAttribute("id", builder.getI64IntegerAttr(id));
state.addOperands(arguments);
// FIXME: DEF_BUILTIN.
- state.addAttribute("callee", builder.getSymbolRefAttr("ctzll"));
+ //state.addAttribute("callee", builder.getSymbolRefAttr("ctzll"));
+ // state.addAttribute("callee",
+ // mlir::SymbolRefAttr::get(builder.getContext(), ctzll));
}
void CallOp::build(OpBuilder &builder, OperationState &state,
@@ -742,7 +746,9 @@ void CallOp::build(OpBuilder &builder, OperationState &state,
uint64_t id = pluginAPI.CreateCallOp(blockId, funcId, argIds);
state.addAttribute("id", builder.getI64IntegerAttr(id));
state.addOperands(arguments);
- state.addAttribute("callee", builder.getSymbolRefAttr("ctzll"));
+ //state.addAttribute("callee", builder.getSymbolRefAttr("ctzll"));
+ // state.addAttribute("ctzll",
+ // mlir::SymbolRefAttr::get(builder.getContext(), callee));
}
// ===----------------------------------------------------------------------===//
@@ -922,7 +928,9 @@ void AsmOp::build(OpBuilder &builder, OperationState &state,
uint32_t nClobbers, ArrayRef<Value> operands)
{
state.addAttribute("id", builder.getI64IntegerAttr(id));
- state.addAttribute("statement", builder.getSymbolRefAttr(statement));
+ //state.addAttribute("statement", builder.getSymbolRefAttr(statement));
+ state.addAttribute("callee",
+ mlir::SymbolRefAttr::get(builder.getContext(), statement));
state.addAttribute("nInputs", builder.getI32IntegerAttr(nInputs));
state.addAttribute("nOutputs", builder.getI32IntegerAttr(nOutputs));
state.addAttribute("nClobbers", builder.getI32IntegerAttr(nClobbers));
diff --git a/lib/Dialect/PluginTypes.cpp b/lib/Dialect/PluginTypes.cpp
index 416dbd7..38fd86f 100644
--- a/lib/Dialect/PluginTypes.cpp
+++ b/lib/Dialect/PluginTypes.cpp
@@ -24,6 +24,20 @@
using namespace mlir;
using namespace PluginIR;
+using namespace mlir::Plugin;
+
+void PluginDialect::registerTypes() {
+ addTypes<PluginIntegerType,
+ PluginFloatType,
+ PluginPointerType,
+ PluginArrayType,
+ PluginVectorType,
+ PluginFunctionType,
+ PluginStructType,
+ PluginBooleanType,
+ PluginVoidType,
+ PluginUndefType>();
+}
namespace PluginIR {
namespace detail {
--
2.33.0.windows.2

View File

@ -0,0 +1,44 @@
From 868531920b4f5a16f636219d44fbf36a9abd401b Mon Sep 17 00:00:00 2001
From: dingguangya <dingguangya1@huawei.com>
Date: Mon, 7 Aug 2023 17:02:15 +0800
Subject: [PATCH 2/2] [Pin-server] Adaptation to gcc12 only solves the build
problem
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 233f345..0a72863 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@ include(cmake/common.cmake)
#-------------------------------------------------------------------------------
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
find_package(MLIR REQUIRED CONFIG)
message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}")
@@ -46,7 +46,7 @@ add_definitions(${LLVM_DEFINITIONS})
include_directories(include)
-add_compile_options(-std=c++14 -Wall -fPIC)
+add_compile_options(-std=c++17 -Wall -fPIC)
# Proto file
get_filename_component(plg_proto "protos/plugin.proto" ABSOLUTE)
get_filename_component(plg_proto_path "${plg_proto}" PATH)
diff --git a/cmake/common.cmake b/cmake/common.cmake
index f18c25b..cf48699 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.1)
-set (CMAKE_CXX_STANDARD 14)
+set (CMAKE_CXX_STANDARD 17)
find_package(Threads REQUIRED)
--
2.33.0.windows.2

View File

@ -0,0 +1,44 @@
From 33aad2ac03adb20a71c430d5daa2ee52a6a96480 Mon Sep 17 00:00:00 2001
From: dingguangya <dingguangya1@huawei.com>
Date: Mon, 14 Aug 2023 14:45:31 +0800
Subject: [PATCH] [Pin-server] fix the adaptation to grpc-1.54.2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a72863..df8b634 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,8 @@ add_library(plg_grpc_proto STATIC
${plg_proto_srcs}
${plg_proto_hdrs})
target_link_libraries(plg_grpc_proto
+ ${GRPC_LIBRARY}
+ ${GPR_LIBRARY}
${GRPC_PP_REFLECTION_LIBRARY}
${GRPC_PP_LIBRARY}
${PROTOBUF_LIBRARY})
@@ -109,6 +111,8 @@ target_link_libraries(pin_server
pin_user
${JSONCPP_LIBRARY}
plg_grpc_proto
+ ${GRPC_LIBRARY}
+ ${GPR_LIBRARY}
${GRPC_PP_REFLECTION_LIBRARY}
${GRPC_PP_LIBRARY}
${PROTOBUF_LIBRARY}
diff --git a/cmake/common.cmake b/cmake/common.cmake
index cf48699..033d8c3 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -35,6 +35,8 @@ find_library(GRPC_PP_LIBRARY grpc++)
_CHECK(GRPC_PP_LIBRARY "GRPC_PP_LIBRARY-NOTFOUND" "libgrpc++.so")
find_library(GRPC_LIBRARY grpc)
_CHECK(GRPC_LIBRARY "GRPC_LIBRARY-NOTFOUND" "libgrpc.so")
+find_library(GPR_LIBRARY gpr)
+_CHECK(GPR_LIBRARY "GPR_LIBRARY-NOTFOUND" "libgpr.so")
# check abseil_synchronization
find_library(ABSEIL_SYNC_LIBRARY absl_synchronization)
--
2.33.0.windows.2

View File

@ -0,0 +1,26 @@
From 53b9b9ea326df8fec717260eda09e5d73d7a30cd Mon Sep 17 00:00:00 2001
From: qiujiacai <qiujiacai_yewu@cmss.chinamobile.com>
Date: Wed, 20 Sep 2023 18:28:49 +0800
Subject: [PATCH 4/7] [Pin-Server] Added null pointer check to avoid potential
null pointer problems
---
user/ArrayWidenPass.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/user/ArrayWidenPass.cpp b/user/ArrayWidenPass.cpp
index 475f784..cafb177 100644
--- a/user/ArrayWidenPass.cpp
+++ b/user/ArrayWidenPass.cpp
@@ -702,6 +702,8 @@ static bool checkBodyMemRef(Value memRef)
static bool checkBodyPointerPlus(Operation *op, Value &tmpIndex)
{
auto assignOp = dyn_cast<AssignOp>(op);
+ if(!assignOp)
+ return false;
Value rhs1 = assignOp.GetRHS1();
Value rhs2 = assignOp.GetRHS2();
--
2.33.0

View File

@ -0,0 +1,61 @@
From b239a7940f1439d425cb37729fe380db73734856 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=83=91=E6=99=A8=E5=8D=89?= <zhengchenhui1@huawei.com>
Date: Fri, 3 Nov 2023 11:39:12 +0800
Subject: [PATCH 5/7] [Pin-server] Bugfix for the operation sequence of
userOpts.
---
lib/PluginServer/PluginServer.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/PluginServer/PluginServer.cpp b/lib/PluginServer/PluginServer.cpp
index 8778019..9a8d5e5 100644
--- a/lib/PluginServer/PluginServer.cpp
+++ b/lib/PluginServer/PluginServer.cpp
@@ -23,6 +23,7 @@
#include <thread>
#include <fcntl.h>
#include <sys/stat.h>
+#include <mutex>
#include "PluginAPI/PluginServerAPI.h"
#include "user/user.h"
@@ -34,6 +35,8 @@ using namespace PluginOpt;
using std::cout;
using std::endl;
using std::pair;
+
+static std::mutex register_mutex; // 线程锁
PluginServer *PluginServer::pluginServerPtr = nullptr;
PluginServer *PluginServer::GetInstance()
{
@@ -273,6 +276,7 @@ void PluginServer::ParseArgv(const string& data)
void PluginServer::SendRegisteredUserOpts()
{
+ register_mutex.lock();
for (auto it = userOpts.begin(); it != userOpts.end(); it++) {
string key = "injectPoint";
for (auto& userOpt : it->second) {
@@ -286,6 +290,7 @@ void PluginServer::SendRegisteredUserOpts()
}
}
pluginCom.ServerSend("injectPoint", "finished");
+ register_mutex.unlock();
}
void PluginServer::ServerSemPost(const string& port)
@@ -307,8 +312,9 @@ void PluginServer::RunServer()
}
log->LOGI("Server ppid:%d listening on port:%s\n", getppid(), port.c_str());
ServerSemPost(port);
-
+ register_mutex.lock();
RegisterCallbacks();
+ register_mutex.unlock();
log->LOGI("RunServer: RegisterCallbacks Done.\n");
pluginCom.Run();
}
--
2.33.0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
Name: pin-server
Version: 0.4.0
Release: 10
Release: 16
Summary: Pin (Plug-IN framework) server provides plugin APIs for compiler optimization developers to develop optimization pass.
License: Apache 2.0
URL: https://gitee.com/openeuler/pin-server
Source0: %{name}-%{version}.tar.gz
BuildRequires: gcc gcc-c++ cmake make pkgconfig grpc grpc-plugins grpc-devel protobuf-devel jsoncpp-devel
BuildRequires: llvm-mlir llvm-mlir-static llvm-mlir-devel llvm-devel
BuildRequires: mlir mlir-static mlir-devel llvm-devel llvm-test
Requires: grpc protobuf
Patch1: 0001-Refactoring-Code-refactoring-of-Communication-Subsys.patch
@ -37,6 +37,13 @@ Patch24: 0024-Pin-server-Fix-VectorType.patch
Patch25: 0025-Pin-server-Fix-Pass-DoOptimize-method-and-struct-sel.patch
Patch26: 0026-Pin-server-Fix-log-output-form.patch
Patch27: 0027-Pin-server-Optimized-LocalVarSummeryPass.patch
Patch28: 0028-Pin-server-Adaptation-to-llvm15-mlir15-only-solves-t.patch
Patch29: 0029-Pin-server-Adaptation-to-gcc12-only-solves-the-build.patch
Patch30: 0030-Pin-server-fix-the-adaptation-to-grpc-1.54.2.patch
Patch31: 0031-Pin-Server-Added-null-pointer-check-to-avoid-potenti.patch
Patch32: 0032-Pin-server-Bugfix-for-the-operation-sequence-of-user.patch
Patch33: 0033-Pin-server-Add-DataFlow-APIs.patch
Patch34: 0034-MLIR17-Adaptation-to-llvm17-mlir17.patch
%description
Pin (Plug-IN framework) server provides plugin APIs for compiler optimization developers to develop optimization pass.
@ -54,12 +61,10 @@ A demo for pin-server
%autopatch -p1
%build
mkdir -p _build
cd _build
%{cmake} .. -DCMAKE_INSTALL_PREFIX=%{_usr} -DCMAKE_INSTALL_LIBDIR=%{_libdir} -DCMAKE_SKIP_RPATH=ON -DMLIR_DIR=/usr/lib64/cmake/mlir -DLLVM_DIR=/usr/lib64/cmake/llvm
%build
cd _build
%make_build
%install
@ -86,13 +91,49 @@ find %{_libdir} -type f -name "libMLIRServerAPI.so" -exec strip "{}" ";"
%files demo
%attr(0755,root,root) %{_libdir}/libpin_user.so
%attr(0755,root,root) %{_libdir}/libMLIRPluginServer.so
%attr(0755,root,root) %{_libdir}/libMLIRPluginServer.so.12
%attr(0755,root,root) %{_libdir}/libMLIRPluginServer.so.17
%attr(0755,root,root) %{_libdir}/libMLIRServerAPI.so
%attr(0755,root,root) %{_libdir}/libMLIRServerAPI.so.12
%attr(0755,root,root) %{_libdir}/libMLIRServerAPI.so.17
%attr(0644,root,root) %{_libdir}/libpin_user.sha256
%config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf
%changelog
* Tue Apr 09 2024 wumingchuan <wumingchuan1992@foxmail.com> - 0.4.0-16
- Type:FIX
- ID:NA
- SUG:NA
- DESC:Adaptation to llvm17/mlir17
* Mon Apr 08 2024 wumingchuan <wumingchuan1992@foxmail.com> - 0.4.0-15
- Type:FIX
- ID:NA
- SUG:NA
- DESC:Sync patch from openEuler/pin-server
* Tue Aug 22 2023 liyunfei <liyunfei33@huawei.com> - 0.4.0-14
- Type:FIX
- ID:NA
- SUG:NA
- DESC:Add toolchain switch support
* Mon Aug 14 2023 dingguangya <dingguangya1@huawei.com> - 0.4.0-13
- Type:FIX
- ID:NA
- SUG:NA
- DESC:Fix the adaptation to grpc-1.54.2
* Thu Aug 3 2023 dingguangya <dingguangya1@huawei.com> - 0.4.0-12
- Type:FIX
- ID:NA
- SUG:NA
- DESC:Adaptation to gcc12 only solves the build problem
* Thu Aug 3 2023 dingguangya <dingguangya1@huawei.com> - 0.4.0-11
- Type:FIX
- ID:NA
- SUG:NA
- DESC:Adaptation to llvm15/mlir15 only solves the build problem
* Wed Apr 26 2023 zhangying <zhangying@xfusion.com> - 0.4.0-10
- Type:Update
- ID:NA