Skip to content
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

[CINN] Implement the new AlignIterSpaceTactic #70649

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

lshpku
Copy link
Contributor

@lshpku lshpku commented Jan 6, 2025

PR Category

CINN

PR Types

Improvements

Description

把TileFirstGeneralTactic中的AlignToReduceInput功能提取成为一个独立的Tactic,借用了原来AlignIterSpaceTactic的壳子,目的是把TileFirstGeneralTactic里面与Tile无关的内容分离出来,为之后实现Transpose调度做准备。

另外,这个PR中的GetCommonOutputLoopPerm也可以解决近期Recompute导致的一些Transpose性能回退的情况,在当前还没有能力调度Transpose的情况下,将Transpose向输出对齐至少比不对齐好。

Pcard-85711

Copy link

paddle-bot bot commented Jan 6, 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.

zyfncg
zyfncg previously approved these changes Jan 7, 2025
Comment on lines +37 to 40
tactics_.emplace_back(CreateAlignIterSpaceTactic());
tactics_.emplace_back(CreateTileBroadcastTactic());
tactics_.emplace_back(CreateTileFirstGeneralTactic());
tactics_.emplace_back(CreateComputeInlineTactic());
Copy link
Contributor

Choose a reason for hiding this comment

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

tactic的数量越来越多了,这里可能需要制定一些相对明确的原则和规范,避免tactic之间功能划分不清晰导致的处理问题

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tactic应该差不多了,就是分成3部分:

  1. 第一部分是align,把loop顺序调整到和内存顺序一致,因为我们融合不太注意内存顺序,需要后端自己调整顺序
  2. 第二部分是tiling,就是维度切分和绑定,这个部分只会match一个tactic,估计未来一段时间内只需要3个(Broadcast、Transpose、General)
  3. 第三部分是compute inline和compute at,属于计算位置和计算顺序的优化

其实tactic的数量多一点也无妨,tvm也有10个左右的tactic

Comment on lines 56 to 57
std::vector<int> sp_loop_perm;
std::vector<int> rd_loop_perm;
Copy link
Contributor

Choose a reason for hiding this comment

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

class成员变量名加下划线后缀

这两个变量的含义有点抽象,可以再加些示例说明吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改,已在前面写了两个example

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