You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
你的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.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Execute Infrastructure
PR Types
Devs
Description
pcard-67164
背景
pd_op.reshape(等系列算子)有xshape这一输出,记录输入 x 的 meta 信息用于反向输入。
xshape 在 cinn_op.reshpe 没有对应输出,导致千级别子图前反向切图后报错。直接去掉 xshape 无法满足 inplace 场景,原始 x 的 meta 信息会丢失。在 cinn_op 中添加 xshape 输出会引发其他问题且不够优雅。
解决方案核心思路:干掉 xshape,但保留 meta 信息
修改方案
在 build scope 时仅保留需要进行 inplace 的算子和输入输出对信息,传给instruction;在 run instruction 时为对应的 DenseTensor holder 做ShareBuffer操作。只 share tensor holder,不对meta做处理。
细节问题及对应处理:


a. TensorArray类型适配:新 inplace 方案带来的问题:对于需要做 inplace 的 TensorArray (实际上存了 vector),share 时无法将新增的 vector 成员信息由 output 同步给 input。解决方法是与原来PIR方案对齐,对于 TensorArray 仍然进行 var* 层面的 share。
b. assign_value_适配
与问题a类似,assign_value_的输出作为 densetensor 但重新 alloc 了内存,导致输入无法感知。目前也是先进行 var* 层面的 share
c. 对 instruction 分析 order 时,inputs 和 outputs 的 index 与 var 绑定,所以原来的执行顺序分析中不会出现问题。但对于改造后的 inplace ,后续 op 无法感知到 increment_ 对 2 的改动。
解决方法:在instruction分析输入输出的时候将inplace算子的输入加入输出列表。