未验证 提交 865b6548 编写于 作者: D Difer 提交者: GitHub

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

* fix cinn codestyle cmake-format

* remove a blank cmakelist

* restore deleted file

* restore deleted file

---------
Co-authored-by: NSigureMo <sigure.qaq@gmail.com>
上级 24b2cc8d
......@@ -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}
......
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()
......@@ -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()
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,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)
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)
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()
......@@ -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)
......
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)
......
......@@ -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)
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)
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)
......
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)
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()
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()
......@@ -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()
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)
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()
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)
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()
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})
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})
......@@ -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()
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()
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()
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)
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)
# Empty file. Adding this line to avoid conflict between end-of-file-fixer and cmake-format.
......@@ -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()
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)
......
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)
......@@ -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()
......@@ -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()
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)
......
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)
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)
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 "")
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)
......
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()
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)
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)
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)
......
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})
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册