[Phi] Refactor logic of judging whether having a phi kernrel #46920
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Others
PR changes
Others
Describe
优化静态图下判断Phi算子库是否有对应算子Kernel的相关逻辑(
HasCompatiblePhiKernel
函数)。优化前的判断逻辑需要保证一个算子的多个不同名kernel中至少有一个需要与op名相同(如
split
算子对应的两个kernel:split
和split_with_num
),但Sparse类算子目前无法做到kernel名与算子名相同,为了支持Sparse类算子Kernel的选择,本PR中修改了对于Phi下是否存在对应的Kernel的判断逻辑,改为直接从base_kernel_name_map_
和arg_mapping_fn_map
中进行判断,从而可以免除上述的限制条件。