Skip to content

Fix TransformLocalIndicesToIters corner case.#73929

Merged
zyfncg merged 1 commit intoPaddlePaddle:developfrom
YuhanXu:YuhanXu/fix_TransformLocalIndicesToIters_cornercase
Jul 17, 2025
Merged

Fix TransformLocalIndicesToIters corner case.#73929
zyfncg merged 1 commit intoPaddlePaddle:developfrom
YuhanXu:YuhanXu/fix_TransformLocalIndicesToIters_cornercase

Conversation

@YuhanXu
Copy link
Contributor

@YuhanXu YuhanXu commented Jul 9, 2025

PR Category

CINN

PR Types

Bug fixes

Description

修复BUG1:CINN TransformLocalIndicesToIters Pass修改
TransformLocalIndicesToIters支持的普遍场景如下:

  for i:
    for j:
      for k:
        Local_var[IndiceFunc0(i,j)][IndiceFunc1(k)]  # 可被化简为 Local_var[i][j][k]

当IndiceFunc是[Add Sub Mul Div Mod]的组合, Local_var可以被化简为Local_var[i][j][k]

具体的例子:

  for i:
    for j: 
      for k:
         Local_var[i + 1024][j][k]  # 可被化简为 Local_var[i][j][k]

但是存在Corner Case

  for i in [0,16):
    for j:
      for k:
        Local_var[(i + 1024)/2048]  # 错误:被化简为Local_var[i],正确:被化简为Local_var[0]

Local_var[(i + 1024)/2048],i取值范围[0,16),
那么Local_var[(i + 1024)/2048]应该被化简为Local_var[0],而不是Local_var[i]。
化简成Local_var[i]会生成越界的访问。

修复BUG2:CINN LoopTransformation Pass修改
Slip轴生成新temp_var的时候没有配置新Var的upper_bound和lower_bound

Pcard-90680

@paddle-bot
Copy link

paddle-bot bot commented Jul 9, 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.

@CLAassistant
Copy link

CLAassistant commented Jul 9, 2025

CLA assistant check
All committers have signed the CLA.

@YuhanXu YuhanXu force-pushed the YuhanXu/fix_TransformLocalIndicesToIters_cornercase branch 10 times, most recently from 16798f8 to e0fd7ee Compare July 16, 2025 12:03
@YuhanXu YuhanXu force-pushed the YuhanXu/fix_TransformLocalIndicesToIters_cornercase branch from e0fd7ee to 27548a2 Compare July 16, 2025 12:34
@YuhanXu YuhanXu force-pushed the YuhanXu/fix_TransformLocalIndicesToIters_cornercase branch from 27548a2 to 8038daf Compare July 16, 2025 12:58
@zyfncg zyfncg merged commit 005ac54 into PaddlePaddle:develop Jul 17, 2025
64 of 66 checks passed
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