DzAvril commented on PR #10801: URL: https://github.com/apache/tvm/pull/10801#issuecomment-1098133929
@[masahi](https://github.com/masahi) @[lhutton1](https://github.com/lhutton1) Thanks for your comments. I re-support `concatenate` with pattern table mechanism and bring two changes. 1. Add a parameter called `disabled_ops` that indicates the ops we do not offload to ACL to `partition_for_arm_compute_lib`, `concatenate` is included by default. 2. Add a function called `AddCommonSingleJSONNode` to add single op like `concatenate` to graph. ```C++ std::vector<JSONGraphNodeEntry> AddCommonSingleJSONNode(const CallNode* cn, std::string name) { std::vector<JSONGraphNodeEntry> inputs; for (const auto& arg : cn->args) { auto res = VisitExpr(arg); inputs.insert(inputs.end(), res.begin(), res.end()); } auto node = std::make_shared<JSONGraphNode>(name, /* name_ */ "kernel", /* op_type_ */ inputs, 1 /* num_outputs_ */); const auto* fn = cn->op.as<FunctionNode>(); ICHECK(fn); const auto* callNode = fn->body.as<CallNode>(); ICHECK(callNode); SetCallNodeAttribute(node, callNode); return AddNode(node, GetRef<Expr>(cn)); } ``` This function calls `AddNode` which returns a list of graph entry nodes and flattens the tuple type expr. In this way, the core problem this PR aims to fix is gone, because after flattening tuple type expr the JSON graph like below: ``` { "attrs": { "dtype": [ [ "float32" ] ], "shape": [ [ [ 1, 234, 234, 256 ] ] ] }, "name": "", "op": "input" }, { "attrs": { "dtype": [ "float32" ], "shape": [ [ 2, 234, 234, 256 ] ] }, "name": "", "op": "input" }, { "attrs": { "dtype": [ "float32" ], "shape": [ [ 3, 234, 234, 256 ] ] }, "name": "", "op": "input" }, { "attrs": { "axis": [ [ "0" ] ], "dtype": [ [ "float32" ] ], "num_inputs": "3", "num_outputs": "1", "shape": [ [ [ 6, 234, 234, 256 ] ] ] }, "inputs": [ [ 0, 0, 0 ], [ 1, 0, 0 ], [ 2, 0, 0 ] ], "name": "concatenate", "op": "kernel" } ``` It will work without `json_inputid_to_layer_inputid`. Even though I think we should keep the change I made in `acl_runtime.cc` and other related files in case of other corner cases occur. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
