Skip to content

Commit

Permalink
[clang-tidy] NO.48-50 enable string-integer-assignment,misplaced-wid…
Browse files Browse the repository at this point in the history
…ening-cast,infinite-loop (#61492)
  • Loading branch information
enkilee authored Feb 20, 2024
1 parent 1d82e2c commit f6366dc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bugprone-exception-escape,
-bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
-bugprone-infinite-loop,
bugprone-infinite-loop,
bugprone-integer-division,
-bugprone-macro-repeated-side-effects,
-bugprone-misplaced-operator-in-strlen-in-alloc,
Expand All @@ -28,7 +28,7 @@ bugprone-signed-char-misuse,
-bugprone-sizeof-container,
-bugprone-sizeof-expression,
-bugprone-string-constructor,
-bugprone-string-integer-assignment,
bugprone-string-integer-assignment,
-bugprone-string-literal-with-embedded-nul,
-bugprone-suspicious-enum-usage,
-bugprone-suspicious-memset-usage,
Expand Down
28 changes: 13 additions & 15 deletions paddle/fluid/framework/ir/graph_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,19 @@ std::vector<ir::Node *> TopologyDfsSortOperations(const Graph &graph) {

// traverse the graph
int num_ops = static_cast<int>(op_queue.size());
while (num_ops) {
for (auto cur_op : op_queue) {
if (!cur_op || in_degree[cur_op] > 0) continue;
// visit this node
// put all the output var of this op valid.
for (auto *out_var : cur_op->outputs) {
if (!out_var) continue;
set_out_ops_ready(out_var);
}
VLOG(8) << "visit " << cur_op->Name();
nodes.push_back(cur_op);

cur_op = nullptr;
num_ops--;
}
for (auto cur_op : op_queue) {
if (!cur_op || in_degree[cur_op] > 0) continue;
// visit this node
// put all the output var of this op valid.
for (auto *out_var : cur_op->outputs) {
if (!out_var) continue;
set_out_ops_ready(out_var);
}
VLOG(8) << "visit " << cur_op->Name();
nodes.push_back(cur_op);

cur_op = nullptr;
num_ops--;
}

return nodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ std::string GenerateEngineKey(const std::set<std::string> &engine_inputs,
engine_hash_key += precision;

engine_hash_key += "#";
engine_hash_key += use_cuda_graph;
engine_hash_key += std::to_string(use_cuda_graph);

auto engine_key = std::to_string(std::hash<std::string>()(engine_hash_key));
VLOG(2) << "TRT engine hash key: " << engine_hash_key;
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/infermeta/ternary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,8 @@ void QuantLinearInferMeta(const MetaTensor& x,
in_mat_dims,
w_dims0,
common::make_ddim({w_dims0, w_dims1})));
output_dims.reserve(static_cast<size_t>(in_num_col_dims + 1));
output_dims.reserve(static_cast<size_t>(in_num_col_dims) +
static_cast<size_t>(1));
for (int i = 0; i < in_num_col_dims; ++i) {
output_dims.push_back(in_dims[i]);
}
Expand Down

0 comments on commit f6366dc

Please sign in to comment.