Skip to content

Conversation

@YuanRisheng
Copy link
Contributor

@YuanRisheng YuanRisheng commented Dec 15, 2023

PR types

Others

PR changes

Others

Description

Pcard-67164
背景:
cmake代码治理不够彻底,依然存在大量的动静态库混链的问题,在单测模块尤为严重。在这样的条件下,尤其是windows环境下,跨模块使用静态变量的时候存在各种符号链接问题,同时也存在运行时问题。
本PR针对cmake做了一些优化工作:
1,在pir编译静态库的场景下,将符号全部打入paddle.so中,减少动静态库混链产生的全局单例失效问题。
2,优化windows下模块的符号暴露,pir模块内统一规范使用IR_API来暴露,pir模块外统一使用TEST_API来暴露,减少动静态库混链产生的符号未定义以及重定义问题。
3,暴露多处PIR模块隐藏的C++代码语法问题,解决windows下vs系列编译器无法识别 / 处理 PIR模块的一些语言特性及代码写法漏洞
4,phi算子库模块头文件引用优化,解耦Fluid头文件
5,优化单测模块依赖,减少动静态库混链写法

@paddle-bot
Copy link

paddle-bot bot commented Dec 15, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@risemeup1 risemeup1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,great job

set(PYBIND_DEPS ${PYBIND_DEPS} pir)
endif()

if(WITH_CUSTOM_DEVICE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windows pir是静态库,有没有统计下,windows,libpaddle.dll增大多少,whl包增大有多少。可能因为whl包体积会影响发版本。最好是把pir打通windows场景下编译动态库方式

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

预计会增加20M,最优解法是将pir变成动态库,但当前pir变成动态库难度及遇到的困难都未知,当前windows的cmake治理已经成为项目正常推进中的阻塞点,为了能够尽快推进项目顺利开发,减少开发过程中遇到的windows编译链接问题,这里采用次优解法将pir打入paddle.dll中。后续需要专项解决pir变成动态库的工作

op_dialect_vjp
pir
gtest)
paddle_test(shape_op_test SRCS shape_op_test.cc DEPS gtest)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个gtest应该也是不需要的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,后续会在这个pr修改:#59790

Copy link
Contributor

@winter-wang winter-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,very great work!

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@YuanRisheng YuanRisheng merged commit ebfabcc into PaddlePaddle:develop Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants