Projects
Eulaceura:Factory
pin-server
_service:obs_scm:0006-Pin-server-Fix-bug-for-Bu...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0006-Pin-server-Fix-bug-for-BuildCallOp.patch of Package pin-server
From 5be0d63fe19decadaebb012efeb03b75aa868228 Mon Sep 17 00:00:00 2001 From: Mingchuan Wu <wumingchuan1992@foxmail.com> Date: Tue, 21 Feb 2023 16:52:39 +0800 Subject: [PATCH 06/23] [Pin-server] Fix bug for BuildCallOp. Now we can convert the function pointer. diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td index f4062ad..3a88846 100644 --- a/include/Dialect/PluginOps.td +++ b/include/Dialect/PluginOps.td @@ -107,11 +107,13 @@ def CallOp : Plugin_Op<"call", [ The arguments list must match the arguments expected by the callee. }]; let arguments = (ins UI64Attr:$id, - FlatSymbolRefAttr:$callee, + OptionalAttr<FlatSymbolRefAttr>:$callee, Variadic<AnyType>:$inputs); let builders = [ OpBuilderDAG<(ins "int64_t":$id, "StringRef":$callee, "ArrayRef<Value>":$arguments)>, + OpBuilderDAG<(ins "int64_t":$id, + "ArrayRef<Value>":$arguments)>, // Only for server. OpBuilderDAG<(ins "Value":$func, "ArrayRef<Value>":$arguments, "Block *":$block)>, diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp index a49ce16..a30e9ed 100644 --- a/lib/Dialect/PluginOps.cpp +++ b/lib/Dialect/PluginOps.cpp @@ -357,6 +357,13 @@ void CallOp::build(OpBuilder &builder, OperationState &state, state.addAttribute("callee", builder.getSymbolRefAttr(callee)); } +void CallOp::build(OpBuilder &builder, OperationState &state, + int64_t id, ArrayRef<Value> arguments) +{ + state.addAttribute("id", builder.getI64IntegerAttr(id)); + state.addOperands(arguments); +} + /// Return the callee of the generic call operation, this is required by the /// call interface. CallInterfaceCallable CallOp::getCallableForCallee() diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp index d89945c..7bbf681 100755 --- a/lib/PluginServer/PluginJson.cpp +++ b/lib/PluginServer/PluginJson.cpp @@ -467,10 +467,16 @@ mlir::Operation *PluginJson::CallOpJsonDeSerialize(const string& data) ops.push_back(opValue); } int64_t id = GetID(node["id"]); - mlir::StringRef callName(node["callee"].asString()); mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder(); - CallOp op = opBuilder->create<CallOp>(opBuilder->getUnknownLoc(), - id, callName, ops); + Json::Value calleeJson = node["callee"]; + CallOp op; + if (calleeJson.isNull()) { + op = opBuilder->create<CallOp>(opBuilder->getUnknownLoc(), id, ops); + } else { + mlir::StringRef callName(calleeJson.asString()); + op = opBuilder->create<CallOp>(opBuilder->getUnknownLoc(), + id, callName, ops); + } return op.getOperation(); } diff --git a/lib/PluginServer/PluginServer.cpp b/lib/PluginServer/PluginServer.cpp index 05d0d3d..d2a1736 100644 --- a/lib/PluginServer/PluginServer.cpp +++ b/lib/PluginServer/PluginServer.cpp @@ -50,7 +50,7 @@ bool PluginServer::RegisterOpt(std::shared_ptr<PluginOptBase> optBase) string name = "funcname" + std::to_string((uintptr_t)optBase.get()); userOpts[inject].push_back(RecordedOpt(name, optBase)); this->context = optBase->GetContext(); - mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context); + static mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context); opBuilder = &opBuilder_temp; return true; } @@ -305,7 +305,7 @@ void PluginServer::RunServer() ServerSemPost(port); RegisterCallbacks(); - printf("RunServer: RegisterCallbacks Done.\n"); + log->LOGI("RunServer: RegisterCallbacks Done.\n"); pluginCom.Run(); } } // namespace PinServer diff --git a/lib/PluginServer/main.cpp b/lib/PluginServer/main.cpp index fac574e..333d55e 100644 --- a/lib/PluginServer/main.cpp +++ b/lib/PluginServer/main.cpp @@ -29,7 +29,6 @@ int main(int argc, char** argv) printf("param num:%d, should be:%d\n", argc, argcNum); return -1; } - printf("main arg: %s, %s\n", argv[0], argv[1]); std::string port = argv[0]; LogPriority priority = (LogPriority)atoi(argv[1]); PluginServer server(priority, port); -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2