Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions paddle/fluid/pir/dialect/op_generator/op_build_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
'LegacyInterpolateInferMeta',
'NceInferMeta',
'PyramidHashInferMeta',
'RmsNormInferMeta',
Copy link
Contributor Author

@DrRyanHuang DrRyanHuang Aug 15, 2025

Choose a reason for hiding this comment

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

❗️NOTE: 修改这个文件要重新cmake

'SigmoidCrossEntropyWithLogitsInferMeta',
'StackInferMeta',
'WeightOnlyLinearInferMeta',
Expand Down
12 changes: 9 additions & 3 deletions paddle/phi/infermeta/multiary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4944,15 +4944,22 @@ void RmsNormInferMeta(const MetaTensor& x,
const float quant_min_bound,
MetaTensor* out,
MetaTensor* residual_out,
MetaTensor* inv_var) {
MetaTensor* inv_var,
MetaConfig config) {
size_t x_dims_size = x.dims().size();

size_t normalized_dims = 1;
bool has_minus_one = false;
for (size_t i = begin_norm_axis; i < x_dims_size; ++i) {
normalized_dims *= x.dims().at(i);
has_minus_one |= (x.dims().at(i) == -1);
}

if (normalized_dims != 0) {
bool skip_check = false;
if (normalized_dims == 0) skip_check = true;
if (has_minus_one && !config.is_runtime) skip_check = true;

if (!skip_check) {
PADDLE_ENFORCE_EQ(normalized_dims,
norm_weight.dims()[0],
common::errors::InvalidArgument(
Expand All @@ -4963,7 +4970,6 @@ void RmsNormInferMeta(const MetaTensor& x,
normalized_dims,
norm_weight.dims()[0]));
}

out->set_dims(x.dims());

if (quant_scale > 0) {
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/infermeta/multiary.h
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,8 @@ void RmsNormInferMeta(const MetaTensor& x,
const float quant_min_bound,
MetaTensor* out,
MetaTensor* residual_out,
MetaTensor* inv_var);
MetaTensor* inv_var,
MetaConfig config = MetaConfig());

void RmspropInferMeta(const MetaTensor& param,
const MetaTensor& mean_square,
Expand Down
Loading