[PHI] Optimize Gather kernel with vectorization #72238
Closed
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 Category
Performance Optimization
PR Types
Performance
Description
使用向量化优化GatherGPUKernel的性能,并将原有的2种Gather实现合并为一个
注:原来的2种实现分别处理高维和低维,我发现没有必要,就合并成一个了,但仍然保留了2种调用接口,因为不少别的Kernel还依赖于被弃用的那个
性能测试
A100,float16,假设index的长度和shape[axis]相同,用时单位为us
由测试结果可知,本PR主要在可向量化的场景下带来较大的性能提升;对于不可向量化的情况也有略微的提升,这是因为优化了下标的计算方式和增大了loop数量
另外,进行了千级的shape覆盖性测试,也检查了部分shape下float32的性能,均无问题
Pcard-85711