-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PIR][DynamicShape] Add InferSymbolicShape for gather_nd, squeeze, and unsqueeze #61224
Conversation
@@ -607,8 +656,91 @@ bool ScaleSr_OpInferSymbolicShape( | |||
|
|||
bool SqueezeOpInferSymbolicShape( | |||
pir::Operation *op, pir::ShapeConstraintIRAnalysis *shape_analysis) { | |||
PADDLE_THROW(phi::errors::Unimplemented( | |||
op->name() + " DOES NOT have InferSymbolicShapeInterface!")); | |||
IR_ENFORCE(op->num_operands() == 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这部分是不是会在 verify 或者 infermeta 函数中检查过了? 所以 此处不需要再重复检查了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我看pd_op里还有其他build的定义,不确定是否还有其他形式的,所以先做个检查,以免直接越界了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Mark dimensions need to be squeezed. | ||
if (num_squeeze_dims == 0) { | ||
for (size_t i = 0; i < in_dims_sym.size(); ++i) { | ||
// TODO(lanxianghit): if symbol here, maybe we need the result of dim expr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个头文件的函数可以对 dim_expr 实现化简 已经从 cinn 移动到 shape dialect 下了
#include "paddle/pir/dialect/shape/utils/dim_expr_simplify.h"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,下个pr再优化一下
PR types
Others
PR changes
Others
Description
Pcard-67164
Add InferSymbolicShape for gather_nd, squeeze, and unsqueeze, which used in RoPE