-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[SOT][Exception][3.10-][3.13] Add exception handler for Py3.10- #72559
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
base: develop
Are you sure you want to change the base?
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
当前会挂的原因,Python3.8 没有 import dis
def try_except_exception_with_error(x):
# test `JUMP_IF_NOT_EXC_MATCH`
try:
raise ValueError("TESTING!")
except Exception:
pass
return x
dis.dis(try_except_exception_with_error) Py3.8 的行为: 8 >> 14 DUP_TOP
16 LOAD_GLOBAL 1 (Exception)
18 COMPARE_OP 10 (exception match)
20 POP_JUMP_IF_FALSE 32
22 POP_TOP
24 POP_TOP
26 POP_TOP Py3.9/Py3.10 的行为: 8 >> 10 DUP_TOP
12 LOAD_GLOBAL 1 (Exception)
14 JUMP_IF_NOT_EXC_MATCH ...
16 POP_TOP
18 POP_TOP
20 POP_TOP 需要对 ExceptionVariable 实现 COMPARE_OP 部分 |
|
目前 File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/callable.py", line 280, in call_function
output = inline_executor.inline_call()
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py", line 99, in inline_call
self.run()
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 631, in run
is_stop = self.step(cur_instr)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 677, in step
return getattr(self, opname)(instr) # run single step.
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 315, in wrapper
return call_fn(self, instr)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 933, in LOAD_ATTR
BuiltinVariable(
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/callable.py", line 141, in __call__
return self.call_function(*args, **kwargs)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/callable.py", line 873, in call_function
return handler(*args, **kwargs)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variable_dispatch.py", line 590, in <lambda>
lambda var, name, default=None: var.getattr(
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/basic.py", line 1514, in getattr
raise HasNoAttributeError(
paddle.jit.sot.utils.exceptions.HasNoAttributeError: ObjectVariable SuperVariable(super(PolynomialDecay, ObjectVariable(<paddle.optimizer.lr.PolynomialDecay object at 0x7fe7c1e4c910>, object_717)), object_831) has no attribute last_epoch 定位到是 SuperVariable |
|
PR Category
Execute Infrastructure
PR Types
New features
Description
支持
Python3.10-
的SOT异常处理部分SETUP_FINALLY
、POP_BLOCK
、LOAD_ASSERTION_ERROR
、POP_EXCEPT
、RAISE_VARARGS
、JUMP_IF_NOT_EXC_MATCH
和RERAISE
的实现OpcodeExecutorBase.handle_exception
ExceptionVariable.__eq__
的 dispatch 机制 +operator_exception_match
的 dispatch 机制NOTE:
PCard-66972