[BYOC][ACL] Fix list is not supported as an input node#10801
[BYOC][ACL] Fix list is not supported as an input node#10801masahi merged 14 commits intoapache:mainfrom
Conversation
|
@lhutton1 - could you take a look ? |
lhutton1
left a comment
There was a problem hiding this comment.
Thanks @DzAvril, its great to see more support being added to ACL again :) Apologies for the delayed review I was on holiday the past couple of days. Overall LGTM! The comments are mostly just about cleaning things up, testing and tightening the conditions under which concatenate gets offloaded
@lhutton1 Thanks for the comments. Please help to review again. |
|
Thanks @DzAvril LGTM! cc @manupa-arm @comaniac @Mousius who may be able to help get this merged |
Hi @lhutton1 , thanks for your review. As you have approved these changes, the status of this PR is supposed to be
Will it be merged automatically after the status changes to |
|
Unfortunately since I'm just a reviewer my approval doesn't unblock merging, we would need to wait for someone who is a committer to approve this change and merge it. Friendly ping @manupa-arm @comaniac @Mousius (I'm not sure who else might be interested in ACL support) |
|
Hi @DzAvril, I was having a think about this over the weekend and remembered that for the ACL integration we don't run the My apologies for missing this previously - it's been a while since working on this. |
|
Our team is working on a project which needs hot-upgrade for models, our approach is offloading as many operations as possible to ACL and performance is not a concern. So this PR fixes a separate issue of offloading operations which have a list as inputs and offloading concatenate is a typical case of this issue. |
The JSONRuntimeBase misses a line for multiple EntryID (eid), as the patch pointed out. ( And this issue hits us while hooking ACL concat for a feature of "hot upgradable model":
We leverage ACL as the base of the "common Op library". ) Hi @lhutton1, is it a more appropriate way to Or b) Submit the fixup of json_runtime.h only? Any idea? |
|
Thanks for the insight @DzAvril, @cee1, I think in that case it would be fine to keep the implementation. It might be a good idea to disable offloading concatenate by default, but then add an optional parameter say |
Hi @lhutton1, would you please review this revision of the patch? |
|
@masahi @areusch @tmoreau89 - we're struggling to find a committer to take a look at this PR, do you have any suggestions? |
|
@masahi @lhutton1 Thanks for your comments. I re-support
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 It will work without |
def arm_compute_lib_pattern_table(disabled_ops=["concatenate"]):The default value of disabled_ops triggers an error in
I have no idea how to fix this, can you give a hint pls? |
|
You can add |
* [BYOC][ACL] Fix list is not supported as an input node * fix clang lint error * fix compile warnning * fix python module import error * rename concatenate test file * fix always MakeACLTensor with same eid 0 * do not offload concat default * fix concattnate test failure * fix test failure * fix lint error * fix lint * remove global var offload_concat * support concatenate with pattern table mechanism * disable pylint dangerous-default-value warning Co-authored-by: XuZhi <xuzhi.xu@alibaba-inc.com>
* [BYOC][ACL] Fix list is not supported as an input node * fix clang lint error * fix compile warnning * fix python module import error * rename concatenate test file * fix always MakeACLTensor with same eid 0 * do not offload concat default * fix concattnate test failure * fix test failure * fix lint error * fix lint * remove global var offload_concat * support concatenate with pattern table mechanism * disable pylint dangerous-default-value warning Co-authored-by: XuZhi <xuzhi.xu@alibaba-inc.com>
The input of op
concatenateis a list of tensors. We tried to bring it to ACL and found the JSON node of it is like below.{ "nodes": [ { "op": "input", "name": "arm_compute_lib_0_i0", "attrs": { "dtype": [ [ "int32", "int32", "int32" ] ], "shape": [ [ [1, 234, 234, 256], [1, 234, 234, 256], [1, 234, 234, 256] ] ] } }, { "op": "kernel", "name": "concatenate", "inputs": [[ 0, 0, 0], [ 0, 1, 0], [ 0, 2, 0]], "attrs": { "num_outputs": "1", "num_inputs": "3", "dtype": [ [ "int32" ] ], "axis": [ [ "0" ] ], "shape": [ [ [3, 234, 234, 256] ] ] } } ], "arg_nodes": [0], "heads": [[ 1, 0, 0]], "node_row_ptr": [0, 3, 4] }The inputs of node
kernelis:Element in
inputsis the index ofinputnode. Taking[0, 1, 0]as an example, the first0isnodeid, the second1isindexid, and the last0isversion.But in function
Run, it only uses0asindexidin statementuint32_t eid = EntryID(nid, 0);so the other two inputs are ignored.This PR introduces a variable
json_inputid_to_layer_inputidwhich maps the input index of JSON node to the index of the ACL layer's inputs.