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
Operator Mechanism
PR Types
Deprecations
Description
Pcard-67164
What's New?
退场了动态图和新IR下Flatten算子中的XShape字段,实现动静统一,具体改动:
1. 旧静态图下为flatten_contiguous_range
目前flatten的前反向算子已经在ops/bacward.yaml中,即已为理想态。但旧的静态图下是flatten_contiguous_range,通过flatten(flatten_contiguous_range)这种别名的形式映射的。当把XShape退场之后,需要在static_ops/backward.yaml 新增flatten_contiguous_range前反向算子的yaml定义。
2. 旧静态图下需添加exclude过滤名单
需要在legacy目录下对flatten的前反向算子添加旧静态图算子的过滤机制,以flatten_contiguous_range为名单过滤是无效的。
3. 修改flatten spmd 中对reshapeinferspmd的调用
需要将ReshapeInferSpmdDynamic替换为ReshapeInferSpmd,因为前者是面向XShape的切分推导规则,相关的单测清理XShape相关的Assert逻辑。
4. 隔离旧静态图下的yaml定义
由于动静统一的flatten使用的是ops/backward.yaml,为了确保不影响旧静态图算子定义,需要在static_ops.yaml中单独定义带XShape的旧 flatten 算子定义。
5. 添加了GradWithXGradOpTranscriper
类似Reshape/Flatten/Squeeze/Unsqueeze 算子反向之前依赖的是XShape,现在是X,因此需要添加转换逻辑。
为什么不需要写前向算子的转换逻辑?
答:因为在ProgramTranslator中,是以yaml定义中的output字段为基准,转换得到output_types,自然而然不会包含xshape(如下图)
6. 修改transpose_flatten_concat_fuse_pass
需要修改Fuse中DRR Pattern 规则定义,移除xshape的匹配。
7. 修改XPU上的flatten_grad的注册管理
从日志来看,在XPU硬件上flatten_grad没有找到fp16支持的kernel,导致fallback到了CPU,但CPU上是不支持FP16的。问题点在于此处XPU上不应该找不到flatten_grad kernel,怀疑应该xpu_list 的dtype映射有关系。
