Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
cff7d642
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
cff7d642
编写于
8月 01, 2023
作者:
6
6clc
提交者:
GitHub
8月 01, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CINN] fix run cinn-ut in paddle with cinn (#55530)
修复Paddle With CINN 执行 python单测下op_mapper 时报gflags符号undefined问题。
上级
9084a034
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
41 addition
and
23 deletion
+41
-23
CMakeLists.txt
CMakeLists.txt
+7
-0
cmake/cinn.cmake
cmake/cinn.cmake
+8
-0
python/setup_cinn.py.in
python/setup_cinn.py.in
+3
-0
test/cinn/CMakeLists.txt
test/cinn/CMakeLists.txt
+23
-23
未找到文件。
CMakeLists.txt
浏览文件 @
cff7d642
...
...
@@ -582,6 +582,13 @@ include(flags) # set paddle compile flags
if
(
WITH_CINN
)
message
(
STATUS
"Compile Paddle with CINN."
)
message
(
WARNING
"Enable WITH_SHARED_PHI when compiling with CINN. Force WITH_SHARED_PHI=ON."
)
set
(
WITH_SHARED_PHI
ON
CACHE BOOL
"Enable WITH_SHARED_PHI when compiling with CINN"
FORCE
)
# TODO(6clc): Use CINN_WITH_CUDNN to completely replace WITH_CUDNN in CINN.
# Use WITH_GPU to completely replace WITH_CUDA in CINN.
set
(
WITH_MKL_CBLAS
${
WITH_MKL
}
)
...
...
cmake/cinn.cmake
浏览文件 @
cff7d642
...
...
@@ -167,6 +167,10 @@ cinn_cc_library(
${
jitify_deps
}
)
add_dependencies
(
cinnapi GEN_LLVM_RUNTIME_IR_HEADER ZLIB::ZLIB
)
add_dependencies
(
cinnapi GEN_LLVM_RUNTIME_IR_HEADER
${
core_deps
}
)
if
(
NOT CINN_ONLY
)
target_link_libraries
(
cinnapi phi
)
add_dependencies
(
cinnapi phi
)
endif
()
target_link_libraries
(
cinnapi
${
PYTHON_LIBRARIES
}
)
...
...
@@ -216,6 +220,10 @@ function(gen_cinncore LINKTYPE)
ginac
)
add_dependencies
(
${
CINNCORE_TARGET
}
GEN_LLVM_RUNTIME_IR_HEADER ZLIB::ZLIB
)
add_dependencies
(
${
CINNCORE_TARGET
}
GEN_LLVM_RUNTIME_IR_HEADER
${
core_deps
}
)
if
(
NOT CINN_ONLY
)
target_link_libraries
(
${
CINNCORE_TARGET
}
phi
)
add_dependencies
(
${
CINNCORE_TARGET
}
phi
)
endif
()
add_dependencies
(
${
CINNCORE_TARGET
}
pybind
)
target_link_libraries
(
${
CINNCORE_TARGET
}
${
PYTHON_LIBRARIES
}
)
...
...
python/setup_cinn.py.in
浏览文件 @
cff7d642
...
...
@@ -139,6 +139,9 @@ if '${WITH_MKL}' == 'ON':
if '${WITH_MKLDNN}' == 'ON':
cinnlibs.append('${MKLDNN_SHARED_LIB}')
if '${CINN_ONLY}' == 'OFF':
cinnlibs.append('${PHI_LIB}')
if '${WITH_GPU}' == 'ON':
cinnlibs.append('${CMAKE_BINARY_DIR}/dist/cinn/include/paddle/cinn/runtime/cuda/cinn_cuda_runtime_source.cuh')
cinnlibs.append('${CMAKE_BINARY_DIR}/dist/cinn/include/paddle/cinn/runtime/cuda/float16.h')
...
...
test/cinn/CMakeLists.txt
浏览文件 @
cff7d642
...
...
@@ -25,14 +25,14 @@ foreach(basic_test_name ${BASIC_TEST_NAMES})
NAME
${
basic_test_name
}
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
basic_test_name
}
.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endforeach
()
if
(
NOT
${
WITH_GPU
}
)
# ADD_TEST(NAME test_op_nn
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/:$ENV{PYTHONPATH}
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/
cinn
:$ENV{PYTHONPATH}
# python3 ${CMAKE_CURRENT_SOURCE_DIR}/test_op_nn.py WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
# )
endif
()
...
...
@@ -40,7 +40,7 @@ endif()
if
(
WITH_CUDNN
)
# TODO(thisjiang): revert test_cinn_frontend after fix inference mul problem
# ADD_TEST(NAME test_cinn_frontend
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/:$ENV{PYTHONPATH}
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/
cinn
:$ENV{PYTHONPATH}
# python3 ${CMAKE_CURRENT_SOURCE_DIR}/test_frontend.py
# ${CMAKE_BINARY_DIR}/third_party/naive_mul_model
# ${CMAKE_BINARY_DIR}/third_party/multi_fc_model
...
...
@@ -50,20 +50,20 @@ if(WITH_CUDNN)
NAME test_netbuilder
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_netbuilder.py
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endif
()
#ADD_TEST(NAME test_computation_python
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/:$ENV{PYTHONPATH}
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/
cinn
:$ENV{PYTHONPATH}
# python3 ${CMAKE_CURRENT_SOURCE_DIR}/test_computation.py
# ${CMAKE_BINARY_DIR}/third_party/naive_mul_model
# "${WITH_GPU}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
#)
#ADD_TEST(NAME test_cinn_ops_check
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/:$ENV{PYTHONPATH}
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/
cinn
:$ENV{PYTHONPATH}
# python3 ${CMAKE_CURRENT_SOURCE_DIR}/test_ops.py "${WITH_GPU}"
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
#)
...
...
@@ -72,7 +72,7 @@ add_test(
NAME test_cinn_op_benchmark
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_op_benchmark.py
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -81,7 +81,7 @@ if(WITH_CUDNN)
NAME test_cinn_fake_resnet
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_resnet.py
"
${
CMAKE_BINARY_DIR
}
/third_party/resnet_model"
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -90,7 +90,7 @@ if(WITH_CUDNN)
NAME test_cinn_real_resnet18
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_resnet18.py
"
${
CMAKE_BINARY_DIR
}
/third_party/ResNet18"
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -99,7 +99,7 @@ if(WITH_CUDNN)
NAME test_cinn_real_mobilenetV2
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_mobilenetv2.py
"
${
CMAKE_BINARY_DIR
}
/third_party/MobileNetV2"
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -108,7 +108,7 @@ if(WITH_CUDNN)
NAME test_cinn_real_efficientnet
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_efficientnet.py
"
${
CMAKE_BINARY_DIR
}
/third_party/EfficientNet"
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -117,7 +117,7 @@ if(WITH_CUDNN)
NAME test_cinn_real_mobilenetV1
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_mobilenetv1.py
"
${
CMAKE_BINARY_DIR
}
/third_party/MobilenetV1"
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -126,7 +126,7 @@ if(WITH_CUDNN)
NAME test_cinn_real_resnet50
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_resnet50.py
"
${
CMAKE_BINARY_DIR
}
/third_party/ResNet50"
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -135,7 +135,7 @@ if(WITH_CUDNN)
NAME test_cinn_real_squeezenet
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_squeezenet.py
"
${
CMAKE_BINARY_DIR
}
/third_party/SqueezeNet"
"
${
WITH_GPU
}
"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -144,14 +144,14 @@ if(WITH_CUDNN)
NAME test_paddle_model_convertor
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/test_paddle_model_convertor.py --path
"
${
CMAKE_BINARY_DIR
}
/third_party/resnet_model"
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endif
()
#ADD_TEST(NAME test_cinn_real_facedet
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/:$ENV{PYTHONPATH}
# COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/python/
cinn
:$ENV{PYTHONPATH}
# python3 ${CMAKE_CURRENT_SOURCE_DIR}/test_facedet.py "${CMAKE_BINARY_DIR}/third_party/FaceDet" "${WITH_GPU}"
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
if
(
WITH_GPU
)
...
...
@@ -166,7 +166,7 @@ if(WITH_GPU)
NAME test_conv2d_op
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/ops/test_conv2d_op.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endif
()
...
...
@@ -181,7 +181,7 @@ if(WITH_GPU)
NAME
${
op_test_name
}
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
op_test_name
}
.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endforeach
()
...
...
@@ -198,7 +198,7 @@ if(WITH_GPU)
NAME test_mul_op_mapper
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/op_mappers/test_mul_op.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
@@ -206,7 +206,7 @@ if(WITH_GPU)
NAME test_conv2d_op_mapper
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/op_mappers/test_conv2d_op.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endif
()
...
...
@@ -221,7 +221,7 @@ if(WITH_GPU)
NAME
"
${
op_mapper_test_name
}
_mapper"
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
op_mapper_test_name
}
.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endforeach
()
...
...
@@ -242,7 +242,7 @@ if(WITH_GPU)
NAME
${
pass_test_name
}
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
pass_test_name
}
.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endforeach
()
...
...
@@ -262,7 +262,7 @@ if(WITH_GPU)
NAME
${
fusion_test_name
}
COMMAND
${
CMAKE_COMMAND
}
-E env
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/:$ENV{PYTHONPATH}
PYTHONPATH=
${
CMAKE_BINARY_DIR
}
:
${
CMAKE_BINARY_DIR
}
/python/
cinn
:$ENV{PYTHONPATH}
python3
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
fusion_test_name
}
.py
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endforeach
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录