Skip to content

[CINN] Adapt to sub_iter_space in TileTransposeTactic #71976

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

Merged
merged 1 commit into from
Apr 2, 2025

Conversation

lshpku
Copy link
Contributor

@lshpku lshpku commented Mar 28, 2025

PR Category

CINN

PR Types

Improvements

Description

在 TileTransposeTactic 引入 副迭代空间(Sub Iter Space)的概念,替换掉原来的Common Permutation,本质上从关注具体的一个个transpose变为整体关注迭代空间的连续性,从而提高Tactic的通用性,并实现对Reshape和Slice的有限支持

图片 1

如图,我们将for循环的顺序设为主迭代空间,与for循环顺序不同的则为副迭代空间,则:

  • 对主迭代空间的读写均按自然顺序即可
  • 对副迭代空间的读需要使用CacheRead,对副迭代空间的写需要使用CacheWrite(待实现)

性能测试

模型 原ips/cost 新ips/cost 加速比
训练: PaddleSeg_segformer_b0_bs4_fp16 28.0 30.3 8.2%
推理: SegFormer-B0 fp32 6.68 6.40 4.4%

Pcard-85711

Copy link

paddle-bot bot commented Mar 28, 2025

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

@lshpku lshpku force-pushed the transpose-sub-iter-space branch from bf0ae2d to 02ffdee Compare March 31, 2025 12:56
@lshpku lshpku changed the title [CINN] TileTransposeTactic turns to use the sub_iter_space concept [CINN] Adapt to sub_iter_space in TileTransposeTactic Mar 31, 2025
Comment on lines +434 to +435
IterSpaceGetter iter_space_getter(load.As<ir::Load>(), loops);
std::vector<int> iter_space = iter_space_getter();
Copy link
Contributor

Choose a reason for hiding this comment

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

对于超过1个副迭代空间的情况,前面融合的时候已经拆开了吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

融合没法保证,所以我下面做了判断,如果有多于1个sub_iter_space,就不match这个tactic

@lshpku lshpku merged commit be3d908 into PaddlePaddle:develop Apr 2, 2025
35 checks passed
YqGe585 pushed a commit to YqGe585/Paddle that referenced this pull request May 7, 2025
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.

2 participants