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] Fix while exe bug #60625

Merged
merged 1 commit into from
Jan 9, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void ShareVarData(const Variable* src_var, Variable* dst_var) {
} else if (src_var->IsType<phi::TensorArray>()) {
auto src_tensor_array = src_var->Get<phi::TensorArray>();
auto* dst_tensor_array = dst_var->GetMutable<phi::TensorArray>();
if (src_tensor_array.numel() == 0) return;
if (src_tensor_array.size() == 0) return;
dst_tensor_array->clear();
for (auto src_tensor : src_tensor_array) {
phi::DenseTensor* tmp_dst_tensor = new phi::DenseTensor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ WhileInstruction::WhileInstruction(
GetInputIds(op, *parent_exe_info, &inputs);
auto body_outside_inputs =
GetExternalInputs(body_block_, *parent_exe_info, &inputs);
// NOTE(chenxi67): the variable corresponding to container value if a
// <VariableRefArray> Type. It will recursively get the ID of internal
// variables when use GetValueId() method. However, the copy_var pushed into
// the tuple does not have a corresponding ID, and will insert a -1. Here we
// remove the value of -1.
for (auto& item : inputs) {
auto& var_vec = item.second;
for (auto it = var_vec.begin(); it != var_vec.end();) {
if (*it == -1) {
it = var_vec.erase(it);
} else {
++it;
}
}
}
SetInputs(inputs);

std::unordered_map<pir::Value, std::vector<int>> outputs;
Expand Down