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

【PIR OpTest Fix No.15】 fix test match matrix tensor op #60277

Merged

Conversation

xingmingyyj
Copy link
Contributor

PR types

Others

PR changes

Others

Description

PIR Op单测修复
修复单测 test match matrix tensor op
修复后打开FLAGS_enable_pir_in_executor单测是否通过:否
报错信息:

AssertionError: Lists differ: [] != [[12, 8, 32]]
1022: 
1022: Second list contains 1 additional elements.
1022: First extra element 0:
1022: [12, 8, 32]
1022: 
1022: - []
1022: + [[12, 8, 32]] : Output (Out) has different lod at Place(cpu)

@paddle-bot paddle-bot bot added the contributor External developers label Dec 22, 2023
kangguangli
kangguangli previously approved these changes Dec 25, 2023
Comment on lines 2919 to 2943
if (config.is_runtime) {
const auto& x_lod = x.lod();
PADDLE_ENFORCE_EQ(x_lod.empty(),
false,
phi::errors::InvalidArgument(
"The Input(X) should hold LoD information, but "
"received Input(X).lod() is empty."));
const auto& x_lod_0 = x_lod[0];
PADDLE_ENFORCE_GE(x_lod_0.size(),
2,
phi::errors::InvalidArgument(
"The dimensions of Input(X)'s LoD data should be "
"equal to 2, but received %d.",
x_lod_0.size()));
PADDLE_ENFORCE_EQ(x_dims[0],
static_cast<int64_t>(x_lod_0.back()),
phi::errors::InvalidArgument(
"The last element of Input(X)'s LoD data should be "
"equal to the first dimension of Input(X). "
"But received the last element of Input(X)'s LoD "
"data is %d, the first dimension of Input(X) is %d.",
x_lod_0.back(),
x_dims[0]));

const auto& y_lod = y.lod();
Copy link
Contributor

Choose a reason for hiding this comment

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

如果lod信息仅在runtime时计算,是否可以将此处的计算逻辑放在kernel里?这样就不必将MetaTensor中的lod接口暴露出来。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里主要是用lod信息推导tmp和out的ddim信息,这些可以在kernel里再设置吗?

Copy link
Contributor

Choose a reason for hiding this comment

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

这里是运行时的处理,infermeta里写和在kernel里写是等价的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

Copy link

paddle-ci-bot bot commented Jan 4, 2024

Sorry to inform you that 14ac734's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

kangguangli
kangguangli previously approved these changes Jan 16, 2024

int64_t out_dim_0 = -1;
int64_t tmp_dim_0 = -1;
if (!config.is_runtime) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里还有必要判断是否为runtime吗?

Comment on lines 2898 to 2904
void MatchMatrixTensorInferMeta(const MetaTensor& x,
const MetaTensor& y,
const MetaTensor& w,
int dim_t,
MetaTensor* out,
MetaTensor* tmp,
MetaConfig config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

image 这个函数应该是放在`ternary.h/.cc`中

Comment on lines 2964 to 2965
out->set_dims(common::make_ddim(out_dims_vec));
tmp->set_dims(common::make_ddim(tmp_dims_vec));
Copy link
Contributor

Choose a reason for hiding this comment

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

设置dtype

@kangguangli kangguangli merged commit bc4bc09 into PaddlePaddle:develop Jan 23, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants