Skip to content

Conversation

@chen2016013
Copy link
Contributor

@chen2016013 chen2016013 commented Apr 16, 2024

PR Category

Others

PR Types

Others

Description

Pcard-67164

背景:

shape_analysis组件目前在shape_optimization_pass.cc中被隐式关联,且这个文件被显式地打入op_dialect里编译,在pir_transforms target也会编译。前者会被cinnapi.so依赖(以静态库形式),cinnapi.so又会被libpaddle.so依赖,导致libpaddle.so有两条路径会依赖shape_optimization_pass的符号:
①libpaddle.so -> ... -> libpir_transforms.a -> shape_optimization_pass
②libpaddle.so -> cinnapi.so ->op_dialect.a -> shape_optimization_pass;

这里会有全局静态变量重复初始化的问题,导致Pass被重复注册(目前会ENFORCE不允许重复注册)。后续迭代CINN很容易遇到编译问题。

解决方案:

将shape_optimization_pass组件放到paddle/pir/src/dialect/shape目录下,这样就可以放到libpir.so里编译
shape_optimization_pass调用了paddle::dialect::InferSymbolicShapeInterface类,将该interface也迁移到pir命名空间下,同时保留在paddle::dialect中的别名

@paddle-bot
Copy link

paddle-bot bot commented Apr 16, 2024

你的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.

@chen2016013 chen2016013 changed the title update Lowing shape_optimization_pass to paddle/pir/ menu Apr 16, 2024
@chen2016013 chen2016013 changed the title Lowing shape_optimization_pass to paddle/pir/ menu Lowing shape_optimization_pass to paddle/pir/ directory Apr 17, 2024
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.

Great job

@chen2016013 chen2016013 merged commit b631ac7 into PaddlePaddle:develop Apr 18, 2024
@chen2016013 chen2016013 deleted the shape_dialect branch May 24, 2024 07:56
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.

4 participants