Skip to content

[SOT][3.13] add LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST and add skip tests files #69196

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

Merged
merged 4 commits into from
Nov 7, 2024

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Nov 6, 2024

PR Category

Execute Infrastructure

PR Types

Performance

Description

  • 支持LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST 三个字节码
  • 添加 skip_files_py313 跳过部分测试

Copy link

paddle-bot bot commented Nov 6, 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 Nov 6, 2024
self.fused_load_store(instr)

def STORE_FAST_LOAD_FAST(self, instr: Instruction):
self.fused_load_store(instr)
Copy link
Member

Choose a reason for hiding this comment

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

直接在预处理字节码的时候拆一下吧

def expand_super_instrs(instructions: list[Instruction]) -> list[Instruction]:
    expanded_instrs = []

    def replace_jump_target(instrs, old_target, new_target):
        for instr in instrs:
            if instr.jump_to == old_target:
                instr.jump_to = new_target

    for instr in instructions:
        if instr.opname == "LOAD_FAST_LOAD_FAST":
            instr1 = Instruction(
                opcode=dis.opmap["LOAD_FAST"],
                opname="LOAD_FAST",
                arg=instr.arg >> 4,
                argval=instr.argval[0],
                offset=instr.offset,
                starts_line=instr.starts_line,
                is_jump_target=instr.is_jump_target,
                jump_to=instr.jump_to,
                is_generated=True,
            )
            instr2 = Instruction(
                opcode=dis.opmap["LOAD_FAST"],
                opname="LOAD_FAST",
                arg=instr.arg & 15,
                argval=instr.argval[1],
                offset=instr.offset,
                starts_line=instr.starts_line,
                is_jump_target=instr.is_jump_target,
                jump_to=instr.jump_to,
                is_generated=True,
            )
            replace_jump_target(instructions, instr, instr1)
            expanded_instrs.append(instr1)
            expanded_instrs.append(instr2)
        else:
            expanded_instrs.append(instr)
    return expanded_instrs

@SigureMo SigureMo changed the title [SOT] add LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST and add skip tests files [SOT][3.13][Typing] add LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST and add skip tests files Nov 6, 2024
@@ -91,6 +91,98 @@ def convert_instruction(instr: dis.Instruction) -> Instruction:
)


def expand_super_instrs(instructions: list[Instruction]) -> list[Instruction]:
Copy link
Member

Choose a reason for hiding this comment

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

⚠️该代码疑似用 AI 技术直接生成,请修改润色

if instr.jump_to == old_target:
instr.jump_to = new_target

def _gen_instr(instr, opname, argval, arg):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def _gen_instr(instr, opname, argval, arg):
def copy_instruction(instr, opname, argval, arg):

Comment on lines 114 to 123
if instr.opname == "LOAD_FAST_LOAD_FAST":
instr1 = _gen_instr(
instr, "LOAD_FAST", instr.argval[0], instr.arg >> 4
)
instr2 = _gen_instr(
instr, "LOAD_FAST", instr.argval[1], instr.arg & 15
)
replace_jump_target(instructions, instr, instr1)
expanded_instrs.append(instr1)
expanded_instrs.append(instr2)
Copy link
Member

Choose a reason for hiding this comment

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

这块不用写三次吧?写一个 map 就可以了

arg=arg,
argval=argval,
is_jump_target=instr.is_jump_target,
is_generated=True,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
is_generated=True,
is_generated=False,

False 吧?

opname=opname,
arg=arg,
argval=argval,
is_jump_target=instr.is_jump_target,
Copy link
Member

Choose a reason for hiding this comment

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

第一个是 instr.is_jump_target,第二个是 False,不能直接 copy

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@gouzil gouzil changed the title [SOT][3.13][Typing] add LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST and add skip tests files [SOT][3.13]add LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST and add skip tests files Nov 7, 2024
@gouzil gouzil merged commit 7edf283 into PaddlePaddle:develop Nov 7, 2024
28 checks passed
@gouzil gouzil changed the title [SOT][3.13]add LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST and add skip tests files [SOT][3.13] add LOAD_FAST_LOAD_FASTSTORE_FAST_STORE_FASTSTORE_FAST_LOAD_FAST and add skip tests files Nov 7, 2024
@gouzil gouzil deleted the sot/add_skip_files_py313 branch November 22, 2024 15:03
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