-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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][dynamic shape] add symbolic fallback when SymbolicVariable's handler not exists. #67786
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
当进入动态shape之后,每次缓存都会命中,也就不会进行模拟执行,也就不会再加计数了。 |
Dispatcher.register( | ||
operator.truth, | ||
("ConstantVariable | SymbolicVariable",), | ||
("ConstantVariable",), | ||
lambda var: var.bool(), | ||
) |
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.
这里可以将 VariableBase
的 operator.truth
都转发到 bool 上嘛?会有什么问题吗?
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.
是这样
Dispatcher.register(
operator.truth,
("VariableBase",),
lambda var: Dispatcher.call(bool, var)
)
重新走 bool 这个方法的 dispatch,而不是 VariableBase 的 bool
这样这个文件里 operator.truth
只需要出现一次了,其他的都可以删掉了
@@ -953,6 +954,18 @@ def is_not_func(var: VariableBase, other: VariableBase): | |||
("TensorVariable",), | |||
raise_break_graph_fn, | |||
) | |||
Dispatcher.register( | |||
unary_fn, | |||
("SymbolicVariable",), |
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.
这里如果不给 SymbolicVariable
dispatch,直接走 fallback 到静态的逻辑会有问题吗?
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.
另外这个 PR 是不是没有设置 None
的操作?好像没有看到,是不是应该在 SymbolicVariable.get_py_value
时设置?
另外可以测一下中间变量的输入是否可以按照预期 fallback 到静态~
是的,这个PR主药只改了dispatch部分 |
TODO:
|
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.
PR Category
Execute Infrastructure
PR Types
Performance
Description
完善函数调用在参数包含 SymbolicVariable 时的 dispatch 机制,找不到 SymbolicVariable 对应的handler时,fallback到ConstantVariable 的。