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

[SOT][Faster Guard] add StringCompareGuard and support RangeVariable #70362

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Dec 20, 2024

PR Category

Execute Infrastructure

PR Types

Performance

Description

  • 添加StringCompareGuard
  • 支持RangeVariable

TODO

  • StringCompareGuard 有点问题,[Guard]: lambda frame: StringCheckGuard_6171297008(frame.f_locals['fn'].__code__) and ValueMatchGuard_6171297200(frame.f_locals['x'])

相关链接

Copy link

paddle-bot bot commented Dec 20, 2024

你的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.

@paddle-bot paddle-bot bot added the contributor External developers label Dec 20, 2024
@gouzil gouzil requested a review from Copilot December 20, 2024 03:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.

Files not reviewed (3)
  • paddle/fluid/pybind/jit.cc: Language not supported
  • paddle/fluid/pybind/sot/guards.cc: Language not supported
  • paddle/fluid/pybind/sot/guards.h: Language not supported
Comments suppressed due to low confidence (1)

python/paddle/jit/sot/opcode_translator/executor/guard.py:208

  • The StringCheckGuard should be initialized with the correct value. Ensure that obj_free_var_name is the intended parameter.
paddle.framework.core.StringCheckGuard(obj_free_var_name),

StringifiedExpression(
"isinstance({0}, range) and "
FasterStringifiedExpression(
"id(type({0})) == id(range) and "
Copy link
Preview

Copilot AI Dec 20, 2024

Choose a reason for hiding this comment

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

The attribute 'init_value' is used but not defined in the 'RangeVariable' class. This will lead to an AttributeError. Define 'init_value' in the class or use an existing attribute.

Suggested change
"id(type({0})) == id(range) and "
+ f"{{0}}.start == {self.some_existing_attribute.start} and "

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Member

Choose a reason for hiding this comment

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

The attribute 'init_value' is used but not defined in the 'RangeVariable' class. This will lead to an AttributeError. Define 'init_value' in the class or use an existing attribute.

差评

Comment on lines 131 to 134
std::string expected_str = PyUnicode_AsUTF8(expected_);
std::cout << "[StringCheckGuard]" << expected_str << std::endl;
std::string str = PyUnicode_AsUTF8(value);
std::cout << "[StringCheckGuard]" << str << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

这个expected_是不是可以直接在初始化的时候就变成string

StringifiedExpression(
"isinstance({0}, range) and "
FasterStringifiedExpression(
"id(type({0})) == id(range) and "
Copy link
Member

Choose a reason for hiding this comment

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

The attribute 'init_value' is used but not defined in the 'RangeVariable' class. This will lead to an AttributeError. Define 'init_value' in the class or use an existing attribute.

差评

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants