未验证 提交 596d8209 编写于 作者: H HongyuJia 提交者: GitHub

[OptLayoutSelect] Select the highest priority layout (#46598)

* select highest priority layout

* opt performance, save virtual table find
上级 4140d7ec
......@@ -100,7 +100,9 @@ struct KernelKeyParser : ArgsIterator<KernelKeyParser> {
key_set.backend_set =
key_set.backend_set | detail::GetTensorBackendSet(tensor);
// TODO(chenweihang): select multi layout and dtype
key_set.layout = tensor.layout();
phi::DataLayout tensor_layout = tensor.layout();
key_set.layout =
tensor_layout > key_set.layout ? tensor_layout : key_set.layout;
key_set.dtype = tensor.dtype();
dtype_set = dtype_set | DataTypeSet(key_set.dtype);
auto promote_result = PromoteTypes(dtype_set);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册