Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][CINN] fix cinn codestyle cmake-format #54967

Merged
merged 4 commits into from
Jun 29, 2023
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
7 changes: 5 additions & 2 deletions cmake/cinn/core.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 3 additions & 2 deletions paddle/cinn/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if (WITH_TESTING)
if(WITH_TESTING)
cinn_cc_library(cinn_gtest_main SRCS gtest_main.cc DEPS gtest gflags)
endif()

Expand All @@ -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()
7 changes: 5 additions & 2 deletions paddle/cinn/auto_schedule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
6 changes: 4 additions & 2 deletions paddle/cinn/auto_schedule/cost_model/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 2 additions & 1 deletion paddle/cinn/auto_schedule/database/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 2 additions & 1 deletion paddle/cinn/auto_schedule/measure/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 10 additions & 5 deletions paddle/cinn/auto_schedule/post_schedule_rule/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
8 changes: 2 additions & 6 deletions paddle/cinn/auto_schedule/search_space/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
57 changes: 43 additions & 14 deletions paddle/cinn/auto_schedule/search_space/auto_gen_rule/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 2 additions & 1 deletion paddle/cinn/auto_schedule/search_strategy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 1 addition & 5 deletions paddle/cinn/auto_schedule/task/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 2 additions & 1 deletion paddle/cinn/auto_schedule/task_scheduler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 10 additions & 4 deletions paddle/cinn/auto_schedule/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
80 changes: 50 additions & 30 deletions paddle/cinn/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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()
Loading