-
Notifications
You must be signed in to change notification settings - Fork 26
[Feature] add breakpoint machanism on SOT #240
Conversation
Thanks for your contribution! |
f"[Translate {self._name}]: (line {self._current_line:>3}) {instr.opname:<12} {instr.argval}, stack is {self._stack}\n", | ||
) | ||
log_message = f"[Translate {self._name}]: (line {self._current_line:>3}) {instr.opname:<12} {instr.argval}, stack is {self._stack}\n" | ||
log(3, log_message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里无条件打印和下面的打印是不是重复了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log3下会重复的,但是这个BM不一定在log3下使用。所以就默认都打印了一行。
sot/opcode_translator/breakpoint.py
Outdated
|
||
def rm(self, *args, **kwargs): | ||
# interactive use, we use abbreviate | ||
self.breakpoints() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.breakpoints
不是 set 吗?这里直接 call 不会报错嘛?
我们先借助此功能看是否可以提高模型问题的排查效率,我理解这应该是最终的调试形态,我们看如何在实践中不断优化调试机制。 |
这个PR主要是针对 『模拟』问题,很方便的定位和了解模拟OpExecutor的执行逻辑。但是对于 Python fallback代码和生成的代码,runtime error帮助还是有限的。 |
动机
在 debug 的时候,如果发现模拟有问题,总是希望停在某个字节码出,并深入SOT内部查看逻辑,这类行为促使我们添加一个 breakpoint 机制。
Usage
这里的行号是 58。这样就会在这一行的字节码处 breakpoint 停住,后续就可以进行交互了。