Skip to content

[BYOC-DNNL] enable conv3d->bn folding#10837

Merged
masahi merged 5 commits into
apache:mainfrom
crazydemo:dev-enhance_fold_scale_axis
Apr 11, 2022
Merged

[BYOC-DNNL] enable conv3d->bn folding#10837
masahi merged 5 commits into
apache:mainfrom
crazydemo:dev-enhance_fold_scale_axis

Conversation

@crazydemo

Copy link
Copy Markdown

This PR contains two modifications:

  1. support conv3d-bn folding.
  2. add some layout in dnnl_json_runtime, and fix some typos.

@masahi

masahi commented Mar 31, 2022

Copy link
Copy Markdown
Member

Is it possible to unify 2D and 3D impls?

Also please add test cases.

@crazydemo

Copy link
Copy Markdown
Author

Is it possible to identify conv2d or conv3d from the given callnode?

@masahi

masahi commented Apr 1, 2022

Copy link
Copy Markdown
Member

yeah, for example

inline bool IsOp(const CallNode* call, const std::string& op_name) {
const auto* op_node = call->op.as<OpNode>();
ICHECK(op_node) << "Expects a single op.";
Op op = GetRef<Op>(op_node);
return op == Op::Get(op_name);
}

@crazydemo

Copy link
Copy Markdown
Author

yeah, for example

inline bool IsOp(const CallNode* call, const std::string& op_name) {
const auto* op_node = call->op.as<OpNode>();
ICHECK(op_node) << "Expects a single op.";
Op op = GetRef<Op>(op_node);
return op == Op::Get(op_name);
}

Thank you so much! I will try to unify 2D and 3D impls.

@crazydemo

Copy link
Copy Markdown
Author

Hi @masahi, would you please review this PR and give me some suggestions?

@masahi masahi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry forgot.

I have one minor comment, please address it in the next PR.

const auto* param = ref_call->attrs.as<Conv2DAttrs>();
return ConvForwardRewrite(ref_call, param, new_args, message);
}
const auto* param = ref_call->attrs.as<Conv3DAttrs>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ICHECK(param)

Add that to other places as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

@masahi masahi merged commit 45f3d4a into apache:main Apr 11, 2022
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Apr 11, 2022
* support conv3d bn folding

* add test case for fold_scale_axis

* modify lint

* remove test cases

* unify conv2d 3d impls, and add test cases.
@crazydemo crazydemo deleted the dev-enhance_fold_scale_axis branch April 14, 2022 03:21
altanh pushed a commit to altanh/tvm that referenced this pull request Apr 28, 2022
* support conv3d bn folding

* add test case for fold_scale_axis

* modify lint

* remove test cases

* unify conv2d 3d impls, and add test cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants