Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

[CRC] add docstring for opcode executor #212

Merged
merged 6 commits into from
Jun 29, 2023

Conversation

zrr1999
Copy link
Member

@zrr1999 zrr1999 commented Jun 28, 2023

No description provided.

@paddle-bot
Copy link

paddle-bot bot commented Jun 28, 2023

Thanks for your contribution!

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Jun 28, 2023
@zrr1999 zrr1999 marked this pull request as ready for review June 28, 2023 07:04
@@ -205,9 +283,18 @@ def inner(self: OpcodeExecutorBase, instr: Instruction):


def jump_break_graph_decorator(normal_jump):
"""breakoff graph when meet jump."""
"""
A decorator function that breaks off the graph when a jump instruction is encountered.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
A decorator function that breaks off the graph when a jump instruction is encountered.
A decorator function that breaks off the graph when a JUMP-related instruction is encountered.

def decorate(call_fn):
def call_break_graph_decorator(push_n: int):
"""
A decorator function that breaks off the graph when a function call instruction is encountered.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
A decorator function that breaks off the graph when a function call instruction is encountered.
A decorator function that breaks off the graph when a function CALL instruction is encountered.


The OpcodeExecutorBase class provides methods and functionality to execute opcode instructions.

If you want to learn more about Python instructions, you can visit https://docs.python.org/3/library/dis.html
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
If you want to learn more about Python instructions, you can visit https://docs.python.org/3/library/dis.html
If you want to learn more about Python instructions, see https://docs.python.org/3/library/dis.html for details.

raise NotImplementedError()

def transform(self):
"""
Transforms the executor.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Transforms the executor.
Abstract method need to be implemented to symbolic translate each instruction.

self, origin_stack: list[VariableBase], instr: Instruction, push_n: int
):
"""
Break the graph at a call instruction.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Break the graph at a call instruction.
Break the graph at a CALL instruction.

def _break_graph_in_jump(self, result, instr):
def _break_graph_in_jump(self, result: VariableBase, instr: Instruction):
"""
Break the graph at a jump instruction.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Break the graph at a jump instruction.
Break the graph at a JUMP instruction.

def _break_graph_in_jump(self, result, instr):
def _break_graph_in_jump(self, result, instr: Instruction):
"""
Breaks the graph in jump instructions.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Breaks the graph in jump instructions.
Breaks the graph in JUMP instructions.

Copy link
Member Author

Choose a reason for hiding this comment

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

好的,已全部修改

@zrr1999 zrr1999 requested a review from SigureMo June 29, 2023 05:27
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.

LGTM~

@SigureMo SigureMo requested a review from Aurelius84 June 29, 2023 05:29
@SigureMo SigureMo merged commit a3f91d9 into PaddlePaddle:develop Jun 29, 2023
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jul 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR status: proposed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants