Skip to content

Replace phi::errors [fluid_ops] #67023

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

Merged
merged 1 commit into from
Aug 6, 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
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/common/chunk_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ChunkAllocator {
PADDLE_ENFORCE_EQ(
sizeof(Node),
std::max(sizeof(void*), sizeof(T)),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The size of Node is invalid. Expected sizeof(Node) == "
"max(sizeof(void*), sizeif(T)).\nBut recieved sizeof(Node) = %u "
"and max(sizeof(void*), sizeif(T)) = %u.",
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/service/brpc_ps_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ std::future<int32_t> BrpcPsClient::PushDense(const Region *regions,
uint32_t data_num = regions[i].size / sizeof(float);
PADDLE_ENFORCE_LE((pos + data_num),
data_size,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Invalid dense size."
"Expect the sum of current position and data number "
"to be equal to or smaller than the size."
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/service/brpc_ps_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DownpourPsClientService : public PsService {
PADDLE_ENFORCE_EQ(
client_id,
(_client->_client_id),
phi::errors::PreconditionNotMet(
common::errors::PreconditionNotMet(
"Wrong request client's id. Expect to match self. But recieved "
"request client's id = %lu and self = %lu.",
client_id,
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/service/brpc_ps_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int32_t BrpcPsServer::ReceiveFromPServer(int msg_type,
}
PADDLE_ENFORCE_EQ(ar.Cursor(),
ar.Finish(),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Expected 'ar.Cursor()' to be equal to 'ar.Finish()', "
"but found they are not equal."));
this->_shuffled_ins->Write(std::move(data));
Expand Down
42 changes: 21 additions & 21 deletions paddle/fluid/distributed/ps/service/communicator/communicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void Communicator::RpcSendDenseParam(const std::vector<std::string> &varnames,
PADDLE_ENFORCE_NE(
var,
nullptr,
phi::errors::InvalidArgument("Param var should not be NULL!"));
common::errors::InvalidArgument("Param var should not be NULL!"));
phi::DenseTensor *tensor = var->GetMutable<phi::DenseTensor>();
if (phi::is_gpu_place(tensor->place())) {
#ifdef PADDLE_WITH_CUDA
Expand Down Expand Up @@ -625,24 +625,24 @@ void AsyncCommunicator::PullSparseToTensorSync(
PADDLE_ENFORCE_LT(
output_index,
outputs->size(),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The output index should be less than %d, but got %d.",
outputs->size(),
output_index)); // NOLINT
output = outputs->at(output_index);
output->set_lod(tensor->lod());
output_data = output->mutable_data<float>(place);
output_len = 0;
PADDLE_ENFORCE_EQ(
output->numel() % fea_dim,
0,
phi::errors::InvalidArgument("The 'output->numel() % fea_dim' "
"should be equal to 0, but got %d.",
output->numel() % fea_dim)); // NOLINT
PADDLE_ENFORCE_EQ(output->numel() % fea_dim,
0,
common::errors::InvalidArgument(
"The 'output->numel() % fea_dim' "
"should be equal to 0, but got %d.",
output->numel() % fea_dim)); // NOLINT
PADDLE_ENFORCE_NE(
output_data,
nullptr,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The output data should not be NULL!")); // NOLINT
}
uint64_t real_id = static_cast<uint64_t>(ids[i]);
Expand Down Expand Up @@ -692,7 +692,7 @@ void AsyncCommunicator::PushSparseFromTensorAsync(
}
PADDLE_ENFORCE_GT(batch_size,
0,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The batch size should be greater than 0, but got %d.",
batch_size)); // NOLINT

Expand All @@ -701,22 +701,22 @@ void AsyncCommunicator::PushSparseFromTensorAsync(
PADDLE_ENFORCE_EQ(
show_size == batch_size || show_size == 1,
true,
phi::errors::InvalidArgument("The show size should be equal to batch "
"size or equal to 1, but got %d.",
show_size));
common::errors::InvalidArgument("The show size should be equal to batch "
"size or equal to 1, but got %d.",
show_size));
int clk_size =
!clks->lod().empty() ? clks->lod()[0].size() - 1 : clks->dims()[0];
PADDLE_ENFORCE_EQ(
clk_size == batch_size || clk_size == 1,
true,
phi::errors::InvalidArgument("The clk size should be equal to batch size "
"or equal to 1, but got %d.",
clk_size));
PADDLE_ENFORCE_EQ(clk_size == batch_size || clk_size == 1,
true,
common::errors::InvalidArgument(
"The clk size should be equal to batch size "
"or equal to 1, but got %d.",
clk_size));

PADDLE_ENFORCE_EQ(
outputs->size(),
inputs->size(),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The size of outputs should be equal to inputs, but the size of "
"outputs is %d, the size of inputs is %d",
outputs->size(),
Expand Down Expand Up @@ -804,7 +804,7 @@ void AsyncCommunicator::PushSparseFromTensorAsync(
PADDLE_ENFORCE_EQ(
static_cast<int64_t>(output_len),
g_tensor->numel(),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The output length should be equal to %d, but got %d.",
g_tensor->numel(),
static_cast<int64_t>(output_len)));
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/distributed/ps/service/ps_graph_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ::std::future<int32_t> PsGraphClient::PullSparsePtr(
VLOG(0) << "PullSparsePtr, miss key " << k << " rank=" << _rank_id;
PADDLE_ENFORCE_NE(it,
keys2rank_vec[shard].end(),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The key was not found in the expected shard."));
}
} else {
Expand Down Expand Up @@ -217,7 +217,7 @@ ::std::future<int32_t> PsGraphClient::PullSparseKey(
PADDLE_ENFORCE_NE(
it,
keys2rank_vec[shard].end(),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The key was not found in the expected shard.", k));
}
} else {
Expand Down
4 changes: 3 additions & 1 deletion paddle/fluid/distributed/ps/service/ps_service/service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ int PSCore::InitServer(
::paddle::distributed::PSServerFactory::Create(_ps_param));
ret = _server_ptr->Configure(_ps_param, _ps_env, index, server_sub_program);
PADDLE_ENFORCE_EQ(
ret, 0UL, phi::errors::PreconditionNotMet("Failed to configure server."));
ret,
0UL,
common::errors::PreconditionNotMet("Failed to configure server."));
return ret;
}

Expand Down
10 changes: 5 additions & 5 deletions paddle/fluid/distributed/ps/table/common_graph_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ void GraphTable::fennel_graph_edge_partition() {
PADDLE_ENFORCE_GT(
max_score,
0,
phi::errors::InvalidArgument("max_score should be greater than 0"));
common::errors::InvalidArgument("max_score should be greater than 0"));
return index;
};
// 查找关系最远点作为起点
Expand Down Expand Up @@ -1274,10 +1274,10 @@ void GraphTable::fennel_graph_edge_partition() {
break;
}
}
PADDLE_ENFORCE_NE(
key,
0xffffffffffffffffL,
phi::errors::InvalidArgument("key should not be 0xffffffffffffffffL"));
PADDLE_ENFORCE_NE(key,
0xffffffffffffffffL,
common::errors::InvalidArgument(
"key should not be 0xffffffffffffffffL"));
return key;
};
// 其它结点都添加完成,剩余的点就直接放到这个机器上面
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/table/ctr_accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ int CtrCommonAccessor::ParseFromString(const std::string& str, float* value) {
PADDLE_ENFORCE_GE(
ret,
6UL,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Invalid return value. Expect more than 6. But recieved %d.", ret));
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/table/ctr_double_accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ int CtrDoubleAccessor::ParseFromString(const std::string& str, float* value) {
PADDLE_ENFORCE_GE(
str_len,
6UL,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Invalid string length. Expect more than 6. But recieved %d.",
str_len));
int show_index = CtrDoubleFeatureValue::ShowIndex();
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/table/ctr_dymf_accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ int CtrDymfAccessor::ParseFromString(const std::string& str, float* value) {
PADDLE_ENFORCE_GE(
ret,
7UL,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Invalid return value. Expect more than 7. But recieved %d.", ret));
return ret;
}
Expand Down
10 changes: 5 additions & 5 deletions paddle/fluid/distributed/ps/table/memory_dense_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ int32_t MemoryDenseTable::Pull(TableContext &context) {
PADDLE_ENFORCE_EQ(
context.value_type,
Dense,
phi::errors::InvalidArgument("Context value type must be 'Dense'."));
common::errors::InvalidArgument("Context value type must be 'Dense'."));
float *pull_values = context.pull_context.values;
return PullDense(pull_values, context.num);
}
Expand All @@ -142,7 +142,7 @@ int32_t MemoryDenseTable::Push(TableContext &context) {
PADDLE_ENFORCE_EQ(
context.value_type,
Dense,
phi::errors::InvalidArgument("Context value type must be 'Dense'."));
common::errors::InvalidArgument("Context value type must be 'Dense'."));
if (context.push_context.values != nullptr) {
if (!context.push_context.is_param) {
return PushDense(context.push_context.values, context.num);
Expand Down Expand Up @@ -282,9 +282,9 @@ int32_t MemoryDenseTable::Load(const std::string &path,
PADDLE_ENFORCE_EQ(
str_len,
param_col_ids_.size(),
phi::errors::InvalidArgument("Expected %d floats, but got %d.",
param_col_ids_.size(),
str_len));
common::errors::InvalidArgument("Expected %d floats, but got %d.",
param_col_ids_.size(),
str_len));
for (size_t col_idx = 0; col_idx < str_len; ++col_idx) {
if (param_col_ids_[col_idx] < 0) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/table/sparse_accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ int SparseAccessor::ParseFromString(const std::string& str, float* value) {
PADDLE_ENFORCE_GE(
ret,
6UL,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Invalid return value. Expect more than 6. But recieved %d.", ret));
return ret;
}
Expand Down
20 changes: 10 additions & 10 deletions paddle/fluid/framework/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ArchiveBase {
PADDLE_ENFORCE_LE(
length,
capacity,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param length should be less than or equal to param capacity, but "
"the length got %d, the capacity got %d.",
length,
Expand All @@ -129,7 +129,7 @@ class ArchiveBase {
PADDLE_ENFORCE_EQ(
cursor >= buffer_ && cursor <= finish_,
true,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param cursor should be greater than or equal to buffer, and "
"should be less than or equal to finish, but the cursor got %d, "
"the buffer got %d, the finish got %d.",
Expand All @@ -143,7 +143,7 @@ class ArchiveBase {
PADDLE_ENFORCE_LE(
offset,
size_t(finish_ - cursor_),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param offset should be less than or equal to %d, but got %d.",
size_t(finish_ - cursor_),
offset));
Expand All @@ -156,7 +156,7 @@ class ArchiveBase {
PADDLE_ENFORCE_EQ(
finish >= cursor_ && finish <= limit_,
true,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param finish should be greater than or equal to cursor, and "
"should be less than or equal to limit, but the finish got %d, "
"the cursor got %d, the limit got %d.",
Expand All @@ -170,7 +170,7 @@ class ArchiveBase {
PADDLE_ENFORCE_LE(
offset,
size_t(limit_ - finish_),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param offset should be less than or equal to %d, but got %d.",
size_t(limit_ - finish_),
offset));
Expand Down Expand Up @@ -228,7 +228,7 @@ class ArchiveBase {
PADDLE_ENFORCE_NE(
newbuf,
nullptr,
phi::errors::InvalidArgument("Reserve failed, out of memory."));
common::errors::InvalidArgument("Reserve failed, out of memory."));
if (Length() > 0) {
memcpy(newbuf, buffer_, Length());
}
Expand All @@ -250,7 +250,7 @@ class ArchiveBase {
PADDLE_ENFORCE_LE(
size,
size_t(finish_ - cursor_),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param size should be less than or equal to %d, but got %d.",
size_t(finish_ - cursor_),
size));
Expand Down Expand Up @@ -280,7 +280,7 @@ class ArchiveBase {
PADDLE_ENFORCE_LE(
size,
size_t(finish_ - cursor_),
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param size should be less than or equal to %d, but got %d.",
size_t(finish_ - cursor_),
size));
Expand Down Expand Up @@ -381,15 +381,15 @@ class Archive<BinaryArchiveType> : public ArchiveBase {
PADDLE_ENFORCE_GE(
len,
0,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"Param len should be greater than or equal to 0, but got %d.",
len)); // NOLINT
if (static_cast<size_t>(len) >= temp) {
PrepareWrite(len + 1);
PADDLE_ENFORCE_EQ(
snprintf(Finish(), static_cast<size_t>(len) + 1, fmt, args...),
len,
phi::errors::InvalidArgument(
common::errors::InvalidArgument(
"The snprintf(Finish(), static_cast<size_t>(len) + 1, fmt, "
"args...) should be equal to %d, but got %d.",
len,
Expand Down
Loading