From 4bc0f9fbcc0ac62c9b44d2f2ba1da540f4770845 Mon Sep 17 00:00:00 2001 From: Difers <707065510@qq.com> Date: Wed, 28 Jun 2023 12:35:22 +0000 Subject: [PATCH 1/4] fix cinn codestyle cmake-format --- cmake/cinn/core.cmake | 7 +- paddle/cinn/CMakeLists.txt | 5 +- paddle/cinn/auto_schedule/CMakeLists.txt | 7 +- .../auto_schedule/cost_model/CMakeLists.txt | 6 +- .../auto_schedule/database/CMakeLists.txt | 3 +- .../cinn/auto_schedule/measure/CMakeLists.txt | 3 +- .../post_schedule_rule/CMakeLists.txt | 15 ++- .../auto_schedule/search_space/CMakeLists.txt | 8 +- .../search_space/auto_gen_rule/CMakeLists.txt | 57 ++++++++--- .../search_strategy/CMakeLists.txt | 3 +- .../mutate_rule/CMakeLists.txt | 5 +- paddle/cinn/auto_schedule/task/CMakeLists.txt | 6 +- .../task_scheduler/CMakeLists.txt | 3 +- .../cinn/auto_schedule/tests/CMakeLists.txt | 14 ++- paddle/cinn/backends/CMakeLists.txt | 80 ++++++++++------ paddle/cinn/backends/llvm/CMakeLists.txt | 52 ++++++---- paddle/cinn/backends/nvrtc/CMakeLists.txt | 5 +- paddle/cinn/common/CMakeLists.txt | 49 +++++----- paddle/cinn/frontend/CMakeLists.txt | 50 ++++++---- .../cinn/frontend/decomposer/CMakeLists.txt | 32 ++++--- .../frontend/op_mappers/paddle/CMakeLists.txt | 6 +- .../op_mappers/science/CMakeLists.txt | 6 +- paddle/cinn/frontend/paddle/CMakeLists.txt | 33 +++++-- .../cinn/frontend/paddle/cpp/CMakeLists.txt | 21 +++-- paddle/cinn/frontend/paddle/pb/CMakeLists.txt | 21 +++-- paddle/cinn/frontend/pass/CMakeLists.txt | 69 ++++++++------ paddle/cinn/hlir/framework/CMakeLists.txt | 55 ++++++----- paddle/cinn/hlir/kernels/CMakeLists.txt | 1 + paddle/cinn/hlir/op/CMakeLists.txt | 28 +++--- paddle/cinn/hlir/op/contrib/CMakeLists.txt | 37 ++++---- paddle/cinn/hlir/pass/CMakeLists.txt | 74 ++++++++------- paddle/cinn/hlir/pe/CMakeLists.txt | 29 +++--- paddle/cinn/ir/CMakeLists.txt | 62 +++++++----- paddle/cinn/lang/CMakeLists.txt | 19 ++-- paddle/cinn/optim/CMakeLists.txt | 94 +++++++++++-------- paddle/cinn/poly/CMakeLists.txt | 32 ++++--- paddle/cinn/pybind/CMakeLists.txt | 47 +++++++--- paddle/cinn/runtime/CMakeLists.txt | 17 ++-- paddle/cinn/runtime/cpu/CMakeLists.txt | 22 ++--- paddle/cinn/runtime/cuda/CMakeLists.txt | 25 +++-- paddle/cinn/utils/CMakeLists.txt | 18 +++- test/cpp/cinn/CMakeLists.txt | 37 ++++++-- test/cpp/cinn/benchmark/CMakeLists.txt | 13 ++- test/cpp/fluid/cinn/CMakeLists.txt | 2 +- 44 files changed, 711 insertions(+), 467 deletions(-) diff --git a/cmake/cinn/core.cmake b/cmake/cinn/core.cmake index 2f5019b6eb027..1c289528351f6 100644 --- a/cmake/cinn/core.cmake +++ b/cmake/cinn/core.cmake @@ -145,13 +145,16 @@ function(cinn_nv_binary TARGET_NAME) endfunction(cinn_nv_binary) function(cinn_nv_test TARGET_NAME) - if(WITH_GPU AND WITH_TESTING AND CINN_ONLY) + if(WITH_GPU + AND WITH_TESTING + AND CINN_ONLY) set(options SERIAL) set(oneValueArgs "") set(multiValueArgs SRCS DEPS ARGS) cmake_parse_arguments(cinn_nv_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - cuda_add_executable(${TARGET_NAME} ${cinn_nv_test_SRCS} OPTIONS "-std=c++${CMAKE_CUDA_STANDARD}") + cuda_add_executable(${TARGET_NAME} ${cinn_nv_test_SRCS} OPTIONS + "-std=c++${CMAKE_CUDA_STANDARD}") get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES) target_link_libraries( ${TARGET_NAME} diff --git a/paddle/cinn/CMakeLists.txt b/paddle/cinn/CMakeLists.txt index 247f0a11b5dfe..deb060eb72014 100644 --- a/paddle/cinn/CMakeLists.txt +++ b/paddle/cinn/CMakeLists.txt @@ -1,4 +1,4 @@ -if (WITH_TESTING) +if(WITH_TESTING) cinn_cc_library(cinn_gtest_main SRCS gtest_main.cc DEPS gtest gflags) endif() @@ -18,6 +18,7 @@ endif() add_subdirectory(frontend) # Download a model -download_and_uncompress("${DOWNLOAD_MODEL_DIR}" "${PADDLE_RESOURCE_URL}" "lite_naive_model.tar.gz") +download_and_uncompress("${DOWNLOAD_MODEL_DIR}" "${PADDLE_RESOURCE_URL}" + "lite_naive_model.tar.gz") core_gather_headers() diff --git a/paddle/cinn/auto_schedule/CMakeLists.txt b/paddle/cinn/auto_schedule/CMakeLists.txt index 88569498cadfd..5bdd155dc4c19 100644 --- a/paddle/cinn/auto_schedule/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/CMakeLists.txt @@ -9,7 +9,8 @@ add_subdirectory(task) add_subdirectory(task_scheduler) add_subdirectory(tests) -cinn_proto_library(auto_schedule_proto SRCS auto_schedule.proto DEPS schedule_desc_proto) +cinn_proto_library(auto_schedule_proto SRCS auto_schedule.proto DEPS + schedule_desc_proto) core_gather_headers() @@ -18,5 +19,7 @@ gather_srcs(cinnapi_src SRCS auto_tuner.cc) #cinn_cc_test(test_auto_tuner SRCS auto_tuner_test.cc DEPS cinncore) foreach(header ${auto_schedule_proto_HDRS}) - set(core_proto_includes "${core_proto_includes};${header}" CACHE INTERNAL "") + set(core_proto_includes + "${core_proto_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/auto_schedule/cost_model/CMakeLists.txt b/paddle/cinn/auto_schedule/cost_model/CMakeLists.txt index b8a5d31019535..7f514471a4f7a 100644 --- a/paddle/cinn/auto_schedule/cost_model/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/cost_model/CMakeLists.txt @@ -1,7 +1,9 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS xgb_cost_model.cc expr_cost_model.cc feature.cc feature_extractor.cc) +gather_srcs(cinnapi_src SRCS xgb_cost_model.cc expr_cost_model.cc feature.cc + feature_extractor.cc) cinn_cc_test(test_xgb_cost_model SRCS xgb_cost_model_test.cc DEPS cinncore) -cinn_cc_test(test_feature_extractor SRCS feature_extractor_test.cc DEPS cinncore) +cinn_cc_test(test_feature_extractor SRCS feature_extractor_test.cc DEPS + cinncore) cinn_cc_test(test_feature SRCS feature_test.cc DEPS cinncore) diff --git a/paddle/cinn/auto_schedule/database/CMakeLists.txt b/paddle/cinn/auto_schedule/database/CMakeLists.txt index 610b1889f0080..b6c3511cf3878 100644 --- a/paddle/cinn/auto_schedule/database/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/database/CMakeLists.txt @@ -3,4 +3,5 @@ core_gather_headers() gather_srcs(cinnapi_src SRCS database.cc jsonfile_database.cc) cinn_cc_test(test_database SRCS database_test.cc DEPS cinncore) -cinn_cc_test(test_jsonfile_database SRCS jsonfile_database_test.cc DEPS cinncore) +cinn_cc_test(test_jsonfile_database SRCS jsonfile_database_test.cc DEPS + cinncore) diff --git a/paddle/cinn/auto_schedule/measure/CMakeLists.txt b/paddle/cinn/auto_schedule/measure/CMakeLists.txt index 658ca4278f388..11e7fa9152803 100644 --- a/paddle/cinn/auto_schedule/measure/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/measure/CMakeLists.txt @@ -1,6 +1,7 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS schedule_measurer.cc simple_builder.cc simple_runner.cc) +gather_srcs(cinnapi_src SRCS schedule_measurer.cc simple_builder.cc + simple_runner.cc) cinn_cc_test(test_simple_runner SRCS simple_runner_test.cc DEPS cinncore) cinn_cc_test(test_measurer SRCS measurer_test.cc DEPS cinncore) diff --git a/paddle/cinn/auto_schedule/post_schedule_rule/CMakeLists.txt b/paddle/cinn/auto_schedule/post_schedule_rule/CMakeLists.txt index 15c1555af7c2a..a6046412f4dd8 100644 --- a/paddle/cinn/auto_schedule/post_schedule_rule/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/post_schedule_rule/CMakeLists.txt @@ -1,9 +1,14 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - cooperative_process.cc - ) +gather_srcs(cinnapi_src SRCS cooperative_process.cc) -if (WITH_CUDA) - cinn_nv_test(test_cooperative_process SRCS cooperative_process_test.cc DEPS cinncore auto_gen_rule_test_helper test_program_builder) +if(WITH_CUDA) + cinn_nv_test( + test_cooperative_process + SRCS + cooperative_process_test.cc + DEPS + cinncore + auto_gen_rule_test_helper + test_program_builder) endif() diff --git a/paddle/cinn/auto_schedule/search_space/CMakeLists.txt b/paddle/cinn/auto_schedule/search_space/CMakeLists.txt index 2a06875cc9b2e..1c04b7dc2838f 100644 --- a/paddle/cinn/auto_schedule/search_space/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/search_space/CMakeLists.txt @@ -2,12 +2,8 @@ add_subdirectory(auto_gen_rule) core_gather_headers() -gather_srcs(cinnapi_src SRCS - search_space.cc - search_state.cc - block_sampler.cc - rule_sampler.cc - ) +gather_srcs(cinnapi_src SRCS search_space.cc search_state.cc block_sampler.cc + rule_sampler.cc) cinn_cc_test(test_search_space SRCS search_space_test.cc DEPS cinncore) cinn_cc_test(test_search_state SRCS search_state_test.cc DEPS cinncore) diff --git a/paddle/cinn/auto_schedule/search_space/auto_gen_rule/CMakeLists.txt b/paddle/cinn/auto_schedule/search_space/auto_gen_rule/CMakeLists.txt index e31f0c8e93c92..730575b79ad89 100644 --- a/paddle/cinn/auto_schedule/search_space/auto_gen_rule/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/search_space/auto_gen_rule/CMakeLists.txt @@ -1,22 +1,51 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - auto_gen_rule.cc - auto_inline.cc - auto_unroll.cc - multi_level_tiling.cc - skip_rule.cc - auto_bind.cc -) +gather_srcs( + cinnapi_src + SRCS + auto_gen_rule.cc + auto_inline.cc + auto_unroll.cc + multi_level_tiling.cc + skip_rule.cc + auto_bind.cc) -if (WITH_TESTING) - cinn_cc_library(auto_gen_rule_test_helper SRCS test_helper.cc DEPS glog gtest cinncore) +if(WITH_TESTING) + cinn_cc_library( + auto_gen_rule_test_helper + SRCS + test_helper.cc + DEPS + glog + gtest + cinncore) endif() -if (WITH_CUDA) - cinn_nv_test(test_mix_rules SRCS mix_rules_test.cc DEPS cinncore auto_gen_rule_test_helper test_program_builder) - cinn_nv_test(test_auto_bind SRCS auto_bind_test.cc DEPS cinncore auto_gen_rule_test_helper test_program_builder) - cinn_nv_test(test_multi_level_tiling SRCS multi_level_tiling_test.cc DEPS cinncore auto_gen_rule_test_helper test_program_builder) +if(WITH_CUDA) + cinn_nv_test( + test_mix_rules + SRCS + mix_rules_test.cc + DEPS + cinncore + auto_gen_rule_test_helper + test_program_builder) + cinn_nv_test( + test_auto_bind + SRCS + auto_bind_test.cc + DEPS + cinncore + auto_gen_rule_test_helper + test_program_builder) + cinn_nv_test( + test_multi_level_tiling + SRCS + multi_level_tiling_test.cc + DEPS + cinncore + auto_gen_rule_test_helper + test_program_builder) endif() #cinn_cc_test(test_auto_inline SRCS auto_inline_test.cc DEPS cinncore auto_gen_rule_test_helper) diff --git a/paddle/cinn/auto_schedule/search_strategy/CMakeLists.txt b/paddle/cinn/auto_schedule/search_strategy/CMakeLists.txt index 8f51423561e55..7f393dfb39837 100644 --- a/paddle/cinn/auto_schedule/search_strategy/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/search_strategy/CMakeLists.txt @@ -4,4 +4,5 @@ core_gather_headers() gather_srcs(cinnapi_src SRCS evolutionary_search.cc) -cinn_cc_test(test_evolutionary_search SRCS evolutionary_search_test.cc DEPS cinncore test_program_builder) +cinn_cc_test(test_evolutionary_search SRCS evolutionary_search_test.cc DEPS + cinncore test_program_builder) diff --git a/paddle/cinn/auto_schedule/search_strategy/mutate_rule/CMakeLists.txt b/paddle/cinn/auto_schedule/search_strategy/mutate_rule/CMakeLists.txt index fdb8f4a2dc215..80b3f566ad239 100644 --- a/paddle/cinn/auto_schedule/search_strategy/mutate_rule/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/search_strategy/mutate_rule/CMakeLists.txt @@ -1,8 +1,5 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - mutate_rule.cc - mutate_tile_size.cc - ) +gather_srcs(cinnapi_src SRCS mutate_rule.cc mutate_tile_size.cc) cinn_cc_test(test_mutate_tile_size SRCS mutate_tile_size_test.cc DEPS cinncore) diff --git a/paddle/cinn/auto_schedule/task/CMakeLists.txt b/paddle/cinn/auto_schedule/task/CMakeLists.txt index 934c63c6f7556..e9878fa167ced 100644 --- a/paddle/cinn/auto_schedule/task/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/task/CMakeLists.txt @@ -1,10 +1,6 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - task_creator.cc - task_optimizer.cc - tune_task.cc - ) +gather_srcs(cinnapi_src SRCS task_creator.cc task_optimizer.cc tune_task.cc) gather_srcs(cinnapi_src SRCS task_creator.cc task_optimizer.cc) cinn_cc_test(test_task_creator SRCS task_creator_test.cc DEPS cinncore) diff --git a/paddle/cinn/auto_schedule/task_scheduler/CMakeLists.txt b/paddle/cinn/auto_schedule/task_scheduler/CMakeLists.txt index 681c60b377c55..0300c5d1deb18 100644 --- a/paddle/cinn/auto_schedule/task_scheduler/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/task_scheduler/CMakeLists.txt @@ -1,5 +1,6 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS task_scheduler.cc round_robin.cc efficiency_priority.cc) +gather_srcs(cinnapi_src SRCS task_scheduler.cc round_robin.cc + efficiency_priority.cc) cinn_cc_test(test_task_scheduler SRCS task_scheduler_test.cc DEPS cinncore) diff --git a/paddle/cinn/auto_schedule/tests/CMakeLists.txt b/paddle/cinn/auto_schedule/tests/CMakeLists.txt index c6b29e89d0024..f7806eb4ae73b 100644 --- a/paddle/cinn/auto_schedule/tests/CMakeLists.txt +++ b/paddle/cinn/auto_schedule/tests/CMakeLists.txt @@ -1,5 +1,11 @@ -if (WITH_CUDA AND (NOT WITH_CUDNN)) - cinn_cc_test(test_performance_comparison - ARGS "--resnet50_model_dir=${THIRD_PARTY_PATH}/ResNet50" - SRCS performance_comparison_test.cc DEPS cinncore test_program_builder) +if(WITH_CUDA AND (NOT WITH_CUDNN)) + cinn_cc_test( + test_performance_comparison + ARGS + "--resnet50_model_dir=${THIRD_PARTY_PATH}/ResNet50" + SRCS + performance_comparison_test.cc + DEPS + cinncore + test_program_builder) endif() diff --git a/paddle/cinn/backends/CMakeLists.txt b/paddle/cinn/backends/CMakeLists.txt index 349244c4fb69c..57a3f39bed936 100755 --- a/paddle/cinn/backends/CMakeLists.txt +++ b/paddle/cinn/backends/CMakeLists.txt @@ -1,49 +1,64 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - outputs.cc - codegen_c.cc - codegen_c_x86.cc - codegen_cuda_host.cc - extern_func_emitter.cc - extern_func_emitter_builtin.cc - function_prototype.cc - extern_func_protos.cc - extern_func_jit_register.cc - modular.cc - compiler.cc -) +gather_srcs( + cinnapi_src + SRCS + outputs.cc + codegen_c.cc + codegen_c_x86.cc + codegen_cuda_host.cc + extern_func_emitter.cc + extern_func_emitter_builtin.cc + function_prototype.cc + extern_func_protos.cc + extern_func_jit_register.cc + modular.cc + compiler.cc) -if (WITH_CUDA) +if(WITH_CUDA) add_subdirectory(nvrtc) list(APPEND srcs cuda_util.cc codegen_cuda_dev.cc codegen_cuda_util.cc) endif() -if (WITH_OPENMP) -cinn_cc_library(__x86_source_fake_lib SRCS _x86_builtin_source.cc) +if(WITH_OPENMP) + cinn_cc_library(__x86_source_fake_lib SRCS _x86_builtin_source.cc) endif() add_subdirectory(llvm) - -if (WITH_CUDA) - cinn_nv_test(test_raw_cuda_code SRCS raw_cuda_code_test.cu DEPS cinncore) +if(WITH_CUDA) + cinn_nv_test(test_raw_cuda_code SRCS raw_cuda_code_test.cu DEPS cinncore) endif() -cinn_cc_test(test_codegen_c SRCS codegen_c_test.cc DEPS cinncore ARGS ${global_test_args}) -cinn_cc_test(test_codegen_c_x86 SRCS codegen_c_x86_test.cc DEPS cinncore ARGS ${global_test_args}) +cinn_cc_test( + test_codegen_c + SRCS + codegen_c_test.cc + DEPS + cinncore + ARGS + ${global_test_args}) +cinn_cc_test( + test_codegen_c_x86 + SRCS + codegen_c_x86_test.cc + DEPS + cinncore + ARGS + ${global_test_args}) cinn_cc_test(test_generated1 SRCS generated_module1.cc DEPS cinn_runtime) add_run_test_dependency(test_generated1 test_codegen_c) cinn_cc_test(test_ir_schedule SRCS ir_schedule_test.cc DEPS cinncore) include_directories(${CMAKE_SOURCE_DIR}/paddle/cinn/runtime) -if (TARGET test_generated1) +if(TARGET test_generated1) add_dependencies(test_generated1 test_codegen_c) endif() -if (WITH_CUDA) - cinn_nv_test(test_codegen_cuda_generate SRCS codegen_cuda_generate_test.cc DEPS cinncore) +if(WITH_CUDA) + cinn_nv_test(test_codegen_cuda_generate SRCS codegen_cuda_generate_test.cc + DEPS cinncore) cinn_nv_test(test_codegen_debug SRCS codegen_debug_test.cc DEPS cinncore) - if (WITH_TESTING) + if(WITH_TESTING) cinn_nv_test(generated1_cuda SRCS generated1.cu DEPS cinncore) add_run_test_dependency(generated1_cuda test_codegen_cuda_generate) endif() @@ -53,15 +68,20 @@ else() cinn_cc_test(test_compiler SRCS compiler_test.cc DEPS cinncore) endif() - foreach(cpp ${srcs}) set(cinnapi_src - "${cinnapi_src};paddle/cinn/backends/${cpp}" - CACHE INTERNAL "") + "${cinnapi_src};paddle/cinn/backends/${cpp}" + CACHE INTERNAL "") endforeach() -file(GLOB includes LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR} *.h) +file( + GLOB includes + LIST_DIRECTORIES false + RELATIVE ${CMAKE_SOURCE_DIR} + *.h) foreach(header ${includes}) - set(core_includes "${core_includes};${header}" CACHE INTERNAL "") + set(core_includes + "${core_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/backends/llvm/CMakeLists.txt b/paddle/cinn/backends/llvm/CMakeLists.txt index dbecc06bbd1b1..6667778f35288 100755 --- a/paddle/cinn/backends/llvm/CMakeLists.txt +++ b/paddle/cinn/backends/llvm/CMakeLists.txt @@ -4,25 +4,31 @@ add_definitions(${LLVM_DEFINITIONS}) add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/paddle/cinn/backends/llvm/cinn_runtime_llvm_ir.h - COMMAND ${LLVM_PATH}/bin/clang++ -mavx2 -std=c++11 -masm=intel -S -emit-llvm -O3 ${PROJECT_SOURCE_DIR}/paddle/cinn/runtime/cinn_runtime.cc -I${PROJECT_SOURCE_DIR} -o ${CMAKE_BINARY_DIR}/paddle/cinn/runtime/cinn_runtime.ll - COMMAND ${PYTHON_EXECUTABLE} generate_runtime_llvm_ir.py ${CMAKE_BINARY_DIR}/paddle/cinn/runtime/cinn_runtime.ll ${CMAKE_BINARY_DIR}/paddle/cinn/backends/llvm/cinn_runtime_llvm_ir.h ${LLVM_PATH}/bin/llvm-config + COMMAND + ${LLVM_PATH}/bin/clang++ -mavx2 -std=c++11 -masm=intel -S -emit-llvm -O3 + ${PROJECT_SOURCE_DIR}/paddle/cinn/runtime/cinn_runtime.cc + -I${PROJECT_SOURCE_DIR} -o + ${CMAKE_BINARY_DIR}/paddle/cinn/runtime/cinn_runtime.ll + COMMAND + ${PYTHON_EXECUTABLE} generate_runtime_llvm_ir.py + ${CMAKE_BINARY_DIR}/paddle/cinn/runtime/cinn_runtime.ll + ${CMAKE_BINARY_DIR}/paddle/cinn/backends/llvm/cinn_runtime_llvm_ir.h + ${LLVM_PATH}/bin/llvm-config WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/paddle/cinn/backends/llvm - DEPENDS ${PROJECT_SOURCE_DIR}/paddle/cinn/runtime/cinn_runtime.cc ${PROJECT_SOURCE_DIR}/paddle/cinn/runtime/cinn_runtime.h - ) -add_custom_target(GEN_LLVM_RUNTIME_IR_HEADER ALL - DEPENDS ${CMAKE_BINARY_DIR}/paddle/cinn/backends/llvm/cinn_runtime_llvm_ir.h - ) + DEPENDS ${PROJECT_SOURCE_DIR}/paddle/cinn/runtime/cinn_runtime.cc + ${PROJECT_SOURCE_DIR}/paddle/cinn/runtime/cinn_runtime.h) +add_custom_target( + GEN_LLVM_RUNTIME_IR_HEADER ALL + DEPENDS ${CMAKE_BINARY_DIR}/paddle/cinn/backends/llvm/cinn_runtime_llvm_ir.h) set(srcs - llvm_util.cc - runtime_symbol_registry.cc - codegen_llvm.cc - codegen_x86.cc - simple_jit.cc - execution_engine.cc - llvm_optimizer.cc -) - + llvm_util.cc + runtime_symbol_registry.cc + codegen_llvm.cc + codegen_x86.cc + simple_jit.cc + execution_engine.cc + llvm_optimizer.cc) cinn_cc_test(test_codegen_llvm SRCS codegen_llvm_test.cc DEPS cinncore) #cinn_cc_test(test_execution_engine SRCS execution_engine_test.cc DEPS cinncore) @@ -30,12 +36,18 @@ cinn_cc_test(test_codegen_x86 SRCS codegen_x86_test.cc DEPS cinncore) foreach(cpp ${srcs}) set(cinnapi_src - "${cinnapi_src};paddle/cinn/backends/llvm/${cpp}" - CACHE INTERNAL "") + "${cinnapi_src};paddle/cinn/backends/llvm/${cpp}" + CACHE INTERNAL "") endforeach() -file(GLOB includes LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR} *.h) +file( + GLOB includes + LIST_DIRECTORIES false + RELATIVE ${CMAKE_SOURCE_DIR} + *.h) foreach(header ${includes}) - set(core_includes "${core_includes};${header}" CACHE INTERNAL "") + set(core_includes + "${core_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/backends/nvrtc/CMakeLists.txt b/paddle/cinn/backends/nvrtc/CMakeLists.txt index 16748d4b8f88e..5b7327812de6f 100644 --- a/paddle/cinn/backends/nvrtc/CMakeLists.txt +++ b/paddle/cinn/backends/nvrtc/CMakeLists.txt @@ -1,8 +1,5 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - header_generator.cc - nvrtc_util.cc -) +gather_srcs(cinnapi_src SRCS header_generator.cc nvrtc_util.cc) cinn_nv_test(test_nvrtc_util SRCS nvrtc_util_test.cc DEPS cinncore) diff --git a/paddle/cinn/common/CMakeLists.txt b/paddle/cinn/common/CMakeLists.txt index e5e4b19190ec4..c9a3267681ab3 100644 --- a/paddle/cinn/common/CMakeLists.txt +++ b/paddle/cinn/common/CMakeLists.txt @@ -1,26 +1,27 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - shared.cc - cinn_value.cc - type.cc - target.cc - object.cc - debug_manager.cc - info_registry.cc - graph_utils.cc - context.cc - axis.cc - ir_util.cc - test_helper.cc - # cuda_test_helper.cc - arithmatic.cc - cas.cc - union_find.cc - python_interpreter_guard.cc - ) +gather_srcs( + cinnapi_src + SRCS + shared.cc + cinn_value.cc + type.cc + target.cc + object.cc + debug_manager.cc + info_registry.cc + graph_utils.cc + context.cc + axis.cc + ir_util.cc + test_helper.cc + # cuda_test_helper.cc + arithmatic.cc + cas.cc + union_find.cc + python_interpreter_guard.cc) - message(STATUS "srcs: ${cinnapi_src}") +message(STATUS "srcs: ${cinnapi_src}") cinn_cc_test(test_cinn_value SRCS cinn_value_test.cc DEPS cinncore) cinn_cc_test(test_shared SRCS shared_test.cc DEPS cinncore) @@ -30,7 +31,9 @@ cinn_cc_test(test_cas SRCS cas_test.cc DEPS cinncore) cinn_cc_test(test_type SRCS type_test.cc DEPS cinncore) cinn_cc_test(test_axis SRCS axis_test.cc DEPS cinncore) -cinn_cc_test(test_fp16_bf16_host SRCS float16_bfloat16_host_test.cc DEPS gtest glog) -if (WITH_CUDA) -cinn_nv_test(test_fp16_bf16_cuda SRCS float16_bfloat16_cuda_test.cu DEPS gtest glog) +cinn_cc_test(test_fp16_bf16_host SRCS float16_bfloat16_host_test.cc DEPS gtest + glog) +if(WITH_CUDA) + cinn_nv_test(test_fp16_bf16_cuda SRCS float16_bfloat16_cuda_test.cu DEPS + gtest glog) endif() diff --git a/paddle/cinn/frontend/CMakeLists.txt b/paddle/cinn/frontend/CMakeLists.txt index 0f5f8ec08b0c6..e04ae9e9851c0 100755 --- a/paddle/cinn/frontend/CMakeLists.txt +++ b/paddle/cinn/frontend/CMakeLists.txt @@ -1,5 +1,7 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS +gather_srcs( + cinnapi_src + SRCS computation.cc syntax.cc paddle_model_to_program.cc @@ -11,22 +13,37 @@ gather_srcs(cinnapi_src SRCS optimize.cc) if(NOT WITH_CUDA) - cinn_cc_test(test_frontend_syntax - ARGS "--model_dir=${THIRD_PARTY_PATH}/naive_mul_model" - SRCS syntax_test.cc DEPS cinncore) + cinn_cc_test( + test_frontend_syntax + ARGS + "--model_dir=${THIRD_PARTY_PATH}/naive_mul_model" + SRCS + syntax_test.cc + DEPS + cinncore) -# cinn_cc_test(test_frontend_interpreter -# ARGS --model_dir=${THIRD_PARTY_PATH}/naive_mul_model -# SRCS interpreter_test.cc DEPS cinncore) + # cinn_cc_test(test_frontend_interpreter + # ARGS --model_dir=${THIRD_PARTY_PATH}/naive_mul_model + # SRCS interpreter_test.cc DEPS cinncore) else() - cinn_nv_test(test_frontend_syntax - ARGS "--model_dir=${THIRD_PARTY_PATH}/naive_mul_model" - SRCS syntax_test.cc DEPS cinncore) + cinn_nv_test( + test_frontend_syntax + ARGS + "--model_dir=${THIRD_PARTY_PATH}/naive_mul_model" + SRCS + syntax_test.cc + DEPS + cinncore) - cinn_nv_test(test_frontend_interpreter - ARGS --model_dir=${THIRD_PARTY_PATH}/naive_mul_model - SRCS interpreter_test.cc DEPS cinncore) + cinn_nv_test( + test_frontend_interpreter + ARGS + --model_dir=${THIRD_PARTY_PATH}/naive_mul_model + SRCS + interpreter_test.cc + DEPS + cinncore) endif() #cinn_cc_test(test_paddle_model_convertor @@ -38,12 +55,13 @@ endif() # SRCS computation_test.cc DEPS cinncore) cinn_cc_test(test_net_builder SRCS net_builder_test.cc DEPS cinncore) -cinn_cc_test(test_decomposer_registry - SRCS decomposer_registry_test.cc DEPS cinncore) +cinn_cc_test(test_decomposer_registry SRCS decomposer_registry_test.cc DEPS + cinncore) add_subdirectory(paddle) add_subdirectory(decomposer) add_subdirectory(op_mappers) add_subdirectory(pass) -cinn_cc_test(test_op_mapper_registry SRCS op_mapper_registry_test.cc DEPS cinncore) +cinn_cc_test(test_op_mapper_registry SRCS op_mapper_registry_test.cc DEPS + cinncore) diff --git a/paddle/cinn/frontend/decomposer/CMakeLists.txt b/paddle/cinn/frontend/decomposer/CMakeLists.txt index d45c8c8a1cf65..ac5d624951bb0 100755 --- a/paddle/cinn/frontend/decomposer/CMakeLists.txt +++ b/paddle/cinn/frontend/decomposer/CMakeLists.txt @@ -1,19 +1,25 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - activation.cc - elementwise.cc - broadcast.cc - batch_norm.cc - top_k.cc - ) +gather_srcs( + cinnapi_src + SRCS + activation.cc + elementwise.cc + broadcast.cc + batch_norm.cc + top_k.cc) cinn_cc_library(decomposer_test_helper SRCS test_helper.cc DEPS cinncore) -if (WITH_CUDA) -cinn_cc_test(test_activation_decomposer SRCS activation_test.cc DEPS cinncore decomposer_test_helper) -cinn_cc_test(test_elementwise_decomposer SRCS elementwise_test.cc DEPS cinncore decomposer_test_helper) -cinn_cc_test(test_broadcast_decomposer SRCS broadcast_test.cc DEPS cinncore decomposer_test_helper) -cinn_cc_test(test_batch_norm_decomposer SRCS batch_norm_test.cc DEPS cinncore decomposer_test_helper) -cinn_cc_test(test_top_k_decomposer SRCS top_k_test.cc DEPS cinncore decomposer_test_helper) +if(WITH_CUDA) + cinn_cc_test(test_activation_decomposer SRCS activation_test.cc DEPS cinncore + decomposer_test_helper) + cinn_cc_test(test_elementwise_decomposer SRCS elementwise_test.cc DEPS + cinncore decomposer_test_helper) + cinn_cc_test(test_broadcast_decomposer SRCS broadcast_test.cc DEPS cinncore + decomposer_test_helper) + cinn_cc_test(test_batch_norm_decomposer SRCS batch_norm_test.cc DEPS cinncore + decomposer_test_helper) + cinn_cc_test(test_top_k_decomposer SRCS top_k_test.cc DEPS cinncore + decomposer_test_helper) endif() diff --git a/paddle/cinn/frontend/op_mappers/paddle/CMakeLists.txt b/paddle/cinn/frontend/op_mappers/paddle/CMakeLists.txt index 65d62b3253e11..5767a4c7df6a9 100644 --- a/paddle/cinn/frontend/op_mappers/paddle/CMakeLists.txt +++ b/paddle/cinn/frontend/op_mappers/paddle/CMakeLists.txt @@ -1,3 +1,7 @@ core_gather_headers() -file(GLOB paddle_op_mapper_srcs LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cc) +file( + GLOB paddle_op_mapper_srcs + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *.cc) gather_srcs(cinnapi_src SRCS ${paddle_op_mapper_srcs}) diff --git a/paddle/cinn/frontend/op_mappers/science/CMakeLists.txt b/paddle/cinn/frontend/op_mappers/science/CMakeLists.txt index 4a029e1774967..c68388e6a99ad 100644 --- a/paddle/cinn/frontend/op_mappers/science/CMakeLists.txt +++ b/paddle/cinn/frontend/op_mappers/science/CMakeLists.txt @@ -1,3 +1,7 @@ core_gather_headers() -file(GLOB paddlescience_op_mapper_srcs LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cc) +file( + GLOB paddlescience_op_mapper_srcs + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *.cc) gather_srcs(cinnapi_src SRCS ${paddlescience_op_mapper_srcs}) diff --git a/paddle/cinn/frontend/paddle/CMakeLists.txt b/paddle/cinn/frontend/paddle/CMakeLists.txt index d5418af18fb45..169f5ff4100b0 100644 --- a/paddle/cinn/frontend/paddle/CMakeLists.txt +++ b/paddle/cinn/frontend/paddle/CMakeLists.txt @@ -3,24 +3,37 @@ cinn_proto_library(cinn_framework_proto SRCS framework.proto) add_subdirectory(cpp) add_subdirectory(pb) -set(srcs - model_parser.cc - compatible_pb.cc - ) +set(srcs model_parser.cc compatible_pb.cc) -cinn_cc_test(test_model_parser SRCS model_parser_test.cc DEPS cinncore - ARGS --model_dir=${THIRD_PARTY_PATH}/model/lite_naive_model) +cinn_cc_test( + test_model_parser + SRCS + model_parser_test.cc + DEPS + cinncore + ARGS + --model_dir=${THIRD_PARTY_PATH}/model/lite_naive_model) foreach(cpp ${srcs}) - set(cinnapi_src "${cinnapi_src};paddle/cinn/frontend/paddle/${cpp}" CACHE INTERNAL "") + set(cinnapi_src + "${cinnapi_src};paddle/cinn/frontend/paddle/${cpp}" + CACHE INTERNAL "") endforeach() -file(GLOB includes LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR} *.h) +file( + GLOB includes + LIST_DIRECTORIES false + RELATIVE ${CMAKE_SOURCE_DIR} + *.h) foreach(header ${includes}) - set(core_includes "${core_includes};${header}" CACHE INTERNAL "") + set(core_includes + "${core_includes};${header}" + CACHE INTERNAL "") endforeach() foreach(header ${cinn_framework_proto_HDRS}) - set(core_proto_includes "${core_proto_includes};${header}" CACHE INTERNAL "") + set(core_proto_includes + "${core_proto_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/frontend/paddle/cpp/CMakeLists.txt b/paddle/cinn/frontend/paddle/cpp/CMakeLists.txt index 4c990c5d0b693..4c64ec5c8661d 100644 --- a/paddle/cinn/frontend/paddle/cpp/CMakeLists.txt +++ b/paddle/cinn/frontend/paddle/cpp/CMakeLists.txt @@ -1,18 +1,19 @@ -set(srcs - var_desc.cc - op_desc.cc - block_desc.cc - program_desc.cc - ) +set(srcs var_desc.cc op_desc.cc block_desc.cc program_desc.cc) foreach(cpp ${srcs}) set(cinnapi_src - "${cinnapi_src};paddle/cinn/frontend/paddle/cpp/${cpp}" - CACHE INTERNAL "") + "${cinnapi_src};paddle/cinn/frontend/paddle/cpp/${cpp}" + CACHE INTERNAL "") endforeach() -file(GLOB includes LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR} *.h) +file( + GLOB includes + LIST_DIRECTORIES false + RELATIVE ${CMAKE_SOURCE_DIR} + *.h) foreach(header ${includes}) - set(core_includes "${core_includes};${header}" CACHE INTERNAL "") + set(core_includes + "${core_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/frontend/paddle/pb/CMakeLists.txt b/paddle/cinn/frontend/paddle/pb/CMakeLists.txt index 096084db4821f..a555ccb2e12ce 100644 --- a/paddle/cinn/frontend/paddle/pb/CMakeLists.txt +++ b/paddle/cinn/frontend/paddle/pb/CMakeLists.txt @@ -1,16 +1,19 @@ -set(srcs - var_desc.cc - op_desc.cc - block_desc.cc - program_desc.cc - ) +set(srcs var_desc.cc op_desc.cc block_desc.cc program_desc.cc) foreach(cpp ${srcs}) - set(cinnapi_src "${cinnapi_src};paddle/cinn/frontend/paddle/pb/${cpp}" CACHE INTERNAL "") + set(cinnapi_src + "${cinnapi_src};paddle/cinn/frontend/paddle/pb/${cpp}" + CACHE INTERNAL "") endforeach() -file(GLOB includes LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR} *.h) +file( + GLOB includes + LIST_DIRECTORIES false + RELATIVE ${CMAKE_SOURCE_DIR} + *.h) foreach(header ${includes}) - set(core_includes "${core_includes};${header}" CACHE INTERNAL "") + set(core_includes + "${core_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/frontend/pass/CMakeLists.txt b/paddle/cinn/frontend/pass/CMakeLists.txt index ffca90c22824e..b145e79737a9b 100755 --- a/paddle/cinn/frontend/pass/CMakeLists.txt +++ b/paddle/cinn/frontend/pass/CMakeLists.txt @@ -1,36 +1,47 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - decomposer.cc - dead_code_eliminate.cc - remove_identity.cc - transpose_collapsing.cc - transpose_folding_input.cc - transpose_folding_output.cc - gemm_rewriter.cc - fill_constant_rewriter.cc - fill_constant_folding.cc - cast_collapsing.cc - auto_cast.cc - expand_zero_dim_pass.cc - auto_broadcast.cc - ) +gather_srcs( + cinnapi_src + SRCS + decomposer.cc + dead_code_eliminate.cc + remove_identity.cc + transpose_collapsing.cc + transpose_folding_input.cc + transpose_folding_output.cc + gemm_rewriter.cc + fill_constant_rewriter.cc + fill_constant_folding.cc + cast_collapsing.cc + auto_cast.cc + expand_zero_dim_pass.cc + auto_broadcast.cc) -if (WITH_CUDA) -cinn_cc_test(test_decomposer_pass SRCS decomposer_test.cc DEPS cinncore) -cinn_cc_test(test_dead_code_eliminate_pass SRCS dead_code_eliminate_test.cc DEPS cinncore) -cinn_cc_test(test_remove_identity_pass SRCS remove_identity_test.cc DEPS cinncore) -cinn_cc_test(test_fill_constant_rewriter_pass SRCS fill_constant_rewriter_test.cc DEPS cinncore) -cinn_cc_test(test_fill_constant_folding_pass SRCS fill_constant_folding_test.cc DEPS cinncore) -cinn_cc_test(test_program_topoerror SRCS program_topoerror_test.cc DEPS cinncore) +if(WITH_CUDA) + cinn_cc_test(test_decomposer_pass SRCS decomposer_test.cc DEPS cinncore) + cinn_cc_test(test_dead_code_eliminate_pass SRCS dead_code_eliminate_test.cc + DEPS cinncore) + cinn_cc_test(test_remove_identity_pass SRCS remove_identity_test.cc DEPS + cinncore) + cinn_cc_test(test_fill_constant_rewriter_pass SRCS + fill_constant_rewriter_test.cc DEPS cinncore) + cinn_cc_test(test_fill_constant_folding_pass SRCS + fill_constant_folding_test.cc DEPS cinncore) + cinn_cc_test(test_program_topoerror SRCS program_topoerror_test.cc DEPS + cinncore) endif() -if (WITH_CUDNN) -cinn_cc_test(test_gemm_rewriter_pass SRCS gemm_rewriter_test.cc DEPS cinncore) -cinn_cc_test(test_transpose_folding_input_pass SRCS transpose_folding_input_test.cc DEPS cinncore) -cinn_cc_test(test_transpose_folding_output_pass SRCS transpose_folding_output_test.cc DEPS cinncore) -cinn_cc_test(test_transpose_scale_folding SRCS transpose_scale_folding_test.cc DEPS cinncore) +if(WITH_CUDNN) + cinn_cc_test(test_gemm_rewriter_pass SRCS gemm_rewriter_test.cc DEPS cinncore) + cinn_cc_test(test_transpose_folding_input_pass SRCS + transpose_folding_input_test.cc DEPS cinncore) + cinn_cc_test(test_transpose_folding_output_pass SRCS + transpose_folding_output_test.cc DEPS cinncore) + cinn_cc_test(test_transpose_scale_folding SRCS + transpose_scale_folding_test.cc DEPS cinncore) endif() -cinn_cc_test(test_transpose_collapsing SRCS transpose_collapsing_test.cc DEPS cinncore) +cinn_cc_test(test_transpose_collapsing SRCS transpose_collapsing_test.cc DEPS + cinncore) cinn_cc_test(test_cast_collapsing SRCS cast_collapsing_test.cc DEPS cinncore) cinn_cc_test(test_auto_cast SRCS auto_cast_test.cc DEPS cinncore) -cinn_cc_test(test_expand_zero_dim_pass SRCS expand_zero_dim_pass_test.cc DEPS cinncore) +cinn_cc_test(test_expand_zero_dim_pass SRCS expand_zero_dim_pass_test.cc DEPS + cinncore) diff --git a/paddle/cinn/hlir/framework/CMakeLists.txt b/paddle/cinn/hlir/framework/CMakeLists.txt index 5485f6c3cd5ad..6e0abaeec96e6 100755 --- a/paddle/cinn/hlir/framework/CMakeLists.txt +++ b/paddle/cinn/hlir/framework/CMakeLists.txt @@ -1,41 +1,46 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - tensor.cc - scope.cc - variable.cc - buffer.cc - memory.cc - instruction.cc - parallel_compiler.cc - graph_compiler.cc - graph.cc - node.cc - pass.cc - op_strategy.cc - op_lowering.cc - op_lowering_util.cc - accuracy_checker.cc - visualize_helper.cc -) +gather_srcs( + cinnapi_src + SRCS + tensor.cc + scope.cc + variable.cc + buffer.cc + memory.cc + instruction.cc + parallel_compiler.cc + graph_compiler.cc + graph.cc + node.cc + pass.cc + op_strategy.cc + op_lowering.cc + op_lowering_util.cc + accuracy_checker.cc + visualize_helper.cc) if(WITH_CUDA) cinn_nv_test(test_hlir_framework_buffer SRCS buffer_test.cc DEPS cinncore) - cinn_cc_test(test_hlir_framework_accuracy_checker SRCS accuracy_checker_test.cc DEPS cinncore) - cinn_cc_test(test_hlir_framework_parallel_compiler SRCS parallel_compiler_test.cc DEPS cinncore) + cinn_cc_test(test_hlir_framework_accuracy_checker SRCS + accuracy_checker_test.cc DEPS cinncore) + cinn_cc_test(test_hlir_framework_parallel_compiler SRCS + parallel_compiler_test.cc DEPS cinncore) else() cinn_cc_test(test_hlir_framework_buffer SRCS buffer_test.cc DEPS cinncore) endif() - -if (WITH_CUDA) -cinn_cc_test(test_hlir_framework_op_lowering SRCS op_lowering_test.cc DEPS cinncore decomposer_test_helper) +if(WITH_CUDA) + cinn_cc_test(test_hlir_framework_op_lowering SRCS op_lowering_test.cc DEPS + cinncore decomposer_test_helper) endif() cinn_cc_test(test_hlir_framework_tensor SRCS tensor_test.cc DEPS cinncore) cinn_cc_test(test_hlir_framework_scope SRCS scope_test.cc DEPS cinncore) -cinn_cc_test(test_hlir_framework_instruction SRCS instruction_test.cc DEPS cinncore) +cinn_cc_test(test_hlir_framework_instruction SRCS instruction_test.cc DEPS + cinncore) cinn_cc_test(test_hlir_framework_op SRCS op_test.cc DEPS cinncore) -cinn_cc_test(test_hlir_framework_print_graph_pass SRCS print_graph_pass_test.cc DEPS cinncore) +cinn_cc_test(test_hlir_framework_print_graph_pass SRCS print_graph_pass_test.cc + DEPS cinncore) cinn_cc_test(test_hlir_framework_graph SRCS graph_test.cc DEPS cinncore) #cinn_cc_test(test_hlir_framework_graph_compiler SRCS graph_compiler_test.cc DEPS cinncore) diff --git a/paddle/cinn/hlir/kernels/CMakeLists.txt b/paddle/cinn/hlir/kernels/CMakeLists.txt index e69de29bb2d1d..8b137891791fe 100644 --- a/paddle/cinn/hlir/kernels/CMakeLists.txt +++ b/paddle/cinn/hlir/kernels/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/paddle/cinn/hlir/op/CMakeLists.txt b/paddle/cinn/hlir/op/CMakeLists.txt index 23f4c836a14f3..e226d14589751 100644 --- a/paddle/cinn/hlir/op/CMakeLists.txt +++ b/paddle/cinn/hlir/op/CMakeLists.txt @@ -2,22 +2,24 @@ add_subdirectory(contrib) core_gather_headers() -gather_srcs(cinnapi_src SRCS - nn.cc - broadcast.cc - transform.cc - elementwise.cc - reduction.cc - op_util.cc - custom_call.cc - external_api_registry.cc - ) +gather_srcs( + cinnapi_src + SRCS + nn.cc + broadcast.cc + transform.cc + elementwise.cc + reduction.cc + op_util.cc + custom_call.cc + external_api_registry.cc) cinn_cc_test(test_cinn_op_broadcast SRCS op_broadcast_test.cc DEPS cinncore) cinn_cc_test(test_cinn_op_nn SRCS op_nn_test.cc DEPS cinncore) cinn_cc_test(test_cinn_op_transform SRCS transform_test.cc DEPS cinncore) -cinn_cc_test(test_external_api_registry SRCS external_api_registry_test.cc DEPS cinncore) +cinn_cc_test(test_external_api_registry SRCS external_api_registry_test.cc DEPS + cinncore) -if (WITH_CUDA) -cinn_cc_test(test_cinn_op_reduction SRCS reduction_test.cc DEPS cinncore) +if(WITH_CUDA) + cinn_cc_test(test_cinn_op_reduction SRCS reduction_test.cc DEPS cinncore) endif() diff --git a/paddle/cinn/hlir/op/contrib/CMakeLists.txt b/paddle/cinn/hlir/op/contrib/CMakeLists.txt index 53381180cc34e..681324525e262 100644 --- a/paddle/cinn/hlir/op/contrib/CMakeLists.txt +++ b/paddle/cinn/hlir/op/contrib/CMakeLists.txt @@ -1,23 +1,24 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - gather_nd.cc - sort.cc - argmin.cc - argmax.cc - repeat.cc - lookup_table.cc - one_hot.cc - reciprocal.cc - gaussian_random.cc - uniform_random.cc - cholesky.cc - triangular_solve.cc - bitcast_convert.cc - randint.cc - resize.cc - assert_true.cc - ) +gather_srcs( + cinnapi_src + SRCS + gather_nd.cc + sort.cc + argmin.cc + argmax.cc + repeat.cc + lookup_table.cc + one_hot.cc + reciprocal.cc + gaussian_random.cc + uniform_random.cc + cholesky.cc + triangular_solve.cc + bitcast_convert.cc + randint.cc + resize.cc + assert_true.cc) cinn_cc_test(test_gather_nd SRCS gather_nd_test.cc DEPS cinncore) cinn_cc_test(test_sort SRCS sort_test.cc DEPS cinncore) diff --git a/paddle/cinn/hlir/pass/CMakeLists.txt b/paddle/cinn/hlir/pass/CMakeLists.txt index fc494b7fd97bf..ce09c9eddc562 100644 --- a/paddle/cinn/hlir/pass/CMakeLists.txt +++ b/paddle/cinn/hlir/pass/CMakeLists.txt @@ -1,42 +1,50 @@ core_gather_headers() - -gather_srcs(cinnapi_src SRCS - infershape.cc - opfusion.cc - alterlayout.cc - const_propagate.cc - op_fusion_pass.cc - fusion_merge_pass.cc - dot_merger.cc - check_fusion_accuracy_pass.cc - custom_call_pass.cc - common_subexpression_elimination.cc - constant_folding_pass.cc - dce_pass.cc - dense_merge_pass.cc - reduce_split_pass.cc - single_group_optimize_pass.cc - constant_folding_pass_util.cc - ) +gather_srcs( + cinnapi_src + SRCS + infershape.cc + opfusion.cc + alterlayout.cc + const_propagate.cc + op_fusion_pass.cc + fusion_merge_pass.cc + dot_merger.cc + check_fusion_accuracy_pass.cc + custom_call_pass.cc + common_subexpression_elimination.cc + constant_folding_pass.cc + dce_pass.cc + dense_merge_pass.cc + reduce_split_pass.cc + single_group_optimize_pass.cc + constant_folding_pass_util.cc) #cinn_cc_test(test_opfusion SRCS opfusion_test.cc DEPS cinncore) -if (WITH_CUDA) -cinn_cc_test(test_primitive_ops SRCS test_primitive_ops.cc DEPS cinncore) -cinn_cc_test(test_const_propagate SRCS const_propagate_test.cc DEPS cinncore) -cinn_cc_test(test_dot_merger_pass SRCS dot_merger_test.cc DEPS cinncore) +if(WITH_CUDA) + cinn_cc_test(test_primitive_ops SRCS test_primitive_ops.cc DEPS cinncore) + cinn_cc_test(test_const_propagate SRCS const_propagate_test.cc DEPS cinncore) + cinn_cc_test(test_dot_merger_pass SRCS dot_merger_test.cc DEPS cinncore) -# TODO(thisjiang): move when test bug in x86 is fixed -cinn_cc_test(test_check_fusion_accuracy_pass SRCS check_fusion_accuracy_pass_test.cc DEPS cinncore decomposer_test_helper) -cinn_cc_test(test_dense_merge_pass SRCS dense_merge_pass_test.cc DEPS cinncore) -cinn_cc_test(test_reduce_split_pass SRCS reduce_split_pass_test.cc DEPS cinncore) + # TODO(thisjiang): move when test bug in x86 is fixed + cinn_cc_test( + test_check_fusion_accuracy_pass SRCS check_fusion_accuracy_pass_test.cc + DEPS cinncore decomposer_test_helper) + cinn_cc_test(test_dense_merge_pass SRCS dense_merge_pass_test.cc DEPS + cinncore) + cinn_cc_test(test_reduce_split_pass SRCS reduce_split_pass_test.cc DEPS + cinncore) endif() -cinn_cc_test(test_op_fusion_pass SRCS op_fusion_pass_test.cc DEPS cinncore decomposer_test_helper) -cinn_cc_test(test_fusion_merge_pass SRCS fusion_merge_pass_test.cc DEPS cinncore decomposer_test_helper) -if (NOT WITH_CUDA) -#cinn_cc_test(test_alterlayout SRCS alterlayout_test.cc DEPS cinncore) +cinn_cc_test(test_op_fusion_pass SRCS op_fusion_pass_test.cc DEPS cinncore + decomposer_test_helper) +cinn_cc_test(test_fusion_merge_pass SRCS fusion_merge_pass_test.cc DEPS + cinncore decomposer_test_helper) +if(NOT WITH_CUDA) + #cinn_cc_test(test_alterlayout SRCS alterlayout_test.cc DEPS cinncore) endif() cinn_cc_test(test_dot_merger SRCS test_dot_merger.cc DEPS cinncore) cinn_cc_test(test_dce_pass SRCS dce_pass_test.cc DEPS cinncore) -cinn_cc_test(test_common_subexpression_elimination SRCS common_subexpression_elimination_test.cc DEPS cinncore) -cinn_cc_test(test_constant_folding_pass SRCS constant_folding_pass_test.cc DEPS cinncore) +cinn_cc_test(test_common_subexpression_elimination SRCS + common_subexpression_elimination_test.cc DEPS cinncore) +cinn_cc_test(test_constant_folding_pass SRCS constant_folding_pass_test.cc DEPS + cinncore) diff --git a/paddle/cinn/hlir/pe/CMakeLists.txt b/paddle/cinn/hlir/pe/CMakeLists.txt index 1719549c055eb..cfa267cb7d53d 100755 --- a/paddle/cinn/hlir/pe/CMakeLists.txt +++ b/paddle/cinn/hlir/pe/CMakeLists.txt @@ -2,18 +2,19 @@ cinn_proto_library(param_proto SRCS schedule_param.proto) core_gather_headers() -gather_srcs(cinnapi_src SRCS - broadcast.cc - elementwise.cc - nn.cc - nn_util.cc - reduction.cc - load_x86_params.cc - schedule.cc - ir_schedule_pe.cc - transform.cc - vision.cc - ) +gather_srcs( + cinnapi_src + SRCS + broadcast.cc + elementwise.cc + nn.cc + nn_util.cc + reduction.cc + load_x86_params.cc + schedule.cc + ir_schedule_pe.cc + transform.cc + vision.cc) cinn_cc_test(test_cinn_pe_elementwise SRCS pe_elementwise_test.cc DEPS cinncore) cinn_cc_test(test_cinn_pe_broadcast SRCS pe_broadcast_test.cc DEPS cinncore) @@ -21,5 +22,7 @@ cinn_cc_test(test_cinn_pe_transform SRCS pe_transform_test.cc DEPS cinncore) cinn_cc_test(test_load_params SRCS load_params_test.cc DEPS cinncore) foreach(header ${param_proto_HDRS}) - set(core_proto_includes "${core_proto_includes};${header}" CACHE INTERNAL "") + set(core_proto_includes + "${core_proto_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/ir/CMakeLists.txt b/paddle/cinn/ir/CMakeLists.txt index 04e416048a466..533acdd680236 100755 --- a/paddle/cinn/ir/CMakeLists.txt +++ b/paddle/cinn/ir/CMakeLists.txt @@ -2,37 +2,45 @@ cinn_proto_library(schedule_desc_proto SRCS schedule_desc.proto) core_gather_headers() -gather_srcs(cinnapi_src SRCS - ir.cc - ir_base.cc - ir_schedule.cc - ir_schedule_util.cc - ir_visitor.cc - ir_printer.cc - ir_mutator.cc - function_definition.cc - lowered_func.cc - ir_operators.cc - ir_verify.cc - buffer.cc - function_base.cc - operation.cc - collect_ir_nodes.cc - registry.cc - tensor.cc - module.cc - intrinsic_ops.cc - layout.cc - schedule_desc.cc - ir_compare.cc - ) +gather_srcs( + cinnapi_src + SRCS + ir.cc + ir_base.cc + ir_schedule.cc + ir_schedule_util.cc + ir_visitor.cc + ir_printer.cc + ir_mutator.cc + function_definition.cc + lowered_func.cc + ir_operators.cc + ir_verify.cc + buffer.cc + function_base.cc + operation.cc + collect_ir_nodes.cc + registry.cc + tensor.cc + module.cc + intrinsic_ops.cc + layout.cc + schedule_desc.cc + ir_compare.cc) # cinn_cc_test(test_ir SRCS ir_test.cc DEPS core) # cinn_cc_test(test_ir_printer SRCS ir_printer_test.cc DEPS core) # cinn_cc_test(test_ir_operators SRCS ir_operators_test.cc DEPS core) cinn_cc_test(test_collect_ir_nodes SRCS collect_ir_nodes_test.cc DEPS cinncore) # cinn_cc_test(test_tensor SRCS tensor_test.cc DEPS core) -cinn_cc_test(test_buffer SRCS buffer_test.cc DEPS cinncore ARGS ${global_test_args}) +cinn_cc_test( + test_buffer + SRCS + buffer_test.cc + DEPS + cinncore + ARGS + ${global_test_args}) cinn_cc_test(test_tensor SRCS tensor_test.cc DEPS cinncore) cinn_cc_test(test_intrinsic_ops SRCS intrinsic_ops_test.cc DEPS cinncore) cinn_cc_test(test_ir_verify SRCS ir_verify_test.cc DEPS cinncore) @@ -40,5 +48,7 @@ cinn_cc_test(test_schedule_desc SRCS schedule_desc_test.cc DEPS cinncore) cinn_cc_test(test_ir_compare SRCS ir_compare_test.cc DEPS cinncore) foreach(header ${schedule_desc_proto_HDRS}) - set(core_proto_includes "${core_proto_includes};${header}" CACHE INTERNAL "") + set(core_proto_includes + "${core_proto_includes};${header}" + CACHE INTERNAL "") endforeach() diff --git a/paddle/cinn/lang/CMakeLists.txt b/paddle/cinn/lang/CMakeLists.txt index bd1e0376a3572..f4ef9e6d7b103 100644 --- a/paddle/cinn/lang/CMakeLists.txt +++ b/paddle/cinn/lang/CMakeLists.txt @@ -1,14 +1,15 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - buffer.cc - compute.cc - placeholder.cc - lower.cc - builtin.cc - lower_impl.cc - packed_func.cc - ) +gather_srcs( + cinnapi_src + SRCS + buffer.cc + compute.cc + placeholder.cc + lower.cc + builtin.cc + lower_impl.cc + packed_func.cc) cinn_cc_test(test_compute SRCS compute_test.cc DEPS cinncore) cinn_cc_test(test_placeholder SRCS placeholder_test.cc DEPS cinncore) diff --git a/paddle/cinn/optim/CMakeLists.txt b/paddle/cinn/optim/CMakeLists.txt index 847a2867abf9d..c8313a91af439 100755 --- a/paddle/cinn/optim/CMakeLists.txt +++ b/paddle/cinn/optim/CMakeLists.txt @@ -1,50 +1,68 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - remove_nested_block.cc - replace_call_with_expr.cc - ir_copy.cc - ir_replace.cc - replace_var_with_expr.cc - tensor_write_tell.cc - ir_simplify.cc - optimize.cc - vectorize_loops.cc - unroll_loops.cc - transform_polyfor_to_for.cc - eliminate_broadcast_in_forloop.cc - fold_cinn_call_arguments.cc - call_arg_list_to_pod_value.cc - insert_debug_log_callee.cc - lower_function_call_bind_vars.cc - extern_call_process.cc - map_extern_call.cc - compute_inline_expand.cc - buffer_assign.cc - replace_const_param_to_integer.cc - cast_simplify.cc - if_simplify.cc - lower_intrin.cc - cast_bool_to_int8.cc - collect_undefined_vars.cc - var_mod_simplify.cc - remove_schedule_block.cc - ) +gather_srcs( + cinnapi_src + SRCS + remove_nested_block.cc + replace_call_with_expr.cc + ir_copy.cc + ir_replace.cc + replace_var_with_expr.cc + tensor_write_tell.cc + ir_simplify.cc + optimize.cc + vectorize_loops.cc + unroll_loops.cc + transform_polyfor_to_for.cc + eliminate_broadcast_in_forloop.cc + fold_cinn_call_arguments.cc + call_arg_list_to_pod_value.cc + insert_debug_log_callee.cc + lower_function_call_bind_vars.cc + extern_call_process.cc + map_extern_call.cc + compute_inline_expand.cc + buffer_assign.cc + replace_const_param_to_integer.cc + cast_simplify.cc + if_simplify.cc + lower_intrin.cc + cast_bool_to_int8.cc + collect_undefined_vars.cc + var_mod_simplify.cc + remove_schedule_block.cc) -if (WITH_CUDA) +if(WITH_CUDA) gather_srcs(cinnapi_src SRCS transform_gpu_forloop.cc) endif() - -cinn_cc_test(test_remove_nested_block SRCS remove_nested_block_test.cc DEPS cinncore) +cinn_cc_test(test_remove_nested_block SRCS remove_nested_block_test.cc DEPS + cinncore) cinn_cc_test(test_ir_copy SRCS ir_copy_test.cc DEPS cinncore) cinn_cc_test(test_ir_simplify SRCS ir_simplify_test.cc DEPS cinncore) -cinn_cc_test(test_replace_call_with_expr SRCS replace_call_with_expr_test.cc DEPS cinncore) -cinn_cc_test(test_vectorize_loops SRCS vectorize_loops_test.cc DEPS cinncore ARGS ${global_test_args}) -cinn_cc_test(test_transform_polyfor_to_for SRCS transform_polyfor_to_for_test.cc DEPS cinncore ARGS ${global_test_args}) +cinn_cc_test(test_replace_call_with_expr SRCS replace_call_with_expr_test.cc + DEPS cinncore) +cinn_cc_test( + test_vectorize_loops + SRCS + vectorize_loops_test.cc + DEPS + cinncore + ARGS + ${global_test_args}) +cinn_cc_test( + test_transform_polyfor_to_for + SRCS + transform_polyfor_to_for_test.cc + DEPS + cinncore + ARGS + ${global_test_args}) cinn_cc_test(test_optimize SRCS optimize_test.cc DEPS cinncore) -cinn_cc_test(test_cache_read_write_replace SRCS cache_read_write_replace_test.cc DEPS cinncore) +cinn_cc_test(test_cache_read_write_replace SRCS + cache_read_write_replace_test.cc DEPS cinncore) cinn_cc_test(test_cast_simplify SRCS cast_simplify_test.cc DEPS cinncore) cinn_cc_test(test_if_simplify SRCS if_simplify_test.cc DEPS cinncore) -cinn_cc_test(test_remove_schedule_block SRCS remove_schedule_block_test.cc DEPS cinncore) +cinn_cc_test(test_remove_schedule_block SRCS remove_schedule_block_test.cc DEPS + cinncore) cinn_cc_test(test_unroll_loops SRCS unroll_loops_test.cc DEPS cinncore) diff --git a/paddle/cinn/poly/CMakeLists.txt b/paddle/cinn/poly/CMakeLists.txt index 01365f1f9a22e..e74ae5d215880 100644 --- a/paddle/cinn/poly/CMakeLists.txt +++ b/paddle/cinn/poly/CMakeLists.txt @@ -1,24 +1,26 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS - dim.cc - domain.cc - domain_add_unit_loop_mutator.cc - map.cc - stage.cc - isl_utils.cc - schedule.cc - naive_scheduler.cc - poly_scheduler.cc - ast_gen.cc - graph.cc - compute_at_transform.cc - ) +gather_srcs( + cinnapi_src + SRCS + dim.cc + domain.cc + domain_add_unit_loop_mutator.cc + map.cc + stage.cc + isl_utils.cc + schedule.cc + naive_scheduler.cc + poly_scheduler.cc + ast_gen.cc + graph.cc + compute_at_transform.cc) # cinn_cc_test(test_graph SRCS graph_test.cc DEPS core) cinn_cc_test(test_schedule SRCS schedule_test.cc DEPS cinncore) # cinn_cc_test(test_poly_scheduler SRCS poly_scheduler_test.cc DEPS core) cinn_cc_test(test_stage SRCS stage_test.cc DEPS cinncore) -cinn_cc_test(test_compute_at_transform SRCS compute_at_transform_test.cc DEPS cinncore) +cinn_cc_test(test_compute_at_transform SRCS compute_at_transform_test.cc DEPS + cinncore) cinn_cc_test(test_ast_gen SRCS ast_gen_test.cc DEPS cinncore) cinn_cc_test(test_isl_utils SRCS isl_utils_test.cc DEPS cinncore) diff --git a/paddle/cinn/pybind/CMakeLists.txt b/paddle/cinn/pybind/CMakeLists.txt index 710a0f8dc92db..bf6e3d095377f 100755 --- a/paddle/cinn/pybind/CMakeLists.txt +++ b/paddle/cinn/pybind/CMakeLists.txt @@ -1,24 +1,49 @@ -set(srcs runtime.cc common.cc lang.cc ir.cc poly.cc backends.cc bind.cc optim.cc pe.cc frontend.cc framework.cc utils.cc) +set(srcs + runtime.cc + common.cc + lang.cc + ir.cc + poly.cc + backends.cc + bind.cc + optim.cc + pe.cc + frontend.cc + framework.cc + utils.cc) -if (WITH_CUDA) +if(WITH_CUDA) message(STATUS "Compile core_api with CUDA support") - cinn_nv_library(core_api SHARED - SRCS ${srcs} - DEPS cinncore_static cinn_runtime pybind) + cinn_nv_library( + core_api + SHARED + SRCS + ${srcs} + DEPS + cinncore_static + cinn_runtime + pybind) message("cuda_nvrtc: ${CUDA_NVRTC}") target_link_libraries(core_api ${CUDA_NVRTC_LIB} ${CUDA_LIBRARIES} cuda cudnn) - if (NVTX_FOUND) + if(NVTX_FOUND) target_link_libraries(core_api ${CUDA_NVTX_LIB}) endif() else() message(STATUS "Compile core_api without CUDA support") - cinn_cc_library(core_api SHARED - SRCS ${srcs} - DEPS cinncore_static cinn_runtime pybind ${llvm_libs}) + cinn_cc_library( + core_api + SHARED + SRCS + ${srcs} + DEPS + cinncore_static + cinn_runtime + pybind + ${llvm_libs}) endif() target_link_libraries(core_api ${MKLML_LIB} isl ginac) -if (USE_OPENMP STREQUAL "gnu") +if(USE_OPENMP STREQUAL "gnu") target_link_libraries(core_api ${OpenMP_CXX_LIBRARIES}) message(STATUS "OpenMP lib: ${OpenMP_CXX_LIBRARIES}") elseif(USE_OPENMP STREQUAL "intel") @@ -26,4 +51,4 @@ elseif(USE_OPENMP STREQUAL "intel") message(STATUS "OpenMP lib: ${MKLML_IOMP_LIB}") endif() -SET_TARGET_PROPERTIES(core_api PROPERTIES PREFIX "") +set_target_properties(core_api PROPERTIES PREFIX "") diff --git a/paddle/cinn/runtime/CMakeLists.txt b/paddle/cinn/runtime/CMakeLists.txt index 0a90f8ca66784..5f0c3891577fa 100644 --- a/paddle/cinn/runtime/CMakeLists.txt +++ b/paddle/cinn/runtime/CMakeLists.txt @@ -1,22 +1,23 @@ core_gather_headers() -gather_srcs(cinnapi_src SRCS +gather_srcs( + cinnapi_src + SRCS flags.cc intrinsic.cc cinn_runtime.cc intrinsic_types.cc - custom_function.cc - ) + custom_function.cc) -cinn_cc_library(cinn_runtime SRCS cinn_runtime.cc buffer.cc - #cinn_x86_device_impl.cc - ) +cinn_cc_library( + cinn_runtime SRCS cinn_runtime.cc buffer.cc #cinn_x86_device_impl.cc +) cinn_cc_test(test_cinn_runtime SRCS cinn_runtime_test.cc DEPS cinn_runtime) cinn_cc_test(test_custom_function SRCS custom_function_test.cc DEPS cinncore) -if (WITH_OPENMP) -cinn_cc_library(tiny_runtime STATIC SRCS tiny_runtime.cc) +if(WITH_OPENMP) + cinn_cc_library(tiny_runtime STATIC SRCS tiny_runtime.cc) endif() add_subdirectory(cuda) diff --git a/paddle/cinn/runtime/cpu/CMakeLists.txt b/paddle/cinn/runtime/cpu/CMakeLists.txt index a0b8070f1840c..72fa5f51bb0ca 100644 --- a/paddle/cinn/runtime/cpu/CMakeLists.txt +++ b/paddle/cinn/runtime/cpu/CMakeLists.txt @@ -1,26 +1,22 @@ core_gather_headers() +gather_srcs(cinnapi_src SRCS host_intrinsics.cc thread_backend.cc) -gather_srcs(cinnapi_src SRCS - host_intrinsics.cc - thread_backend.cc) - - -if (WITH_MKL_CBLAS) +if(WITH_MKL_CBLAS) gather_srcs(cinnapi_src SRCS mkl_math.cc cblas.cc) - if (WITH_MKLDNN) + if(WITH_MKLDNN) gather_srcs(cinnapi_src SRCS mkldnn_math.cc) endif() endif() - cinn_cc_test(test_host_intrinsics SRCS host_intrinsics_test.cc DEPS cinncore) -if (WITH_MKL_CBLAS) - if (NOT WITH_CUDA) +if(WITH_MKL_CBLAS) + if(NOT WITH_CUDA) cinn_cc_test(test_mkl_math SRCS mkl_math_test.cc mkl_math.cc DEPS cinncore) endif() - if (WITH_MKLDNN) - cinn_cc_test(test_mkldnn_math SRCS mkldnn_math_test.cc mkldnn_math.cc DEPS cinncore) - endif () + if(WITH_MKLDNN) + cinn_cc_test(test_mkldnn_math SRCS mkldnn_math_test.cc mkldnn_math.cc DEPS + cinncore) + endif() endif() diff --git a/paddle/cinn/runtime/cuda/CMakeLists.txt b/paddle/cinn/runtime/cuda/CMakeLists.txt index be3a6bcd9fe8f..f2935085fc319 100755 --- a/paddle/cinn/runtime/cuda/CMakeLists.txt +++ b/paddle/cinn/runtime/cuda/CMakeLists.txt @@ -1,19 +1,18 @@ -if (NOT WITH_CUDA) - return() -endif () +if(NOT WITH_CUDA) + return() +endif() core_gather_headers() - -gather_srcs(cinnapi_src SRCS - cuda_module.cc - cuda_util.cc - cuda_intrinsics.cc - cuda_intrinsics_reduce.cc - cuda_instrinsics_float16.cc - cuda_instrinsics_bfloat16.cc - ) - +gather_srcs( + cinnapi_src + SRCS + cuda_module.cc + cuda_util.cc + cuda_intrinsics.cc + cuda_intrinsics_reduce.cc + cuda_instrinsics_float16.cc + cuda_instrinsics_bfloat16.cc) cinn_nv_test(test_cuda_module SRCS cuda_module_test.cc DEPS cinncore) cinn_nv_library(cuda_runtime SRCS cinn_cuda_runtime_source.cuh) diff --git a/paddle/cinn/utils/CMakeLists.txt b/paddle/cinn/utils/CMakeLists.txt index 58839bfe83f17..39e37b5a3471b 100755 --- a/paddle/cinn/utils/CMakeLists.txt +++ b/paddle/cinn/utils/CMakeLists.txt @@ -1,7 +1,8 @@ core_gather_headers() - -gather_srcs(cinnapi_src SRCS +gather_srcs( + cinnapi_src + SRCS dot_lang.cc error.cc functional.cc @@ -13,11 +14,18 @@ gather_srcs(cinnapi_src SRCS event.cc multi_threading.cc data_util.cc - random_engine.cc - ) + random_engine.cc) cinn_cc_test(test_string SRCS string_test.cc DEPS cinncore) cinn_cc_test(test_sized_multi_set SRCS sized_multi_set_test.cc DEPS cinncore) cinn_cc_test(test_multi_threading SRCS multi_threading_test.cc DEPS cinncore) -cinn_cc_test(test_functional SRCS string.cc functional.cc functional_test.cc DEPS absl Threads::Threads) +cinn_cc_test( + test_functional + SRCS + string.cc + functional.cc + functional_test.cc + DEPS + absl + Threads::Threads) cinn_cc_test(test_profiler SRCS profiler_test.cc DEPS cinncore) diff --git a/test/cpp/cinn/CMakeLists.txt b/test/cpp/cinn/CMakeLists.txt index b993b8a61b288..6ed75fa8c3f7d 100644 --- a/test/cpp/cinn/CMakeLists.txt +++ b/test/cpp/cinn/CMakeLists.txt @@ -1,21 +1,42 @@ cinn_cc_library(test_program_builder SRCS program_builder.cc DEPS cinncore) -if (WITH_TESTING) +if(WITH_TESTING) include_directories(${CMAKE_SOURCE_DIR}/paddle/cinn/runtime) add_subdirectory(benchmark) - cinn_cc_test(test01_elementwise_add_main SRCS test01_elementwise_add_main.cc DEPS cinncore - ARGS ${global_test_args} - ) - cinn_cc_test(test01_elementwise_add_case SRCS test01_elementwise_add_case.cc DEPS cinncore) - add_run_test_dependency(test01_elementwise_add_case test01_elementwise_add_main) + cinn_cc_test( + test01_elementwise_add_main + SRCS + test01_elementwise_add_main.cc + DEPS + cinncore + ARGS + ${global_test_args}) + cinn_cc_test(test01_elementwise_add_case SRCS test01_elementwise_add_case.cc + DEPS cinncore) + add_run_test_dependency(test01_elementwise_add_case + test01_elementwise_add_main) - cinn_cc_test(test02_matmul_main SRCS test02_matmul_main.cc DEPS cinncore ARGS ${global_test_args}) + cinn_cc_test( + test02_matmul_main + SRCS + test02_matmul_main.cc + DEPS + cinncore + ARGS + ${global_test_args}) cinn_cc_test(test02_matmul_case SRCS test02_matmul_case.cc DEPS cinncore) target_compile_options(test02_matmul_case PRIVATE "-O3") add_run_test_dependency(test02_matmul_case test02_matmul_main) - cinn_cc_test(test03_conv_main SRCS test03_convolution_main.cc DEPS cinncore ARGS ${global_test_args}) + cinn_cc_test( + test03_conv_main + SRCS + test03_convolution_main.cc + DEPS + cinncore + ARGS + ${global_test_args}) cinn_cc_test(test03_conv_case SRCS test03_convolution_case.cc DEPS cinncore) target_compile_options(test03_conv_case PRIVATE "-O3") add_run_test_dependency(test03_conv_case test03_conv_main) diff --git a/test/cpp/cinn/benchmark/CMakeLists.txt b/test/cpp/cinn/benchmark/CMakeLists.txt index 35b41f0becb69..86dcd8f3b7c96 100755 --- a/test/cpp/cinn/benchmark/CMakeLists.txt +++ b/test/cpp/cinn/benchmark/CMakeLists.txt @@ -1,10 +1,19 @@ include_directories(${CMAKE_SOURCE_DIR}/paddle/cinn/runtime) -set(srcs test_utils.cc test_matmul.cc test_elementwise.cc test_all_ops_default.cc) +set(srcs test_utils.cc test_matmul.cc test_elementwise.cc + test_all_ops_default.cc) #cinn_cc_test(test_bk_matmul SRCS test_matmul.cc test_utils.cc DEPS cinncore ARGS ${global_test_args}) #target_compile_options(test_bk_matmul PRIVATE "-O3") -cinn_cc_test(test_bk_elementwise SRCS test_elementwise.cc test_utils.cc DEPS cinncore ARGS ${global_test_args}) +cinn_cc_test( + test_bk_elementwise + SRCS + test_elementwise.cc + test_utils.cc + DEPS + cinncore + ARGS + ${global_test_args}) target_compile_options(test_bk_elementwise PRIVATE "-O3") #cinn_cc_test(test_all_ops_default SRCS test_all_ops_default.cc test_utils.cc DEPS cinncore ARGS ${global_test_args}) diff --git a/test/cpp/fluid/cinn/CMakeLists.txt b/test/cpp/fluid/cinn/CMakeLists.txt index 1fb0b5fae6009..ad640a34fbe10 100644 --- a/test/cpp/fluid/cinn/CMakeLists.txt +++ b/test/cpp/fluid/cinn/CMakeLists.txt @@ -18,7 +18,7 @@ if(WITH_TESTING) "RUN_TYPE=CINN") set(CINN_RUN_ENVIRONMENT - "OMP_NUM_THREADS=1;runtime_include_dir=${CINN_INCLUDE_DIR}/paddle/cinn/runtime/cuda/" + "OMP_NUM_THREADS=1;runtime_include_dir=${CINN_INCLUDE_DIR}/paddle/cinn/runtime/cuda/" ) # cc_test_old( # cinn_launch_op_test From 2f82309d0c5067d5a625708f34db47f7b68175be Mon Sep 17 00:00:00 2001 From: Difers <707065510@qq.com> Date: Wed, 28 Jun 2023 13:48:26 +0000 Subject: [PATCH 2/4] remove a blank cmakelist --- paddle/cinn/hlir/kernels/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 paddle/cinn/hlir/kernels/CMakeLists.txt diff --git a/paddle/cinn/hlir/kernels/CMakeLists.txt b/paddle/cinn/hlir/kernels/CMakeLists.txt deleted file mode 100644 index 8b137891791fe..0000000000000 --- a/paddle/cinn/hlir/kernels/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - From 15684a56e8d4a7ffb74d624213ddc22208666999 Mon Sep 17 00:00:00 2001 From: SigureMo Date: Thu, 29 Jun 2023 09:19:38 +0800 Subject: [PATCH 3/4] restore deleted file --- paddle/cinn/hlir/kernels/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 paddle/cinn/hlir/kernels/CMakeLists.txt diff --git a/paddle/cinn/hlir/kernels/CMakeLists.txt b/paddle/cinn/hlir/kernels/CMakeLists.txt new file mode 100644 index 0000000000000..71923c33b146a --- /dev/null +++ b/paddle/cinn/hlir/kernels/CMakeLists.txt @@ -0,0 +1 @@ +# Empty file. From 96500494919d62569b2474b0e15ebc232ede5418 Mon Sep 17 00:00:00 2001 From: SigureMo Date: Thu, 29 Jun 2023 09:20:40 +0800 Subject: [PATCH 4/4] restore deleted file --- paddle/cinn/hlir/kernels/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/cinn/hlir/kernels/CMakeLists.txt b/paddle/cinn/hlir/kernels/CMakeLists.txt index 71923c33b146a..d87a972617884 100644 --- a/paddle/cinn/hlir/kernels/CMakeLists.txt +++ b/paddle/cinn/hlir/kernels/CMakeLists.txt @@ -1 +1 @@ -# Empty file. +# Empty file. Adding this line to avoid conflict between end-of-file-fixer and cmake-format.