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

切分推导规则的输入参数,不支持空list #58297

Closed
WintersMontagne10335 opened this issue Oct 21, 2023 · 2 comments
Closed

切分推导规则的输入参数,不支持空list #58297

WintersMontagne10335 opened this issue Oct 21, 2023 · 2 comments
Assignees
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭 type/bug-report 报bug

Comments

@WintersMontagne10335
Copy link
Contributor

bug描述 Describe the Bug

  1. 把下面的txt文件,后缀名改为.py,并替换PR中的同名文件
    test_squeeze_rule.txt
  2. cmake时开启WITH_GPUWITH_TESTINGWITH_DISTRIBUTE,如
    cmake .. -DPY_VERSION=3.8 -DWITH_GPU=ON -DWITH_TESTING=ON -DWITH_DISTRIBUTE=ON
  3. make -j8
  4. ctest -R test_squeeze_rule -V,然后会提示出现段错误
  • 原因分析
    缺少obj为空时的处理逻辑。obj没有判空,直接获取first_item,导致越界。
    我自己测试的时候,补充了一个元素类型为int的空list处理逻辑,test_squeeze_rule 通过。但是元素类型可能是bool等其它类型,不能无脑用int。需要老师们看一下如何修复。

其他补充信息 Additional Supplementary Information

No response

@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Oct 21, 2023
@Ligoml Ligoml assigned pkuzyc and unassigned sijunhe Oct 24, 2023
@paddle-bot paddle-bot bot added status/following-up 跟进中 status/discussing 需求调研中 and removed status/new-issue 新建 status/following-up 跟进中 labels Oct 24, 2023
@JZ-LIANG
Copy link
Contributor

JZ-LIANG commented Oct 27, 2023

这里的确是一个设计问题,你的分析很详细清晰。 现在建议分两步方案解决这个问题:

短期方案(@WintersMontagne10335 ): 在 squeeze 规则 python 端逻辑中,判断用户输入是否为空list,若输入为空,根据文档中空list 输入的含义, 帮用户构造一个"包含所有尺寸为 1 的维度"的 list 输入, 在切分推导规则的Python端避免 空list 输入, 让 PR 先合入。

长期方案(@pkuzyc ): 尝试用 Paddle::Any / std::Any 解决 python 空list 到 C++ Vector 的转换, 该方案可能涉到在InferSpmdFnCallHelper 模板 中和实际vector 类型的强制转换。

@WintersMontagne10335
Copy link
Contributor Author

@JZ-LIANG 老师您好,现在50、52题都涉及这个问题。短期方案虽然能merge,但是可能会带来潜在的问题,对 paddle 造成不良影响。这段时间,我先完善代码最开始的逻辑吧,以求长期方案改动完毕后能直接merge。黑客松12月15日结束,时间还是很充裕的。在那之前能改完就行,我不是很急。

@paddle-bot paddle-bot bot added status/close 已关闭 and removed status/discussing 需求调研中 labels Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭 type/bug-report 报bug
Projects
None yet
Development

No branches or pull requests

5 participants
@sijunhe @pkuzyc @JZ-LIANG @WintersMontagne10335 and others