Skip to content
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

Use DimExpr and change InferSymbolicShapeInterface #60371

Merged
merged 6 commits into from
Dec 28, 2023

Conversation

zhangbopd
Copy link
Contributor

@zhangbopd zhangbopd commented Dec 26, 2023

PR types

Others

PR changes

Others

Description

Pcard-67164

Use DimExpr and change InferSymbolicShapeInterface

Note : Windows static library(both CPU and GPU)over the limit, so no longer create_static_lib, and cc_library is dummy

Copy link

paddle-bot bot commented Dec 26, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

pir::OpResult res = op->result(0);
std::string res_id = pir::GetValueId(&res);
shape_analysis->value_id_to_shapeordata_[res_id] =
shape_analysis->value_id_to_shapeordata_[operand_source_id];
Copy link
Contributor

Choose a reason for hiding this comment

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

正式代码里最好不要直接操作成员变量了,需要使用封装接口操作

Copy link
Contributor Author

Choose a reason for hiding this comment

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

收到

// Value output_shape =
// builder.Build<shape::FromElementsOp>(shape_values).result(0);
// reified_return_shapes.push_back(output_shape);
bool ShapeSrOpInferSymbolicShape(
Copy link
Contributor

Choose a reason for hiding this comment

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

Shape"Sr"Op 中间的Sr是什么含义?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

selected_rows 版本的算子,ShapeSrOp 和 ShapeSrOp 共用了一个 yaml 配置


symbol::ShapeOrDataDimExprs shape_data;
shape_data = shape_analysis->value_id_to_shapeordata_[operand_source_id];
shape_analysis->value_id_to_shapeordata_[res_id] = shape_data;
Copy link
Contributor

Choose a reason for hiding this comment

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

#60146 这个PR合入之后,可以增加一些调试信息输出,便于以后调试使用

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,这个PR里 重写了 DebugPrintOpInfo,目前也支持 符号和 int_64 两种类型的 Dim_Expr 打印,后续会改用新的接口

Copy link
Contributor

Choose a reason for hiding this comment

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

#60146 已合入

@zhangbopd zhangbopd changed the title Symbolic infer Use DimExpr and change InferSymbolicShapeInterface Dec 27, 2023
lanxianghit
lanxianghit previously approved these changes Dec 27, 2023
Comment on lines +46 to +50
std::string operand_source_id = pir::GetValueId(&operand_source);
pir::OpResult res = op->result(0);
std::string res_id = pir::GetValueId(&res);
shape_analysis->value_id_to_shapeordata_[res_id] =
shape_analysis->value_id_to_shapeordata_[operand_source_id];
Copy link
Contributor

Choose a reason for hiding this comment

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

value可以直接用作map的key吗?看着用value id会多一些处理

Copy link
Contributor Author

Choose a reason for hiding this comment

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

可以

symbol::ShapeOrDataDimExprs shape_data;

shape_data = shape_analysis->value_id_to_shapeordata_[operand_source_1_id];
shape_analysis->value_id_to_shapeordata_[res_id] = shape_data;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的shapedata数据是不是需要交换下?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里应该后面要用到宏宇PR的一个接口,下个PR改,这里data应该还是空的

auto res = op->result(0);
auto res_id = pir::GetValueId(&res);

shape_analysis->value_id_to_shapeordata_[res_id] = value_shape;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的value_shape是空的?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个地方的逻辑后面还需要完善一下

@zhangbopd zhangbopd requested review from jiahy0825 and removed request for jiahy0825 December 27, 2023 13:33
@zhangbopd zhangbopd merged commit 8d4fb21 into PaddlePaddle:develop Dec 28, 2023
29 checks passed
@zhangbopd zhangbopd deleted the symbolic_infer branch December 28, 2023 03:24
Wanglongzhi2001 pushed a commit to Wanglongzhi2001/Paddle that referenced this pull request Jan 7, 2024
* Use DimExpr and change InferSymbolicShapeInterface

* static infer lib
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.

4 participants