diff --git a/paddle/fluid/distributed/ps/table/ctr_accessor.cc b/paddle/fluid/distributed/ps/table/ctr_accessor.cc index b5f185ed1f00e..91adc7af6c6d6 100644 --- a/paddle/fluid/distributed/ps/table/ctr_accessor.cc +++ b/paddle/fluid/distributed/ps/table/ctr_accessor.cc @@ -281,7 +281,7 @@ int32_t CtrCommonAccessor::Update(float** update_values, bool CtrCommonAccessor::CreateValue(int stage, const float* value) { // stage == 0, pull // stage == 1, push - if (stage == 0) { + if (stage == 0) { // NOLINT return true; } else if (stage == 1) { // operation diff --git a/paddle/fluid/distributed/ps/table/ctr_double_accessor.cc b/paddle/fluid/distributed/ps/table/ctr_double_accessor.cc index 5d8c22a7648f2..73fe46f209045 100644 --- a/paddle/fluid/distributed/ps/table/ctr_double_accessor.cc +++ b/paddle/fluid/distributed/ps/table/ctr_double_accessor.cc @@ -289,7 +289,7 @@ int32_t CtrDoubleAccessor::Update(float** update_values, bool CtrDoubleAccessor::CreateValue(int stage, const float* value) { // stage == 0, pull // stage == 1, push - if (stage == 0) { + if (stage == 0) { // NOLINT return true; } else if (stage == 1) { auto show = CtrDoublePushValue::Show(const_cast(value)); diff --git a/paddle/fluid/distributed/ps/table/ctr_dymf_accessor.cc b/paddle/fluid/distributed/ps/table/ctr_dymf_accessor.cc index fa431b838e9df..7e2e642fcb9b7 100644 --- a/paddle/fluid/distributed/ps/table/ctr_dymf_accessor.cc +++ b/paddle/fluid/distributed/ps/table/ctr_dymf_accessor.cc @@ -310,7 +310,7 @@ int32_t CtrDymfAccessor::Update(float** update_values, bool CtrDymfAccessor::CreateValue(int stage, const float* value) { // stage == 0, pull // stage == 1, push - if (stage == 0) { + if (stage == 0) { // NOLINT return true; } else if (stage == 1) { // operation diff --git a/paddle/fluid/distributed/ps/table/memory_dense_table.cc b/paddle/fluid/distributed/ps/table/memory_dense_table.cc index 9f6abd17ef2bf..28580b9e3355d 100644 --- a/paddle/fluid/distributed/ps/table/memory_dense_table.cc +++ b/paddle/fluid/distributed/ps/table/memory_dense_table.cc @@ -103,7 +103,7 @@ int32_t MemoryDenseTable::InitializeOptimizer() { auto name = common.name(); auto attrs = common.attributes(); - if (name == "sgd") { + if (name == "sgd") { // NOLINT optimizer_ = std::make_shared(common, &values_); optimizer_->SetGlobalLR(_global_lr); } else if (name == "adam") { diff --git a/paddle/fluid/distributed/ps/table/sparse_accessor.cc b/paddle/fluid/distributed/ps/table/sparse_accessor.cc index 91e83015b6631..40ebb1b8ca64e 100644 --- a/paddle/fluid/distributed/ps/table/sparse_accessor.cc +++ b/paddle/fluid/distributed/ps/table/sparse_accessor.cc @@ -244,7 +244,7 @@ int32_t SparseAccessor::Update(float** update_values, bool SparseAccessor::CreateValue(int stage, const float* value) { // stage == 0, pull // stage == 1, push - if (stage == 0) { + if (stage == 0) { // NOLINT return true; } else if (stage == 1) { // operation diff --git a/paddle/fluid/distributed/ps/table/ssd_sparse_table.cc b/paddle/fluid/distributed/ps/table/ssd_sparse_table.cc index 937dc62eba493..05b6f133bec90 100644 --- a/paddle/fluid/distributed/ps/table/ssd_sparse_table.cc +++ b/paddle/fluid/distributed/ps/table/ssd_sparse_table.cc @@ -882,7 +882,7 @@ int32_t SSDSparseTable::SaveWithStringMultiOutput(const std::string& path, int shard_num, int part_num, int split_num) { - if (compress && (save_param == 0 || save_param == 3)) { + if (compress && (save_param == 0 || save_param == 3)) { // NOLINT // return // ::paddle::string::format_string("%s/part-%03d-%05d-%03d-%03d.gz", // table_path, node_num, shard_num, part_num, split_num); @@ -1191,7 +1191,7 @@ int32_t SSDSparseTable::SaveWithStringMultiOutput_v2(const std::string& path, int part_num, int split_num, const char* prefix = "") { - if (compress && (save_param == 0 || save_param == 3)) { + if (compress && (save_param == 0 || save_param == 3)) { // NOLINT return ::paddle::string::format_string("%s/%s/part-%05d-%03d.gz", table_path, prefix, @@ -1624,7 +1624,7 @@ int32_t SSDSparseTable::SaveWithBinary(const std::string& path, int shard_num, int part_num, int split_num) { - if (compress && (save_param == 0 || save_param == 3)) { + if (compress && (save_param == 0 || save_param == 3)) { // NOLINT return paddle::string::format_string("%s/part-%03d-%05d-%03d-%03d.gz", table_path, node_num, @@ -1945,7 +1945,7 @@ int32_t SSDSparseTable::SaveWithBinary_v2(const std::string& path, int part_num, int split_num, const char* prefix = "") { - if (compress && (save_param == 0 || save_param == 3)) { + if (compress && (save_param == 0 || save_param == 3)) { // NOLINT return paddle::string::format_string( "%s/%s/part-%03d-%05d-%03d-%03d.gz", table_path, diff --git a/paddle/fluid/framework/data_feed.cc b/paddle/fluid/framework/data_feed.cc index 7c547ade1fd14..b841f9f3744af 100644 --- a/paddle/fluid/framework/data_feed.cc +++ b/paddle/fluid/framework/data_feed.cc @@ -2132,7 +2132,7 @@ void SlotRecordInMemoryDataFeed::Init(const DataFeedDesc& data_feed_desc) { size_t pos = pipe_command_.find(".so"); if (pos != std::string::npos) { // NOLINT pos = pipe_command_.rfind('|'); - if (pos == std::string::npos) { + if (pos == std::string::npos) { // NOLINT so_parser_name_ = pipe_command_; pipe_command_.clear(); } else { diff --git a/paddle/fluid/framework/hogwild_worker.cc b/paddle/fluid/framework/hogwild_worker.cc index f4ea4f2d9b268..a8ca062903d82 100644 --- a/paddle/fluid/framework/hogwild_worker.cc +++ b/paddle/fluid/framework/hogwild_worker.cc @@ -1400,7 +1400,7 @@ void HogwildWorker::TrainFilesWithProfiler() { timeline.Pause(); read_time += timeline.ElapsedSec(); total_time += timeline.ElapsedSec(); - if (infer_out_of_ins) { + if (infer_out_of_ins) { // NOLINT for (size_t i = 0; i < ops_.size(); ++i) { timeline.Start(); auto &op = ops_[i]; @@ -1620,7 +1620,7 @@ void HogwildWorker::TrainFiles() { if (cur_batch <= 0 && !infer_out_of_ins) { break; } - if (infer_out_of_ins) { + if (infer_out_of_ins) { // NOLINT for (auto &op : ops_) { if (op->Type() == "c_broadcast") { op->Run(*thread_scope_, place_); diff --git a/paddle/fluid/framework/new_executor/pir_interpreter.cc b/paddle/fluid/framework/new_executor/pir_interpreter.cc index 145600114edcd..b4802d0a02a01 100644 --- a/paddle/fluid/framework/new_executor/pir_interpreter.cc +++ b/paddle/fluid/framework/new_executor/pir_interpreter.cc @@ -779,7 +779,7 @@ void PirInterpreter::BuildInstruction() { continue; } } else if (op.dialect()->name() == "cf") { - if (op.isa()) { + if (op.isa()) { // NOLINT CREATE_INSTR(TuplePushInstruction); } else if (op.isa()) { CREATE_INSTR(TuplePopInstruction); @@ -892,7 +892,7 @@ void PirInterpreter::BuildInstruction() { .AsString(); VLOG(6) << "process " << op_name; - if (op.isa()) { + if (op.isa()) { // NOLINT CREATE_INSTR(OneDNNPhiKernelInstruction); } else if (op.isa()) { CREATE_INSTR(OneDNNMixedPhiKernelInstruction); diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index a90ee587f3f7d..8d9ed11a14ae5 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -1857,16 +1857,14 @@ void OperatorWithKernel::RunImpl(const Scope& scope, // 2. Whether this op has specific implementation; // 3. Whether onednn kernel can be used. #ifdef PADDLE_WITH_DNNL - if (!this->DnnFallback() && - !paddle::platform::in_mkldnn_white_list(type_) && - this->CanMKLDNNBeUsed(exe_ctx, kernel_type_->data_type_)) { - kernel_type_->library_type_ = framework::LibraryType::kMKLDNN; - kernel_type_->data_layout_ = framework::DataLayout::ONEDNN; - } else if (platform::is_cpu_place(kernel_type_->place_) && - kernel_type_->data_type_ == - proto::VarType::Type::VarType_Type_BF16 && - !this->SupportsCPUBF16() && - this->SupportsMKLDNN(phi::DataType::BFLOAT16)) { + if ((!this->DnnFallback() && + !paddle::platform::in_mkldnn_white_list(type_) && + this->CanMKLDNNBeUsed(exe_ctx, kernel_type_->data_type_)) || + (platform::is_cpu_place(kernel_type_->place_) && + kernel_type_->data_type_ == + proto::VarType::Type::VarType_Type_BF16 && + !this->SupportsCPUBF16() && + this->SupportsMKLDNN(phi::DataType::BFLOAT16))) { kernel_type_->library_type_ = framework::LibraryType::kMKLDNN; kernel_type_->data_layout_ = framework::DataLayout::ONEDNN; } @@ -2191,15 +2189,13 @@ OpKernelType OperatorWithKernel::InnerGetExpectedKernelType( // 2. Whether this op has specific implementation; // 3. Whether onednn kernel can be used. #ifdef PADDLE_WITH_DNNL - if (!this->DnnFallback() && !paddle::platform::in_mkldnn_white_list(type_) && - this->CanMKLDNNBeUsed(ctx, expected_kernel_key.data_type_)) { - expected_kernel_key.library_type_ = framework::LibraryType::kMKLDNN; - expected_kernel_key.data_layout_ = framework::DataLayout::ONEDNN; - } else if (platform::is_cpu_place(expected_kernel_key.place_) && - expected_kernel_key.data_type_ == - proto::VarType::Type::VarType_Type_BF16 && - !this->SupportsCPUBF16() && - this->SupportsMKLDNN(phi::DataType::BFLOAT16)) { + if ((!this->DnnFallback() && !paddle::platform::in_mkldnn_white_list(type_) && + this->CanMKLDNNBeUsed(ctx, expected_kernel_key.data_type_)) || + (platform::is_cpu_place(expected_kernel_key.place_) && + expected_kernel_key.data_type_ == + proto::VarType::Type::VarType_Type_BF16 && + !this->SupportsCPUBF16() && + this->SupportsMKLDNN(phi::DataType::BFLOAT16))) { expected_kernel_key.library_type_ = framework::LibraryType::kMKLDNN; expected_kernel_key.data_layout_ = framework::DataLayout::ONEDNN; } diff --git a/paddle/fluid/framework/program_converter.cc b/paddle/fluid/framework/program_converter.cc index 2645b3cf826ab..4fcbc7f5f7c33 100644 --- a/paddle/fluid/framework/program_converter.cc +++ b/paddle/fluid/framework/program_converter.cc @@ -140,8 +140,6 @@ void ConvertAssignValueOp(OpDesc* op) { op->SetAttr("bool_values", ExtractPlainVector(values)); break; case phi::DataType::FLOAT32: - op->SetAttr("fp32_values", ExtractPlainVector(values)); - break; case phi::DataType::FLOAT64: op->SetAttr("fp32_values", ExtractPlainVector(values)); break; diff --git a/paddle/fluid/inference/tensorrt/convert/prelu_op.cc b/paddle/fluid/inference/tensorrt/convert/prelu_op.cc index 4aefaefee3212..dba0d0bc42e04 100644 --- a/paddle/fluid/inference/tensorrt/convert/prelu_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/prelu_op.cc @@ -80,22 +80,17 @@ class PReluOpConverter : public OpConverter { hw_tensor = Add1DConstantLayer( std::vector(input_dims.nbDims - 2, 1)); } - if (data_format == "NCHW") { - if (hw_tensor != nullptr) { + if (hw_tensor != nullptr) { + if (data_format == "NCHW") { shape_tensor = Concat( std::vector{n_tensor, c_tensor, hw_tensor}); } else { - shape_tensor = - Concat(std::vector{n_tensor, c_tensor}); - } - } else { - if (hw_tensor != nullptr) { shape_tensor = Concat( std::vector{n_tensor, hw_tensor, c_tensor}); - } else { - shape_tensor = - Concat(std::vector{n_tensor, c_tensor}); } + } else { + shape_tensor = + Concat(std::vector{n_tensor, c_tensor}); } reshape_layer->setInput(1, *shape_tensor); } else { diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index eef6c1a1e8c4a..4c77f75b3e28c 100644 --- a/paddle/fluid/memory/allocation/allocator_facade.cc +++ b/paddle/fluid/memory/allocation/allocator_facade.cc @@ -436,10 +436,11 @@ class AllocatorFacadePrivate { const std::shared_ptr GetDefaultStreamSafeCUDAAllocator( const platform::CUDAPlace& place) const { - if (auto iter = default_stream_safe_cuda_allocators_.find(place); + if (auto iter = default_stream_safe_cuda_allocators_.find(place); // NOLINT iter != default_stream_safe_cuda_allocators_.end()) return iter->second; - if (auto iter = default_cuda_malloc_async_allocators_.find(place); + if (auto iter = + default_cuda_malloc_async_allocators_.find(place); // NOLINT iter != default_cuda_malloc_async_allocators_.end()) return iter->second; PADDLE_THROW(platform::errors::NotFound( diff --git a/paddle/fluid/pir/drr/src/rewrite_pattern.cc b/paddle/fluid/pir/drr/src/rewrite_pattern.cc index 09bb1de71e6d3..634b03250d86a 100644 --- a/paddle/fluid/pir/drr/src/rewrite_pattern.cc +++ b/paddle/fluid/pir/drr/src/rewrite_pattern.cc @@ -507,7 +507,7 @@ MatchContextImpl DrrRewritePattern::CreateOperations( auto ir_val = res_match_ctx.GetIrValue(input->name()); if (ir_val) { pir::Operation* ir_input_op = ir_val.defining_op(); - if (op_2_temp_program_index.count(ir_input_op) == 0) { + if (op_2_temp_program_index.count(ir_input_op) == 0) { // NOLINT // do nothing } else if (max_res_idx < op_2_temp_program_index.at(ir_input_op)) { max_res_idx = op_2_temp_program_index.at(ir_input_op); diff --git a/paddle/fluid/pir/transforms/gpu/transpose_flatten_concat_fuse_pass.cc b/paddle/fluid/pir/transforms/gpu/transpose_flatten_concat_fuse_pass.cc index 3b7325b445a08..8ffc5a7b556be 100644 --- a/paddle/fluid/pir/transforms/gpu/transpose_flatten_concat_fuse_pass.cc +++ b/paddle/fluid/pir/transforms/gpu/transpose_flatten_concat_fuse_pass.cc @@ -112,7 +112,7 @@ class NTransposeFlattenConcatFusePattern : public paddle::drr::DrrPatternBase { res.ComputeAttr([](const paddle::drr::MatchContext &match_ctx) -> int { int start_axis = match_ctx.Attr("start_axis_0"); int stop_axis = match_ctx.Attr("stop_axis_0"); - if (start_axis == stop_axis) { + if (start_axis == stop_axis) { // NOLINT return start_axis; } else if (start_axis == 0) { return stop_axis + 1; diff --git a/paddle/fluid/pir/transforms/onednn/reshape_transpose_matmul_fuse_pass.cc b/paddle/fluid/pir/transforms/onednn/reshape_transpose_matmul_fuse_pass.cc index 2e7a3b3f3a53e..dacfc74941877 100644 --- a/paddle/fluid/pir/transforms/onednn/reshape_transpose_matmul_fuse_pass.cc +++ b/paddle/fluid/pir/transforms/onednn/reshape_transpose_matmul_fuse_pass.cc @@ -220,7 +220,7 @@ class ReshapeTransposeFusedMatmulFusePattern }); pat.AddConstraint([&](const paddle::drr::MatchContext &match_ctx) { - if (as_x_) { + if (as_x_) { // NOLINT if (!(match_ctx.Attr>("fused_reshape_x").empty())) return false; } else { diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index ddd0cf8a4164e..8cf8821649a19 100644 --- a/paddle/fluid/platform/profiler.cc +++ b/paddle/fluid/platform/profiler.cc @@ -283,10 +283,12 @@ RecordMemEvent::RecordMemEvent(const void *ptr, RecordMemEvent::size_cache["gpu"][place.GetDeviceId()][3]; RecordMemEvent::has_initialized["gpu"][place.GetDeviceId()] = true; } else { - current_reserved = DEVICE_MEMORY_STAT_CURRENT_VALUE( - Reserved, place.GetDeviceId()); // NOLINT - peak_reserved = DEVICE_MEMORY_STAT_PEAK_VALUE( - Reserved, place.GetDeviceId()); // NOLINT + current_reserved = DEVICE_MEMORY_STAT_CURRENT_VALUE( // NOLINT + Reserved, + place.GetDeviceId()); + peak_reserved = DEVICE_MEMORY_STAT_PEAK_VALUE( // NOLINT + Reserved, + place.GetDeviceId()); RecordMemEvent::size_cache["gpu"][place.GetDeviceId()][1] = current_reserved; RecordMemEvent::size_cache["gpu"][place.GetDeviceId()][3] = @@ -449,10 +451,12 @@ RecordMemEvent::RecordMemEvent(const void *ptr, RecordMemEvent::size_cache["gpu"][place.GetDeviceId()][3]; RecordMemEvent::has_initialized["gpu"][place.GetDeviceId()] = true; } else { - current_reserved = DEVICE_MEMORY_STAT_CURRENT_VALUE( - Reserved, place.GetDeviceId()); // NOLINT - peak_reserved = DEVICE_MEMORY_STAT_PEAK_VALUE( - Reserved, place.GetDeviceId()); // NOLINT + current_reserved = DEVICE_MEMORY_STAT_CURRENT_VALUE( // NOLINT + Reserved, + place.GetDeviceId()); + peak_reserved = DEVICE_MEMORY_STAT_PEAK_VALUE( // NOLINT + Reserved, + place.GetDeviceId()); RecordMemEvent::size_cache["gpu"][place.GetDeviceId()][1] = current_reserved; RecordMemEvent::size_cache["gpu"][place.GetDeviceId()][3] = diff --git a/paddle/phi/api/lib/kernel_dispatch.cc b/paddle/phi/api/lib/kernel_dispatch.cc index 16dea76b4ad68..b52910547130c 100644 --- a/paddle/phi/api/lib/kernel_dispatch.cc +++ b/paddle/phi/api/lib/kernel_dispatch.cc @@ -66,16 +66,17 @@ BackendSet GetTensorBackendSet(const phi::TensorBase& t) { phi::Backend backend_key = phi::TransToPhiBackend(t.place()); BackendSet backend_set(backend_key); VLOG(10) << "update BackendSet by tensor: add [" << backend_key << "]"; - if (backend_key == Backend::GPU && phi::DenseTensor::classof(&t) && - static_cast(t).meta().use_gpudnn) { - backend_set = backend_set | BackendSet(Backend::GPUDNN); - } else if (backend_key == Backend::GPU && - phi::distributed::DistTensor::classof(&t) && - static_cast(t) - .value() - .meta() - .use_gpudnn) { - backend_set = backend_set | BackendSet(Backend::GPUDNN); + if (backend_key == Backend::GPU) { + if (phi::DenseTensor::classof(&t) && + static_cast(t).meta().use_gpudnn) { + backend_set = backend_set | BackendSet(Backend::GPUDNN); + } else if (phi::distributed::DistTensor::classof(&t) && + static_cast(t) + .value() + .meta() + .use_gpudnn) { + backend_set = backend_set | BackendSet(Backend::GPUDNN); + } } return backend_set; } diff --git a/paddle/phi/backends/dynload/dynamic_loader.cc b/paddle/phi/backends/dynload/dynamic_loader.cc index 54166a0385d0e..78940f62ccce0 100644 --- a/paddle/phi/backends/dynload/dynamic_loader.cc +++ b/paddle/phi/backends/dynload/dynamic_loader.cc @@ -350,7 +350,7 @@ void* GetCublasDsoHandle() { #if defined(__APPLE__) || defined(__OSX__) return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "libcublas.dylib"); #elif defined(_WIN32) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "cublas64_11.dll"); #else @@ -371,7 +371,7 @@ void* GetCublasDsoHandle() { return nullptr; } #elif defined(__linux__) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath(FLAGS_cublas_dir, "libcublas.so.11"); #else @@ -399,7 +399,7 @@ void* GetCublasDsoHandle() { void* GetCublasLtDsoHandle() { // APIs available after CUDA 10.1 #if defined(__linux__) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath(FLAGS_cublas_dir, "libcublasLt.so.11"); #else @@ -487,7 +487,7 @@ void* GetCUPTIDsoHandle() { return GetDsoHandleFromSearchPath( FLAGS_cupti_dir, "libcupti.dylib", false, {cupti_lib_path}); #elif defined(__linux__) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath( FLAGS_cupti_dir, "libcupti.so.11.8", false, {cupti_lib_path}); @@ -584,7 +584,7 @@ void* GetCusparseDsoHandle() { #if defined(__APPLE__) || defined(__OSX__) return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "libcusparse.dylib"); #elif defined(_WIN32) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "cusparse64_11.dll"); #else @@ -605,7 +605,7 @@ void* GetCusparseDsoHandle() { return nullptr; } #elif defined(__linux__) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath(FLAGS_cusparse_dir, "libcusparse.so.11"); #else @@ -781,7 +781,7 @@ void* GetCUFFTDsoHandle() { #if defined(__APPLE__) || defined(__OSX__) return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "libcufft.dylib"); #elif defined(__linux__) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "libcufft.so.10"); #else @@ -796,7 +796,7 @@ void* GetCUFFTDsoHandle() { return nullptr; } #elif defined(_WIN32) && defined(PADDLE_WITH_CUDA) - if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { + if (CUDA_VERSION >= 11000 && CUDA_VERSION < 12000) { // NOLINT #ifdef PADDLE_WITH_PIP_CUDA_LIBRARIES return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "cufft64_10.dll"); #else diff --git a/paddle/phi/infermeta/spmd_rules/cross_entropy_with_softmax.cc b/paddle/phi/infermeta/spmd_rules/cross_entropy_with_softmax.cc index 21dc00ac1fc18..c5adaa5442867 100644 --- a/paddle/phi/infermeta/spmd_rules/cross_entropy_with_softmax.cc +++ b/paddle/phi/infermeta/spmd_rules/cross_entropy_with_softmax.cc @@ -320,11 +320,7 @@ SpmdInfo CrossEntropyWithSoftmaxInferSpmdReverse( if (!use_softmax) { x_dims_mapping[axis] = -1; } else { - if (axis != x_ndim - 1) { - x_dims_mapping[axis] = -1; - s_out_dims_mapping_dst[axis] = -1; - label_dims_mapping[axis] = -1; - } else if (soft_label) { + if (axis != x_ndim - 1 || soft_label) { x_dims_mapping[axis] = -1; s_out_dims_mapping_dst[axis] = -1; label_dims_mapping[axis] = -1; diff --git a/paddle/phi/infermeta/spmd_rules/reshape.cc b/paddle/phi/infermeta/spmd_rules/reshape.cc index be74bf6ee23c9..dcd8d02531b1b 100644 --- a/paddle/phi/infermeta/spmd_rules/reshape.cc +++ b/paddle/phi/infermeta/spmd_rules/reshape.cc @@ -122,9 +122,9 @@ std::vector> MakeReshapeDimTrans( if (!tgt_splitted_shape.empty()) { std::vector> input_dims; for (auto in_dim : src_dims) { - if (src_shape[in_dim] > 1) { + if (src_shape[in_dim] > 1) { // NOLINT input_dims.emplace_back(std::make_shared(in_dim)); - } else if (src_shape[in_dim] == 1 && s == 1 && t == 1) { + } else if (src_shape[in_dim] == 1 && s == 1 && t == 1) { // NOLINT // NOTE: for the case like: // shape: [1, 512, 4096] --> [1, 2, 256, 4096], // input dims_mapping: [0, 1, -1] diff --git a/paddle/phi/infermeta/unary.cc b/paddle/phi/infermeta/unary.cc index 9cfc201d3db31..f1f0ddfbd07ca 100644 --- a/paddle/phi/infermeta/unary.cc +++ b/paddle/phi/infermeta/unary.cc @@ -255,7 +255,7 @@ void ArgMinMaxInferMeta(const MetaTensor& x, vec = {}; } } else { - if (keepdims) { + if (keepdims) { // NOLINT vec = std::vector(x.dims().size(), -1); } else { vec = std::vector(x.dims().size() - 1, -1); @@ -4276,8 +4276,8 @@ void SplitInferMeta(const MetaTensor& x, if ((sections.FromTensor() && !config.is_runtime) || axis_value == -1 || (axis_value >= 0 && x.dims().at(axis_value) <= 0)) { std::vector out_dims; - if ((sections.FromTensor() && !config.is_runtime) || - axis_value == -1) { // NOLINT + if ((sections.FromTensor() && !config.is_runtime) || // NOLINT + axis_value == -1) { out_dims = std::vector( sections_data.size(), common::make_ddim(std::vector(x.dims().size(), -1))); diff --git a/tools/dockerfile/Dockerfile.ubuntu20 b/tools/dockerfile/Dockerfile.ubuntu20 index fe5c8a3de5ea3..a2611b4396c3e 100644 --- a/tools/dockerfile/Dockerfile.ubuntu20 +++ b/tools/dockerfile/Dockerfile.ubuntu20 @@ -143,11 +143,11 @@ RUN pip3.8 --no-cache-dir install pytest && \ RUN pip3.8 --no-cache-dir install pre-commit==2.17.0 && \ pip3.9 --no-cache-dir install pre-commit==2.17.0 && \ pip3.10 --no-cache-dir install pre-commit==2.17.0 && \ - pip3.8 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ - pip3.9 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ - pip3.10 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ - pip3.11 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ - pip3.12 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 + pip3.8 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 clang-tidy==15.0.2.1 && \ + pip3.9 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 clang-tidy==15.0.2.1 && \ + pip3.10 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 clang-tidy==15.0.2.1 && \ + pip3.11 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 clang-tidy==15.0.2.1 && \ + pip3.12 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 clang-tidy==15.0.2.1 COPY ./python/requirements.txt /root/ COPY ./python/unittest_py/requirements.txt /home/